volcengine.organization.ServiceControlPolicyAttachment
Explore with Pulumi AI
Provides a resource to manage organization service control policy attachment
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Volcengine = Pulumi.Volcengine;
return await Deployment.RunAsync(() =>
{
var fooServiceControlPolicy = new Volcengine.Organization.ServiceControlPolicy("fooServiceControlPolicy", new()
{
PolicyName = "tfpolicy11",
Description = "tftest1",
Statement = "{\"Statement\":[{\"Effect\":\"Deny\",\"Action\":[\"ecs:RunInstances\"],\"Resource\":[\"*\"]}]}",
});
var fooServiceControlPolicyAttachment = new Volcengine.Organization.ServiceControlPolicyAttachment("fooServiceControlPolicyAttachment", new()
{
PolicyId = fooServiceControlPolicy.Id,
TargetId = "21*********94",
TargetType = "Account",
});
var foo1 = new Volcengine.Organization.ServiceControlPolicyAttachment("foo1", new()
{
PolicyId = fooServiceControlPolicy.Id,
TargetId = "73*********9",
TargetType = "OU",
});
});
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 {
fooServiceControlPolicy, err := organization.NewServiceControlPolicy(ctx, "fooServiceControlPolicy", &organization.ServiceControlPolicyArgs{
PolicyName: pulumi.String("tfpolicy11"),
Description: pulumi.String("tftest1"),
Statement: pulumi.String("{\"Statement\":[{\"Effect\":\"Deny\",\"Action\":[\"ecs:RunInstances\"],\"Resource\":[\"*\"]}]}"),
})
if err != nil {
return err
}
_, err = organization.NewServiceControlPolicyAttachment(ctx, "fooServiceControlPolicyAttachment", &organization.ServiceControlPolicyAttachmentArgs{
PolicyId: fooServiceControlPolicy.ID(),
TargetId: pulumi.String("21*********94"),
TargetType: pulumi.String("Account"),
})
if err != nil {
return err
}
_, err = organization.NewServiceControlPolicyAttachment(ctx, "foo1", &organization.ServiceControlPolicyAttachmentArgs{
PolicyId: fooServiceControlPolicy.ID(),
TargetId: pulumi.String("73*********9"),
TargetType: pulumi.String("OU"),
})
if err != nil {
return err
}
return nil
})
}
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 com.pulumi.volcengine.organization.ServiceControlPolicyAttachment;
import com.pulumi.volcengine.organization.ServiceControlPolicyAttachmentArgs;
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 fooServiceControlPolicy = new ServiceControlPolicy("fooServiceControlPolicy", ServiceControlPolicyArgs.builder()
.policyName("tfpolicy11")
.description("tftest1")
.statement("{\"Statement\":[{\"Effect\":\"Deny\",\"Action\":[\"ecs:RunInstances\"],\"Resource\":[\"*\"]}]}")
.build());
var fooServiceControlPolicyAttachment = new ServiceControlPolicyAttachment("fooServiceControlPolicyAttachment", ServiceControlPolicyAttachmentArgs.builder()
.policyId(fooServiceControlPolicy.id())
.targetId("21*********94")
.targetType("Account")
.build());
var foo1 = new ServiceControlPolicyAttachment("foo1", ServiceControlPolicyAttachmentArgs.builder()
.policyId(fooServiceControlPolicy.id())
.targetId("73*********9")
.targetType("OU")
.build());
}
}
import pulumi
import pulumi_volcengine as volcengine
foo_service_control_policy = volcengine.organization.ServiceControlPolicy("fooServiceControlPolicy",
policy_name="tfpolicy11",
description="tftest1",
statement="{\"Statement\":[{\"Effect\":\"Deny\",\"Action\":[\"ecs:RunInstances\"],\"Resource\":[\"*\"]}]}")
foo_service_control_policy_attachment = volcengine.organization.ServiceControlPolicyAttachment("fooServiceControlPolicyAttachment",
policy_id=foo_service_control_policy.id,
target_id="21*********94",
target_type="Account")
foo1 = volcengine.organization.ServiceControlPolicyAttachment("foo1",
policy_id=foo_service_control_policy.id,
target_id="73*********9",
target_type="OU")
import * as pulumi from "@pulumi/pulumi";
import * as volcengine from "@volcengine/pulumi";
const fooServiceControlPolicy = new volcengine.organization.ServiceControlPolicy("fooServiceControlPolicy", {
policyName: "tfpolicy11",
description: "tftest1",
statement: "{\"Statement\":[{\"Effect\":\"Deny\",\"Action\":[\"ecs:RunInstances\"],\"Resource\":[\"*\"]}]}",
});
const fooServiceControlPolicyAttachment = new volcengine.organization.ServiceControlPolicyAttachment("fooServiceControlPolicyAttachment", {
policyId: fooServiceControlPolicy.id,
targetId: "21*********94",
targetType: "Account",
});
const foo1 = new volcengine.organization.ServiceControlPolicyAttachment("foo1", {
policyId: fooServiceControlPolicy.id,
targetId: "73*********9",
targetType: "OU",
});
resources:
fooServiceControlPolicy:
type: volcengine:organization:ServiceControlPolicy
properties:
policyName: tfpolicy11
description: tftest1
statement: '{"Statement":[{"Effect":"Deny","Action":["ecs:RunInstances"],"Resource":["*"]}]}'
fooServiceControlPolicyAttachment:
type: volcengine:organization:ServiceControlPolicyAttachment
properties:
policyId: ${fooServiceControlPolicy.id}
targetId: 21*********94
targetType: Account
foo1:
type: volcengine:organization:ServiceControlPolicyAttachment
properties:
policyId: ${fooServiceControlPolicy.id}
targetId: 73*********9
targetType: OU
Create ServiceControlPolicyAttachment Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ServiceControlPolicyAttachment(name: string, args: ServiceControlPolicyAttachmentArgs, opts?: CustomResourceOptions);
@overload
def ServiceControlPolicyAttachment(resource_name: str,
args: ServiceControlPolicyAttachmentArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ServiceControlPolicyAttachment(resource_name: str,
opts: Optional[ResourceOptions] = None,
policy_id: Optional[str] = None,
target_id: Optional[str] = None,
target_type: Optional[str] = None)
func NewServiceControlPolicyAttachment(ctx *Context, name string, args ServiceControlPolicyAttachmentArgs, opts ...ResourceOption) (*ServiceControlPolicyAttachment, error)
public ServiceControlPolicyAttachment(string name, ServiceControlPolicyAttachmentArgs args, CustomResourceOptions? opts = null)
public ServiceControlPolicyAttachment(String name, ServiceControlPolicyAttachmentArgs args)
public ServiceControlPolicyAttachment(String name, ServiceControlPolicyAttachmentArgs args, CustomResourceOptions options)
type: volcengine:organization:ServiceControlPolicyAttachment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args ServiceControlPolicyAttachmentArgs
- 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 ServiceControlPolicyAttachmentArgs
- 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 ServiceControlPolicyAttachmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ServiceControlPolicyAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ServiceControlPolicyAttachmentArgs
- 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 serviceControlPolicyAttachmentResource = new Volcengine.Organization.ServiceControlPolicyAttachment("serviceControlPolicyAttachmentResource", new()
{
PolicyId = "string",
TargetId = "string",
TargetType = "string",
});
example, err := organization.NewServiceControlPolicyAttachment(ctx, "serviceControlPolicyAttachmentResource", &organization.ServiceControlPolicyAttachmentArgs{
PolicyId: pulumi.String("string"),
TargetId: pulumi.String("string"),
TargetType: pulumi.String("string"),
})
var serviceControlPolicyAttachmentResource = new ServiceControlPolicyAttachment("serviceControlPolicyAttachmentResource", ServiceControlPolicyAttachmentArgs.builder()
.policyId("string")
.targetId("string")
.targetType("string")
.build());
service_control_policy_attachment_resource = volcengine.organization.ServiceControlPolicyAttachment("serviceControlPolicyAttachmentResource",
policy_id="string",
target_id="string",
target_type="string")
const serviceControlPolicyAttachmentResource = new volcengine.organization.ServiceControlPolicyAttachment("serviceControlPolicyAttachmentResource", {
policyId: "string",
targetId: "string",
targetType: "string",
});
type: volcengine:organization:ServiceControlPolicyAttachment
properties:
policyId: string
targetId: string
targetType: string
ServiceControlPolicyAttachment 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 ServiceControlPolicyAttachment resource accepts the following input properties:
- Policy
Id string - The id of policy.
- Target
Id string - The id of target.
- Target
Type string - The type of target. Support Account or OU.
- Policy
Id string - The id of policy.
- Target
Id string - The id of target.
- Target
Type string - The type of target. Support Account or OU.
- policy
Id String - The id of policy.
- target
Id String - The id of target.
- target
Type String - The type of target. Support Account or OU.
- policy
Id string - The id of policy.
- target
Id string - The id of target.
- target
Type string - The type of target. Support Account or OU.
- policy_
id str - The id of policy.
- target_
id str - The id of target.
- target_
type str - The type of target. Support Account or OU.
- policy
Id String - The id of policy.
- target
Id String - The id of target.
- target
Type String - The type of target. Support Account or OU.
Outputs
All input properties are implicitly available as output properties. Additionally, the ServiceControlPolicyAttachment resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing ServiceControlPolicyAttachment Resource
Get an existing ServiceControlPolicyAttachment 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?: ServiceControlPolicyAttachmentState, opts?: CustomResourceOptions): ServiceControlPolicyAttachment
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
policy_id: Optional[str] = None,
target_id: Optional[str] = None,
target_type: Optional[str] = None) -> ServiceControlPolicyAttachment
func GetServiceControlPolicyAttachment(ctx *Context, name string, id IDInput, state *ServiceControlPolicyAttachmentState, opts ...ResourceOption) (*ServiceControlPolicyAttachment, error)
public static ServiceControlPolicyAttachment Get(string name, Input<string> id, ServiceControlPolicyAttachmentState? state, CustomResourceOptions? opts = null)
public static ServiceControlPolicyAttachment get(String name, Output<String> id, ServiceControlPolicyAttachmentState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- Policy
Id string - The id of policy.
- Target
Id string - The id of target.
- Target
Type string - The type of target. Support Account or OU.
- Policy
Id string - The id of policy.
- Target
Id string - The id of target.
- Target
Type string - The type of target. Support Account or OU.
- policy
Id String - The id of policy.
- target
Id String - The id of target.
- target
Type String - The type of target. Support Account or OU.
- policy
Id string - The id of policy.
- target
Id string - The id of target.
- target
Type string - The type of target. Support Account or OU.
- policy_
id str - The id of policy.
- target_
id str - The id of target.
- target_
type str - The type of target. Support Account or OU.
- policy
Id String - The id of policy.
- target
Id String - The id of target.
- target
Type String - The type of target. Support Account or OU.
Import
Service Control policy attachment can be imported using the id, e.g.
$ pulumi import volcengine:organization/serviceControlPolicyAttachment:ServiceControlPolicyAttachment default PolicyID:TargetID
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.