1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. CamGroupPolicyAttachment
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

tencentcloud.CamGroupPolicyAttachment

Explore with Pulumi AI

tencentcloud logo
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

    Provides a resource to create a CAM group policy attachment.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const config = new pulumi.Config();
    const camPolicyBasic = config.get("camPolicyBasic") || "keep-cam-policy";
    const camGroupBasic = config.get("camGroupBasic") || "keep-cam-group";
    const groups = tencentcloud.getCamGroups({
        name: camGroupBasic,
    });
    const policy = tencentcloud.getCamPolicies({
        name: camPolicyBasic,
    });
    const groupPolicyAttachmentBasic = new tencentcloud.CamGroupPolicyAttachment("groupPolicyAttachmentBasic", {
        groupId: groups.then(groups => groups.groupLists?.[0]?.groupId),
        policyId: policy.then(policy => policy.policyLists?.[0]?.policyId),
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    config = pulumi.Config()
    cam_policy_basic = config.get("camPolicyBasic")
    if cam_policy_basic is None:
        cam_policy_basic = "keep-cam-policy"
    cam_group_basic = config.get("camGroupBasic")
    if cam_group_basic is None:
        cam_group_basic = "keep-cam-group"
    groups = tencentcloud.get_cam_groups(name=cam_group_basic)
    policy = tencentcloud.get_cam_policies(name=cam_policy_basic)
    group_policy_attachment_basic = tencentcloud.CamGroupPolicyAttachment("groupPolicyAttachmentBasic",
        group_id=groups.group_lists[0].group_id,
        policy_id=policy.policy_lists[0].policy_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		camPolicyBasic := "keep-cam-policy"
    		if param := cfg.Get("camPolicyBasic"); param != "" {
    			camPolicyBasic = param
    		}
    		camGroupBasic := "keep-cam-group"
    		if param := cfg.Get("camGroupBasic"); param != "" {
    			camGroupBasic = param
    		}
    		groups, err := tencentcloud.GetCamGroups(ctx, &tencentcloud.GetCamGroupsArgs{
    			Name: pulumi.StringRef(camGroupBasic),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		policy, err := tencentcloud.GetCamPolicies(ctx, &tencentcloud.GetCamPoliciesArgs{
    			Name: pulumi.StringRef(camPolicyBasic),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = tencentcloud.NewCamGroupPolicyAttachment(ctx, "groupPolicyAttachmentBasic", &tencentcloud.CamGroupPolicyAttachmentArgs{
    			GroupId:  pulumi.String(groups.GroupLists[0].GroupId),
    			PolicyId: pulumi.String(policy.PolicyLists[0].PolicyId),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Tencentcloud = Pulumi.Tencentcloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var camPolicyBasic = config.Get("camPolicyBasic") ?? "keep-cam-policy";
        var camGroupBasic = config.Get("camGroupBasic") ?? "keep-cam-group";
        var groups = Tencentcloud.GetCamGroups.Invoke(new()
        {
            Name = camGroupBasic,
        });
    
        var policy = Tencentcloud.GetCamPolicies.Invoke(new()
        {
            Name = camPolicyBasic,
        });
    
        var groupPolicyAttachmentBasic = new Tencentcloud.CamGroupPolicyAttachment("groupPolicyAttachmentBasic", new()
        {
            GroupId = groups.Apply(getCamGroupsResult => getCamGroupsResult.GroupLists[0]?.GroupId),
            PolicyId = policy.Apply(getCamPoliciesResult => getCamPoliciesResult.PolicyLists[0]?.PolicyId),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.TencentcloudFunctions;
    import com.pulumi.tencentcloud.inputs.GetCamGroupsArgs;
    import com.pulumi.tencentcloud.inputs.GetCamPoliciesArgs;
    import com.pulumi.tencentcloud.CamGroupPolicyAttachment;
    import com.pulumi.tencentcloud.CamGroupPolicyAttachmentArgs;
    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) {
            final var config = ctx.config();
            final var camPolicyBasic = config.get("camPolicyBasic").orElse("keep-cam-policy");
            final var camGroupBasic = config.get("camGroupBasic").orElse("keep-cam-group");
            final var groups = TencentcloudFunctions.getCamGroups(GetCamGroupsArgs.builder()
                .name(camGroupBasic)
                .build());
    
            final var policy = TencentcloudFunctions.getCamPolicies(GetCamPoliciesArgs.builder()
                .name(camPolicyBasic)
                .build());
    
            var groupPolicyAttachmentBasic = new CamGroupPolicyAttachment("groupPolicyAttachmentBasic", CamGroupPolicyAttachmentArgs.builder()
                .groupId(groups.applyValue(getCamGroupsResult -> getCamGroupsResult.groupLists()[0].groupId()))
                .policyId(policy.applyValue(getCamPoliciesResult -> getCamPoliciesResult.policyLists()[0].policyId()))
                .build());
    
        }
    }
    
    configuration:
      camPolicyBasic:
        type: string
        default: keep-cam-policy
      camGroupBasic:
        type: string
        default: keep-cam-group
    resources:
      groupPolicyAttachmentBasic:
        type: tencentcloud:CamGroupPolicyAttachment
        properties:
          groupId: ${groups.groupLists[0].groupId}
          policyId: ${policy.policyLists[0].policyId}
    variables:
      groups:
        fn::invoke:
          function: tencentcloud:getCamGroups
          arguments:
            name: ${camGroupBasic}
      policy:
        fn::invoke:
          function: tencentcloud:getCamPolicies
          arguments:
            name: ${camPolicyBasic}
    

    Create CamGroupPolicyAttachment Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new CamGroupPolicyAttachment(name: string, args: CamGroupPolicyAttachmentArgs, opts?: CustomResourceOptions);
    @overload
    def CamGroupPolicyAttachment(resource_name: str,
                                 args: CamGroupPolicyAttachmentArgs,
                                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def CamGroupPolicyAttachment(resource_name: str,
                                 opts: Optional[ResourceOptions] = None,
                                 group_id: Optional[str] = None,
                                 policy_id: Optional[str] = None,
                                 cam_group_policy_attachment_id: Optional[str] = None)
    func NewCamGroupPolicyAttachment(ctx *Context, name string, args CamGroupPolicyAttachmentArgs, opts ...ResourceOption) (*CamGroupPolicyAttachment, error)
    public CamGroupPolicyAttachment(string name, CamGroupPolicyAttachmentArgs args, CustomResourceOptions? opts = null)
    public CamGroupPolicyAttachment(String name, CamGroupPolicyAttachmentArgs args)
    public CamGroupPolicyAttachment(String name, CamGroupPolicyAttachmentArgs args, CustomResourceOptions options)
    
    type: tencentcloud:CamGroupPolicyAttachment
    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 CamGroupPolicyAttachmentArgs
    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 CamGroupPolicyAttachmentArgs
    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 CamGroupPolicyAttachmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CamGroupPolicyAttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CamGroupPolicyAttachmentArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    CamGroupPolicyAttachment 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 CamGroupPolicyAttachment resource accepts the following input properties:

    GroupId string
    ID of the attached CAM group.
    PolicyId string
    ID of the policy.
    CamGroupPolicyAttachmentId string
    ID of the resource.
    GroupId string
    ID of the attached CAM group.
    PolicyId string
    ID of the policy.
    CamGroupPolicyAttachmentId string
    ID of the resource.
    groupId String
    ID of the attached CAM group.
    policyId String
    ID of the policy.
    camGroupPolicyAttachmentId String
    ID of the resource.
    groupId string
    ID of the attached CAM group.
    policyId string
    ID of the policy.
    camGroupPolicyAttachmentId string
    ID of the resource.
    group_id str
    ID of the attached CAM group.
    policy_id str
    ID of the policy.
    cam_group_policy_attachment_id str
    ID of the resource.
    groupId String
    ID of the attached CAM group.
    policyId String
    ID of the policy.
    camGroupPolicyAttachmentId String
    ID of the resource.

    Outputs

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

    CreateMode double
    Mode of Creation of the CAM group policy attachment. 1 means the cam policy attachment is created by production, and the others indicate syntax strategy ways.
    CreateTime string
    Create time of the CAM group policy attachment.
    Id string
    The provider-assigned unique ID for this managed resource.
    PolicyName string
    Name of the policy.
    PolicyType string
    Type of the policy strategy. 'Group' means customer strategy and 'QCS' means preset strategy.
    CreateMode float64
    Mode of Creation of the CAM group policy attachment. 1 means the cam policy attachment is created by production, and the others indicate syntax strategy ways.
    CreateTime string
    Create time of the CAM group policy attachment.
    Id string
    The provider-assigned unique ID for this managed resource.
    PolicyName string
    Name of the policy.
    PolicyType string
    Type of the policy strategy. 'Group' means customer strategy and 'QCS' means preset strategy.
    createMode Double
    Mode of Creation of the CAM group policy attachment. 1 means the cam policy attachment is created by production, and the others indicate syntax strategy ways.
    createTime String
    Create time of the CAM group policy attachment.
    id String
    The provider-assigned unique ID for this managed resource.
    policyName String
    Name of the policy.
    policyType String
    Type of the policy strategy. 'Group' means customer strategy and 'QCS' means preset strategy.
    createMode number
    Mode of Creation of the CAM group policy attachment. 1 means the cam policy attachment is created by production, and the others indicate syntax strategy ways.
    createTime string
    Create time of the CAM group policy attachment.
    id string
    The provider-assigned unique ID for this managed resource.
    policyName string
    Name of the policy.
    policyType string
    Type of the policy strategy. 'Group' means customer strategy and 'QCS' means preset strategy.
    create_mode float
    Mode of Creation of the CAM group policy attachment. 1 means the cam policy attachment is created by production, and the others indicate syntax strategy ways.
    create_time str
    Create time of the CAM group policy attachment.
    id str
    The provider-assigned unique ID for this managed resource.
    policy_name str
    Name of the policy.
    policy_type str
    Type of the policy strategy. 'Group' means customer strategy and 'QCS' means preset strategy.
    createMode Number
    Mode of Creation of the CAM group policy attachment. 1 means the cam policy attachment is created by production, and the others indicate syntax strategy ways.
    createTime String
    Create time of the CAM group policy attachment.
    id String
    The provider-assigned unique ID for this managed resource.
    policyName String
    Name of the policy.
    policyType String
    Type of the policy strategy. 'Group' means customer strategy and 'QCS' means preset strategy.

    Look up Existing CamGroupPolicyAttachment Resource

    Get an existing CamGroupPolicyAttachment 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?: CamGroupPolicyAttachmentState, opts?: CustomResourceOptions): CamGroupPolicyAttachment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cam_group_policy_attachment_id: Optional[str] = None,
            create_mode: Optional[float] = None,
            create_time: Optional[str] = None,
            group_id: Optional[str] = None,
            policy_id: Optional[str] = None,
            policy_name: Optional[str] = None,
            policy_type: Optional[str] = None) -> CamGroupPolicyAttachment
    func GetCamGroupPolicyAttachment(ctx *Context, name string, id IDInput, state *CamGroupPolicyAttachmentState, opts ...ResourceOption) (*CamGroupPolicyAttachment, error)
    public static CamGroupPolicyAttachment Get(string name, Input<string> id, CamGroupPolicyAttachmentState? state, CustomResourceOptions? opts = null)
    public static CamGroupPolicyAttachment get(String name, Output<String> id, CamGroupPolicyAttachmentState state, CustomResourceOptions options)
    resources:  _:    type: tencentcloud:CamGroupPolicyAttachment    get:      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:
    CamGroupPolicyAttachmentId string
    ID of the resource.
    CreateMode double
    Mode of Creation of the CAM group policy attachment. 1 means the cam policy attachment is created by production, and the others indicate syntax strategy ways.
    CreateTime string
    Create time of the CAM group policy attachment.
    GroupId string
    ID of the attached CAM group.
    PolicyId string
    ID of the policy.
    PolicyName string
    Name of the policy.
    PolicyType string
    Type of the policy strategy. 'Group' means customer strategy and 'QCS' means preset strategy.
    CamGroupPolicyAttachmentId string
    ID of the resource.
    CreateMode float64
    Mode of Creation of the CAM group policy attachment. 1 means the cam policy attachment is created by production, and the others indicate syntax strategy ways.
    CreateTime string
    Create time of the CAM group policy attachment.
    GroupId string
    ID of the attached CAM group.
    PolicyId string
    ID of the policy.
    PolicyName string
    Name of the policy.
    PolicyType string
    Type of the policy strategy. 'Group' means customer strategy and 'QCS' means preset strategy.
    camGroupPolicyAttachmentId String
    ID of the resource.
    createMode Double
    Mode of Creation of the CAM group policy attachment. 1 means the cam policy attachment is created by production, and the others indicate syntax strategy ways.
    createTime String
    Create time of the CAM group policy attachment.
    groupId String
    ID of the attached CAM group.
    policyId String
    ID of the policy.
    policyName String
    Name of the policy.
    policyType String
    Type of the policy strategy. 'Group' means customer strategy and 'QCS' means preset strategy.
    camGroupPolicyAttachmentId string
    ID of the resource.
    createMode number
    Mode of Creation of the CAM group policy attachment. 1 means the cam policy attachment is created by production, and the others indicate syntax strategy ways.
    createTime string
    Create time of the CAM group policy attachment.
    groupId string
    ID of the attached CAM group.
    policyId string
    ID of the policy.
    policyName string
    Name of the policy.
    policyType string
    Type of the policy strategy. 'Group' means customer strategy and 'QCS' means preset strategy.
    cam_group_policy_attachment_id str
    ID of the resource.
    create_mode float
    Mode of Creation of the CAM group policy attachment. 1 means the cam policy attachment is created by production, and the others indicate syntax strategy ways.
    create_time str
    Create time of the CAM group policy attachment.
    group_id str
    ID of the attached CAM group.
    policy_id str
    ID of the policy.
    policy_name str
    Name of the policy.
    policy_type str
    Type of the policy strategy. 'Group' means customer strategy and 'QCS' means preset strategy.
    camGroupPolicyAttachmentId String
    ID of the resource.
    createMode Number
    Mode of Creation of the CAM group policy attachment. 1 means the cam policy attachment is created by production, and the others indicate syntax strategy ways.
    createTime String
    Create time of the CAM group policy attachment.
    groupId String
    ID of the attached CAM group.
    policyId String
    ID of the policy.
    policyName String
    Name of the policy.
    policyType String
    Type of the policy strategy. 'Group' means customer strategy and 'QCS' means preset strategy.

    Import

    CAM group policy attachment can be imported using the id, e.g.

    $ pulumi import tencentcloud:index/camGroupPolicyAttachment:CamGroupPolicyAttachment foo 12515263#26800353
    

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

    Package Details

    Repository
    tencentcloud tencentcloudstack/terraform-provider-tencentcloud
    License
    Notes
    This Pulumi package is based on the tencentcloud Terraform Provider.
    tencentcloud logo
    tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack