1. Packages
  2. Packages
  3. Bytepluscc Provider
  4. API Docs
  5. organization
  6. ServiceControlPolicy
Viewing docs for bytepluscc v0.0.39
published on Thursday, Jul 9, 2026 by Byteplus
bytepluscc logo
Viewing docs for bytepluscc v0.0.39
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:

    PolicyName string
    Policy name.
    Statement string
    Policy expression.
    Description string
    Description.
    Targets List<Byteplus.ServiceControlPolicyTarget>
    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.
    PolicyName string
    Policy name.
    Statement string
    Policy expression.
    Description string
    Description.
    Targets []ServiceControlPolicyTargetArgs
    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.
    policyName String
    Policy name.
    statement String
    Policy expression.
    description String
    Description.
    targets List<ServiceControlPolicyTarget>
    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.
    policyName string
    Policy name.
    statement string
    Policy expression.
    description string
    Description.
    targets ServiceControlPolicyTarget[]
    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[ServiceControlPolicyTargetArgs]
    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.
    policyName 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:

    CreateDate string
    Creation time.
    Id string
    The provider-assigned unique ID for this managed resource.
    PolicyId string
    Policy ID.
    PolicyType string
    Policy type.
    UpdateDate string
    Update time.
    CreateDate string
    Creation time.
    Id string
    The provider-assigned unique ID for this managed resource.
    PolicyId string
    Policy ID.
    PolicyType string
    Policy type.
    UpdateDate 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.
    createDate String
    Creation time.
    id String
    The provider-assigned unique ID for this managed resource.
    policyId String
    Policy ID.
    policyType String
    Policy type.
    updateDate String
    Update time.
    createDate string
    Creation time.
    id string
    The provider-assigned unique ID for this managed resource.
    policyId string
    Policy ID.
    policyType string
    Policy type.
    updateDate 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.
    createDate String
    Creation time.
    id String
    The provider-assigned unique ID for this managed resource.
    policyId String
    Policy ID.
    policyType String
    Policy type.
    updateDate 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) -> ServiceControlPolicy
    func 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.
    The following state arguments are supported:
    CreateDate string
    Creation time.
    Description string
    Description.
    PolicyId string
    Policy ID.
    PolicyName string
    Policy name.
    PolicyType string
    Policy type.
    Statement string
    Policy expression.
    Targets List<Byteplus.ServiceControlPolicyTarget>
    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.
    UpdateDate string
    Update time.
    CreateDate string
    Creation time.
    Description string
    Description.
    PolicyId string
    Policy ID.
    PolicyName string
    Policy name.
    PolicyType string
    Policy type.
    Statement string
    Policy expression.
    Targets []ServiceControlPolicyTargetArgs
    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.
    UpdateDate 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.
    createDate String
    Creation time.
    description String
    Description.
    policyId String
    Policy ID.
    policyName String
    Policy name.
    policyType String
    Policy type.
    statement String
    Policy expression.
    targets List<ServiceControlPolicyTarget>
    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.
    updateDate String
    Update time.
    createDate string
    Creation time.
    description string
    Description.
    policyId string
    Policy ID.
    policyName string
    Policy name.
    policyType string
    Policy type.
    statement string
    Policy expression.
    targets ServiceControlPolicyTarget[]
    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.
    updateDate 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[ServiceControlPolicyTargetArgs]
    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.
    createDate String
    Creation time.
    description String
    Description.
    policyId String
    Policy ID.
    policyName String
    Policy name.
    policyType 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.
    updateDate String
    Update time.

    Supporting Types

    ServiceControlPolicyTarget, ServiceControlPolicyTargetArgs

    TargetId string
    Target ID.
    TargetType string
    Target type: 1. OU 2. Account.
    TargetId string
    Target ID.
    TargetType string
    Target type: 1. OU 2. Account.
    target_id string
    Target ID.
    target_type string
    Target type: 1. OU 2. Account.
    targetId String
    Target ID.
    targetType String
    Target type: 1. OU 2. Account.
    targetId string
    Target ID.
    targetType string
    Target type: 1. OU 2. Account.
    target_id str
    Target ID.
    target_type str
    Target type: 1. OU 2. Account.
    targetId String
    Target ID.
    targetType 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 bytepluscc Terraform Provider.
    bytepluscc logo
    Viewing docs for bytepluscc v0.0.39
    published on Thursday, Jul 9, 2026 by Byteplus

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial