1. Packages
  2. Volcengine
  3. API Docs
  4. organization
  5. ServiceControlPolicy
Volcengine v0.0.27 published on Tuesday, Dec 10, 2024 by Volcengine

volcengine.organization.ServiceControlPolicy

Explore with Pulumi AI

Provides a resource to manage organization service control policy

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as volcengine from "@volcengine/pulumi";

const foo = new volcengine.organization.ServiceControlPolicy("foo", {
    description: "tftest1",
    policyName: "tfpolicy11",
    statement: "{\"Statement\":[{\"Effect\":\"Deny\",\"Action\":[\"ecs:RunInstances\"],\"Resource\":[\"*\"]}]}",
});
const foo2 = new volcengine.organization.ServiceControlPolicy("foo2", {
    policyName: "tfpolicy21",
    statement: "{\"Statement\":[{\"Effect\":\"Deny\",\"Action\":[\"ecs:DeleteInstance\"],\"Resource\":[\"*\"]}]}",
});
Copy
import pulumi
import pulumi_volcengine as volcengine

foo = volcengine.organization.ServiceControlPolicy("foo",
    description="tftest1",
    policy_name="tfpolicy11",
    statement="{\"Statement\":[{\"Effect\":\"Deny\",\"Action\":[\"ecs:RunInstances\"],\"Resource\":[\"*\"]}]}")
foo2 = volcengine.organization.ServiceControlPolicy("foo2",
    policy_name="tfpolicy21",
    statement="{\"Statement\":[{\"Effect\":\"Deny\",\"Action\":[\"ecs:DeleteInstance\"],\"Resource\":[\"*\"]}]}")
Copy
package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/organization"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := organization.NewServiceControlPolicy(ctx, "foo", &organization.ServiceControlPolicyArgs{
			Description: pulumi.String("tftest1"),
			PolicyName:  pulumi.String("tfpolicy11"),
			Statement:   pulumi.String("{\"Statement\":[{\"Effect\":\"Deny\",\"Action\":[\"ecs:RunInstances\"],\"Resource\":[\"*\"]}]}"),
		})
		if err != nil {
			return err
		}
		_, err = organization.NewServiceControlPolicy(ctx, "foo2", &organization.ServiceControlPolicyArgs{
			PolicyName: pulumi.String("tfpolicy21"),
			Statement:  pulumi.String("{\"Statement\":[{\"Effect\":\"Deny\",\"Action\":[\"ecs:DeleteInstance\"],\"Resource\":[\"*\"]}]}"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Volcengine = Pulumi.Volcengine;

return await Deployment.RunAsync(() => 
{
    var foo = new Volcengine.Organization.ServiceControlPolicy("foo", new()
    {
        Description = "tftest1",
        PolicyName = "tfpolicy11",
        Statement = "{\"Statement\":[{\"Effect\":\"Deny\",\"Action\":[\"ecs:RunInstances\"],\"Resource\":[\"*\"]}]}",
    });

    var foo2 = new Volcengine.Organization.ServiceControlPolicy("foo2", new()
    {
        PolicyName = "tfpolicy21",
        Statement = "{\"Statement\":[{\"Effect\":\"Deny\",\"Action\":[\"ecs:DeleteInstance\"],\"Resource\":[\"*\"]}]}",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.volcengine.organization.ServiceControlPolicy;
import com.pulumi.volcengine.organization.ServiceControlPolicyArgs;
import java.util.List;
import java.util.ArrayList;
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 foo = new ServiceControlPolicy("foo", ServiceControlPolicyArgs.builder()        
            .description("tftest1")
            .policyName("tfpolicy11")
            .statement("{\"Statement\":[{\"Effect\":\"Deny\",\"Action\":[\"ecs:RunInstances\"],\"Resource\":[\"*\"]}]}")
            .build());

        var foo2 = new ServiceControlPolicy("foo2", ServiceControlPolicyArgs.builder()        
            .policyName("tfpolicy21")
            .statement("{\"Statement\":[{\"Effect\":\"Deny\",\"Action\":[\"ecs:DeleteInstance\"],\"Resource\":[\"*\"]}]}")
            .build());

    }
}
Copy
resources:
  foo:
    type: volcengine:organization:ServiceControlPolicy
    properties:
      description: tftest1
      policyName: tfpolicy11
      statement: '{"Statement":[{"Effect":"Deny","Action":["ecs:RunInstances"],"Resource":["*"]}]}'
  foo2:
    type: volcengine:organization:ServiceControlPolicy
    properties:
      policyName: tfpolicy21
      statement: '{"Statement":[{"Effect":"Deny","Action":["ecs:DeleteInstance"],"Resource":["*"]}]}'
Copy

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)
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: volcengine:organization:ServiceControlPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ServiceControlPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. 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 This property is required. string
The unique name of the resource.
args This property is required. ServiceControlPolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ServiceControlPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. 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 Volcengine.Organization.ServiceControlPolicy("serviceControlPolicyResource", new()
{
    PolicyName = "string",
    Statement = "string",
    Description = "string",
});
Copy
example, err := organization.NewServiceControlPolicy(ctx, "serviceControlPolicyResource", &organization.ServiceControlPolicyArgs{
	PolicyName:  pulumi.String("string"),
	Statement:   pulumi.String("string"),
	Description: pulumi.String("string"),
})
Copy
var serviceControlPolicyResource = new ServiceControlPolicy("serviceControlPolicyResource", ServiceControlPolicyArgs.builder()
    .policyName("string")
    .statement("string")
    .description("string")
    .build());
Copy
service_control_policy_resource = volcengine.organization.ServiceControlPolicy("serviceControlPolicyResource",
    policy_name="string",
    statement="string",
    description="string")
Copy
const serviceControlPolicyResource = new volcengine.organization.ServiceControlPolicy("serviceControlPolicyResource", {
    policyName: "string",
    statement: "string",
    description: "string",
});
Copy
type: volcengine:organization:ServiceControlPolicy
properties:
    description: string
    policyName: string
    statement: string
Copy

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 This property is required. string
The name of the Policy.
Statement This property is required. string
The statement of the Policy.
Description string
The description of the Policy.
PolicyName This property is required. string
The name of the Policy.
Statement This property is required. string
The statement of the Policy.
Description string
The description of the Policy.
policyName This property is required. String
The name of the Policy.
statement This property is required. String
The statement of the Policy.
description String
The description of the Policy.
policyName This property is required. string
The name of the Policy.
statement This property is required. string
The statement of the Policy.
description string
The description of the Policy.
policy_name This property is required. str
The name of the Policy.
statement This property is required. str
The statement of the Policy.
description str
The description of the Policy.
policyName This property is required. String
The name of the Policy.
statement This property is required. String
The statement of the Policy.
description String
The description of the Policy.

Outputs

All input properties are implicitly available as output properties. Additionally, the ServiceControlPolicy resource produces the following output properties:

CreateDate string
The create time of the Policy.
Id string
The provider-assigned unique ID for this managed resource.
PolicyType string
The type of the Policy.
UpdateDate string
The update time of the Policy.
CreateDate string
The create time of the Policy.
Id string
The provider-assigned unique ID for this managed resource.
PolicyType string
The type of the Policy.
UpdateDate string
The update time of the Policy.
createDate String
The create time of the Policy.
id String
The provider-assigned unique ID for this managed resource.
policyType String
The type of the Policy.
updateDate String
The update time of the Policy.
createDate string
The create time of the Policy.
id string
The provider-assigned unique ID for this managed resource.
policyType string
The type of the Policy.
updateDate string
The update time of the Policy.
create_date str
The create time of the Policy.
id str
The provider-assigned unique ID for this managed resource.
policy_type str
The type of the Policy.
update_date str
The update time of the Policy.
createDate String
The create time of the Policy.
id String
The provider-assigned unique ID for this managed resource.
policyType String
The type of the Policy.
updateDate String
The update time of the Policy.

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_name: Optional[str] = None,
        policy_type: Optional[str] = None,
        statement: Optional[str] = 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: volcengine:organization:ServiceControlPolicy    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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
The create time of the Policy.
Description string
The description of the Policy.
PolicyName string
The name of the Policy.
PolicyType string
The type of the Policy.
Statement string
The statement of the Policy.
UpdateDate string
The update time of the Policy.
CreateDate string
The create time of the Policy.
Description string
The description of the Policy.
PolicyName string
The name of the Policy.
PolicyType string
The type of the Policy.
Statement string
The statement of the Policy.
UpdateDate string
The update time of the Policy.
createDate String
The create time of the Policy.
description String
The description of the Policy.
policyName String
The name of the Policy.
policyType String
The type of the Policy.
statement String
The statement of the Policy.
updateDate String
The update time of the Policy.
createDate string
The create time of the Policy.
description string
The description of the Policy.
policyName string
The name of the Policy.
policyType string
The type of the Policy.
statement string
The statement of the Policy.
updateDate string
The update time of the Policy.
create_date str
The create time of the Policy.
description str
The description of the Policy.
policy_name str
The name of the Policy.
policy_type str
The type of the Policy.
statement str
The statement of the Policy.
update_date str
The update time of the Policy.
createDate String
The create time of the Policy.
description String
The description of the Policy.
policyName String
The name of the Policy.
policyType String
The type of the Policy.
statement String
The statement of the Policy.
updateDate String
The update time of the Policy.

Import

Service Control Policy can be imported using the id, e.g.

$ pulumi import volcengine:organization/serviceControlPolicy:ServiceControlPolicy default 1000001
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
volcengine volcengine/pulumi-volcengine
License
Apache-2.0
Notes
This Pulumi package is based on the volcengine Terraform Provider.