published on Thursday, Jul 9, 2026 by Byteplus
published on Thursday, Jul 9, 2026 by Byteplus
Control policy.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as bytepluscc from "@byteplus/pulumi-bytepluscc";
const organizationServiceControlPolicyDemo = new bytepluscc.organization.ServiceControlPolicy("OrganizationServiceControlPolicyDemo", {
policyName: "ccapi-test",
description: "ccapi-test-desc",
statement: JSON.stringify({
Statement: [{
Effect: "Deny",
Action: ["iam:*"],
Resource: ["*"],
Condition: {
StringNotEqualsIfExists: {
"volc:UserName": ["a"],
},
},
}],
}),
targets: [
{
target_id: "212***",
target_type: "Account",
},
{
target_id: "21****",
target_type: "Account",
},
],
});
import pulumi
import json
import pulumi_bytepluscc as bytepluscc
organization_service_control_policy_demo = bytepluscc.organization.ServiceControlPolicy("OrganizationServiceControlPolicyDemo",
policy_name="ccapi-test",
description="ccapi-test-desc",
statement=json.dumps({
"Statement": [{
"Effect": "Deny",
"Action": ["iam:*"],
"Resource": ["*"],
"Condition": {
"StringNotEqualsIfExists": {
"volc:UserName": ["a"],
},
},
}],
}),
targets=[
{
"target_id": "212***",
"target_type": "Account",
},
{
"target_id": "21****",
"target_type": "Account",
},
])
package main
import (
"encoding/json"
"github.com/byteplus-sdk/pulumi-bytepluscc/sdk/go/bytepluscc/organization"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
tmpJSON0, err := json.Marshal(map[string]interface{}{
"Statement": []map[string]interface{}{
map[string]interface{}{
"Effect": "Deny",
"Action": []string{
"iam:*",
},
"Resource": []string{
"*",
},
"Condition": map[string]interface{}{
"StringNotEqualsIfExists": map[string]interface{}{
"volc:UserName": []string{
"a",
},
},
},
},
},
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
_, err = organization.NewServiceControlPolicy(ctx, "OrganizationServiceControlPolicyDemo", &organization.ServiceControlPolicyArgs{
PolicyName: pulumi.String("ccapi-test"),
Description: pulumi.String("ccapi-test-desc"),
Statement: pulumi.String(json0),
Targets: organization.ServiceControlPolicyTargetArray{
&organization.ServiceControlPolicyTargetArgs{
Target_id: "212***",
Target_type: "Account",
},
&organization.ServiceControlPolicyTargetArgs{
Target_id: "21****",
Target_type: "Account",
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Bytepluscc = Byteplus.Pulumi.Bytepluscc;
return await Deployment.RunAsync(() =>
{
var organizationServiceControlPolicyDemo = new Bytepluscc.Organization.ServiceControlPolicy("OrganizationServiceControlPolicyDemo", new()
{
PolicyName = "ccapi-test",
Description = "ccapi-test-desc",
Statement = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["Statement"] = new[]
{
new Dictionary<string, object?>
{
["Effect"] = "Deny",
["Action"] = new[]
{
"iam:*",
},
["Resource"] = new[]
{
"*",
},
["Condition"] = new Dictionary<string, object?>
{
["StringNotEqualsIfExists"] = new Dictionary<string, object?>
{
["volc:UserName"] = new[]
{
"a",
},
},
},
},
},
}),
Targets = new[]
{
new Bytepluscc.Organization.Inputs.ServiceControlPolicyTargetArgs
{
Target_id = "212***",
Target_type = "Account",
},
new Bytepluscc.Organization.Inputs.ServiceControlPolicyTargetArgs
{
Target_id = "21****",
Target_type = "Account",
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.byteplus.bytepluscc.organization.ServiceControlPolicy;
import com.byteplus.bytepluscc.organization.ServiceControlPolicyArgs;
import com.pulumi.bytepluscc.organization.inputs.ServiceControlPolicyTargetArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var organizationServiceControlPolicyDemo = new ServiceControlPolicy("organizationServiceControlPolicyDemo", ServiceControlPolicyArgs.builder()
.policyName("ccapi-test")
.description("ccapi-test-desc")
.statement(serializeJson(
jsonObject(
jsonProperty("Statement", jsonArray(jsonObject(
jsonProperty("Effect", "Deny"),
jsonProperty("Action", jsonArray("iam:*")),
jsonProperty("Resource", jsonArray("*")),
jsonProperty("Condition", jsonObject(
jsonProperty("StringNotEqualsIfExists", jsonObject(
jsonProperty("volc:UserName", jsonArray("a"))
))
))
)))
)))
.targets(
ServiceControlPolicyTargetArgs.builder()
.target_id("212***")
.target_type("Account")
.build(),
ServiceControlPolicyTargetArgs.builder()
.target_id("21****")
.target_type("Account")
.build())
.build());
}
}
resources:
organizationServiceControlPolicyDemo:
type: bytepluscc:organization:ServiceControlPolicy
name: OrganizationServiceControlPolicyDemo
properties:
policyName: ccapi-test
description: ccapi-test-desc
statement:
fn::toJSON:
Statement:
- Effect: Deny
Action:
- iam:*
Resource:
- '*'
Condition:
StringNotEqualsIfExists:
volc:UserName:
- a
targets:
- target_id: 212***
target_type: Account
- target_id: 21****
target_type: Account
pulumi {
required_providers {
bytepluscc = {
source = "pulumi/bytepluscc"
}
}
}
resource "bytepluscc_organization_servicecontrolpolicy" "OrganizationServiceControlPolicyDemo" {
policy_name = "ccapi-test"
description = "ccapi-test-desc"
statement = jsonencode({
"Statement" = [{
"Effect" = "Deny"
"Action" = ["iam:*"]
"Resource" = ["*"]
"Condition" = {
"StringNotEqualsIfExists" = {
"volc:UserName" = ["a"]
}
}
}]
})
targets {
target_id = "212***"
target_type = "Account"
}
targets {
target_id = "21****"
target_type = "Account"
}
}
Create ServiceControlPolicy Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ServiceControlPolicy(name: string, args: ServiceControlPolicyArgs, opts?: CustomResourceOptions);@overload
def ServiceControlPolicy(resource_name: str,
args: ServiceControlPolicyArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ServiceControlPolicy(resource_name: str,
opts: Optional[ResourceOptions] = None,
policy_name: Optional[str] = None,
statement: Optional[str] = None,
description: Optional[str] = None,
targets: Optional[Sequence[ServiceControlPolicyTargetArgs]] = None)func NewServiceControlPolicy(ctx *Context, name string, args ServiceControlPolicyArgs, opts ...ResourceOption) (*ServiceControlPolicy, error)public ServiceControlPolicy(string name, ServiceControlPolicyArgs args, CustomResourceOptions? opts = null)
public ServiceControlPolicy(String name, ServiceControlPolicyArgs args)
public ServiceControlPolicy(String name, ServiceControlPolicyArgs args, CustomResourceOptions options)
type: bytepluscc:organization:ServiceControlPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "bytepluscc_organization_servicecontrolpolicy" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args ServiceControlPolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args ServiceControlPolicyArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args ServiceControlPolicyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ServiceControlPolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ServiceControlPolicyArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var serviceControlPolicyResource = new Bytepluscc.Organization.ServiceControlPolicy("serviceControlPolicyResource", new()
{
PolicyName = "string",
Statement = "string",
Description = "string",
Targets = new[]
{
new Bytepluscc.Organization.Inputs.ServiceControlPolicyTargetArgs
{
TargetId = "string",
TargetType = "string",
},
},
});
example, err := organization.NewServiceControlPolicy(ctx, "serviceControlPolicyResource", &organization.ServiceControlPolicyArgs{
PolicyName: pulumi.String("string"),
Statement: pulumi.String("string"),
Description: pulumi.String("string"),
Targets: organization.ServiceControlPolicyTargetArray{
&organization.ServiceControlPolicyTargetArgs{
TargetId: pulumi.String("string"),
TargetType: pulumi.String("string"),
},
},
})
resource "bytepluscc_organization_servicecontrolpolicy" "serviceControlPolicyResource" {
policy_name = "string"
statement = "string"
description = "string"
targets {
target_id = "string"
target_type = "string"
}
}
var serviceControlPolicyResource = new ServiceControlPolicy("serviceControlPolicyResource", ServiceControlPolicyArgs.builder()
.policyName("string")
.statement("string")
.description("string")
.targets(ServiceControlPolicyTargetArgs.builder()
.targetId("string")
.targetType("string")
.build())
.build());
service_control_policy_resource = bytepluscc.organization.ServiceControlPolicy("serviceControlPolicyResource",
policy_name="string",
statement="string",
description="string",
targets=[{
"target_id": "string",
"target_type": "string",
}])
const serviceControlPolicyResource = new bytepluscc.organization.ServiceControlPolicy("serviceControlPolicyResource", {
policyName: "string",
statement: "string",
description: "string",
targets: [{
targetId: "string",
targetType: "string",
}],
});
type: bytepluscc:organization:ServiceControlPolicy
properties:
description: string
policyName: string
statement: string
targets:
- targetId: string
targetType: string
ServiceControlPolicy Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The ServiceControlPolicy resource accepts the following input properties:
- Policy
Name string - Policy name.
- Statement string
- Policy expression.
- Description string
- Description.
- Targets
List<Byteplus.
Service Control Policy Target> - List of bound target objects. Important Note: When using SetNestedAttribute, you must fully define all attributes of its nested structure. Incomplete definitions may cause Terraform to detect unexpected differences during plan comparison, triggering unnecessary resource updates and affecting resource stability and predictability.
- Policy
Name string - Policy name.
- Statement string
- Policy expression.
- Description string
- Description.
- Targets
[]Service
Control Policy Target Args - List of bound target objects. Important Note: When using SetNestedAttribute, you must fully define all attributes of its nested structure. Incomplete definitions may cause Terraform to detect unexpected differences during plan comparison, triggering unnecessary resource updates and affecting resource stability and predictability.
- policy_
name string - Policy name.
- statement string
- Policy expression.
- description string
- Description.
- targets list(object)
- List of bound target objects. Important Note: When using SetNestedAttribute, you must fully define all attributes of its nested structure. Incomplete definitions may cause Terraform to detect unexpected differences during plan comparison, triggering unnecessary resource updates and affecting resource stability and predictability.
- policy
Name String - Policy name.
- statement String
- Policy expression.
- description String
- Description.
- targets
List<Service
Control Policy Target> - List of bound target objects. Important Note: When using SetNestedAttribute, you must fully define all attributes of its nested structure. Incomplete definitions may cause Terraform to detect unexpected differences during plan comparison, triggering unnecessary resource updates and affecting resource stability and predictability.
- policy
Name string - Policy name.
- statement string
- Policy expression.
- description string
- Description.
- targets
Service
Control Policy Target[] - List of bound target objects. Important Note: When using SetNestedAttribute, you must fully define all attributes of its nested structure. Incomplete definitions may cause Terraform to detect unexpected differences during plan comparison, triggering unnecessary resource updates and affecting resource stability and predictability.
- policy_
name str - Policy name.
- statement str
- Policy expression.
- description str
- Description.
- targets
Sequence[Service
Control Policy Target Args] - List of bound target objects. Important Note: When using SetNestedAttribute, you must fully define all attributes of its nested structure. Incomplete definitions may cause Terraform to detect unexpected differences during plan comparison, triggering unnecessary resource updates and affecting resource stability and predictability.
- policy
Name String - Policy name.
- statement String
- Policy expression.
- description String
- Description.
- targets List<Property Map>
- List of bound target objects. Important Note: When using SetNestedAttribute, you must fully define all attributes of its nested structure. Incomplete definitions may cause Terraform to detect unexpected differences during plan comparison, triggering unnecessary resource updates and affecting resource stability and predictability.
Outputs
All input properties are implicitly available as output properties. Additionally, the ServiceControlPolicy resource produces the following output properties:
- Create
Date string - Creation time.
- Id string
- The provider-assigned unique ID for this managed resource.
- Policy
Id string - Policy ID.
- Policy
Type string - Policy type.
- Update
Date string - Update time.
- Create
Date string - Creation time.
- Id string
- The provider-assigned unique ID for this managed resource.
- Policy
Id string - Policy ID.
- Policy
Type string - Policy type.
- Update
Date string - Update time.
- create_
date string - Creation time.
- id string
- The provider-assigned unique ID for this managed resource.
- policy_
id string - Policy ID.
- policy_
type string - Policy type.
- update_
date string - Update time.
- create
Date String - Creation time.
- id String
- The provider-assigned unique ID for this managed resource.
- policy
Id String - Policy ID.
- policy
Type String - Policy type.
- update
Date String - Update time.
- create
Date string - Creation time.
- id string
- The provider-assigned unique ID for this managed resource.
- policy
Id string - Policy ID.
- policy
Type string - Policy type.
- update
Date string - Update time.
- create_
date str - Creation time.
- id str
- The provider-assigned unique ID for this managed resource.
- policy_
id str - Policy ID.
- policy_
type str - Policy type.
- update_
date str - Update time.
- create
Date String - Creation time.
- id String
- The provider-assigned unique ID for this managed resource.
- policy
Id String - Policy ID.
- policy
Type String - Policy type.
- update
Date String - Update time.
Look up Existing ServiceControlPolicy Resource
Get an existing ServiceControlPolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: ServiceControlPolicyState, opts?: CustomResourceOptions): ServiceControlPolicy@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
create_date: Optional[str] = None,
description: Optional[str] = None,
policy_id: Optional[str] = None,
policy_name: Optional[str] = None,
policy_type: Optional[str] = None,
statement: Optional[str] = None,
targets: Optional[Sequence[ServiceControlPolicyTargetArgs]] = None,
update_date: Optional[str] = None) -> ServiceControlPolicyfunc GetServiceControlPolicy(ctx *Context, name string, id IDInput, state *ServiceControlPolicyState, opts ...ResourceOption) (*ServiceControlPolicy, error)public static ServiceControlPolicy Get(string name, Input<string> id, ServiceControlPolicyState? state, CustomResourceOptions? opts = null)public static ServiceControlPolicy get(String name, Output<String> id, ServiceControlPolicyState state, CustomResourceOptions options)resources: _: type: bytepluscc:organization:ServiceControlPolicy get: id: ${id}import {
to = bytepluscc_organization_servicecontrolpolicy.example
id = "${id}"
}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Create
Date string - Creation time.
- Description string
- Description.
- Policy
Id string - Policy ID.
- Policy
Name string - Policy name.
- Policy
Type string - Policy type.
- Statement string
- Policy expression.
- Targets
List<Byteplus.
Service Control Policy Target> - List of bound target objects. Important Note: When using SetNestedAttribute, you must fully define all attributes of its nested structure. Incomplete definitions may cause Terraform to detect unexpected differences during plan comparison, triggering unnecessary resource updates and affecting resource stability and predictability.
- Update
Date string - Update time.
- Create
Date string - Creation time.
- Description string
- Description.
- Policy
Id string - Policy ID.
- Policy
Name string - Policy name.
- Policy
Type string - Policy type.
- Statement string
- Policy expression.
- Targets
[]Service
Control Policy Target Args - List of bound target objects. Important Note: When using SetNestedAttribute, you must fully define all attributes of its nested structure. Incomplete definitions may cause Terraform to detect unexpected differences during plan comparison, triggering unnecessary resource updates and affecting resource stability and predictability.
- Update
Date string - Update time.
- create_
date string - Creation time.
- description string
- Description.
- policy_
id string - Policy ID.
- policy_
name string - Policy name.
- policy_
type string - Policy type.
- statement string
- Policy expression.
- targets list(object)
- List of bound target objects. Important Note: When using SetNestedAttribute, you must fully define all attributes of its nested structure. Incomplete definitions may cause Terraform to detect unexpected differences during plan comparison, triggering unnecessary resource updates and affecting resource stability and predictability.
- update_
date string - Update time.
- create
Date String - Creation time.
- description String
- Description.
- policy
Id String - Policy ID.
- policy
Name String - Policy name.
- policy
Type String - Policy type.
- statement String
- Policy expression.
- targets
List<Service
Control Policy Target> - List of bound target objects. Important Note: When using SetNestedAttribute, you must fully define all attributes of its nested structure. Incomplete definitions may cause Terraform to detect unexpected differences during plan comparison, triggering unnecessary resource updates and affecting resource stability and predictability.
- update
Date String - Update time.
- create
Date string - Creation time.
- description string
- Description.
- policy
Id string - Policy ID.
- policy
Name string - Policy name.
- policy
Type string - Policy type.
- statement string
- Policy expression.
- targets
Service
Control Policy Target[] - List of bound target objects. Important Note: When using SetNestedAttribute, you must fully define all attributes of its nested structure. Incomplete definitions may cause Terraform to detect unexpected differences during plan comparison, triggering unnecessary resource updates and affecting resource stability and predictability.
- update
Date string - Update time.
- create_
date str - Creation time.
- description str
- Description.
- policy_
id str - Policy ID.
- policy_
name str - Policy name.
- policy_
type str - Policy type.
- statement str
- Policy expression.
- targets
Sequence[Service
Control Policy Target Args] - List of bound target objects. Important Note: When using SetNestedAttribute, you must fully define all attributes of its nested structure. Incomplete definitions may cause Terraform to detect unexpected differences during plan comparison, triggering unnecessary resource updates and affecting resource stability and predictability.
- update_
date str - Update time.
- create
Date String - Creation time.
- description String
- Description.
- policy
Id String - Policy ID.
- policy
Name String - Policy name.
- policy
Type String - Policy type.
- statement String
- Policy expression.
- targets List<Property Map>
- List of bound target objects. Important Note: When using SetNestedAttribute, you must fully define all attributes of its nested structure. Incomplete definitions may cause Terraform to detect unexpected differences during plan comparison, triggering unnecessary resource updates and affecting resource stability and predictability.
- update
Date String - Update time.
Supporting Types
ServiceControlPolicyTarget, ServiceControlPolicyTargetArgs
- Target
Id string - Target ID.
- Target
Type string - Target type: 1. OU 2. Account.
- Target
Id string - Target ID.
- Target
Type string - Target type: 1. OU 2. Account.
- target_
id string - Target ID.
- target_
type string - Target type: 1. OU 2. Account.
- target
Id String - Target ID.
- target
Type String - Target type: 1. OU 2. Account.
- target
Id string - Target ID.
- target
Type string - Target type: 1. OU 2. Account.
- target_
id str - Target ID.
- target_
type str - Target type: 1. OU 2. Account.
- target
Id String - Target ID.
- target
Type String - Target type: 1. OU 2. Account.
Import
$ pulumi import bytepluscc:organization/serviceControlPolicy:ServiceControlPolicy example "policy_id"
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- bytepluscc byteplus-sdk/pulumi-bytepluscc
- License
- MPL-2.0
- Notes
- This Pulumi package is based on the
byteplusccTerraform Provider.
published on Thursday, Jul 9, 2026 by Byteplus