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

tencentcloud.CamPolicyVersion

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 policy version

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const example = new tencentcloud.CamPolicyVersion("example", {
        policyId: 171173780,
        setAsDefault: false,
        policyDocument: JSON.stringify({
            version: "3.0",
            statement: [
                {
                    effect: "allow",
                    action: ["sts:AssumeRole"],
                    resource: ["*"],
                },
                {
                    effect: "allow",
                    action: ["cos:PutObject"],
                    resource: ["*"],
                },
                {
                    effect: "deny",
                    action: ["aa:*"],
                    resource: ["*"],
                },
                {
                    effect: "deny",
                    action: ["aa:*"],
                    resource: ["*"],
                },
            ],
        }),
    });
    
    import pulumi
    import json
    import pulumi_tencentcloud as tencentcloud
    
    example = tencentcloud.CamPolicyVersion("example",
        policy_id=171173780,
        set_as_default=False,
        policy_document=json.dumps({
            "version": "3.0",
            "statement": [
                {
                    "effect": "allow",
                    "action": ["sts:AssumeRole"],
                    "resource": ["*"],
                },
                {
                    "effect": "allow",
                    "action": ["cos:PutObject"],
                    "resource": ["*"],
                },
                {
                    "effect": "deny",
                    "action": ["aa:*"],
                    "resource": ["*"],
                },
                {
                    "effect": "deny",
                    "action": ["aa:*"],
                    "resource": ["*"],
                },
            ],
        }))
    
    package main
    
    import (
    	"encoding/json"
    
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		tmpJSON0, err := json.Marshal(map[string]interface{}{
    			"version": "3.0",
    			"statement": []map[string]interface{}{
    				map[string]interface{}{
    					"effect": "allow",
    					"action": []string{
    						"sts:AssumeRole",
    					},
    					"resource": []string{
    						"*",
    					},
    				},
    				map[string]interface{}{
    					"effect": "allow",
    					"action": []string{
    						"cos:PutObject",
    					},
    					"resource": []string{
    						"*",
    					},
    				},
    				map[string]interface{}{
    					"effect": "deny",
    					"action": []string{
    						"aa:*",
    					},
    					"resource": []string{
    						"*",
    					},
    				},
    				map[string]interface{}{
    					"effect": "deny",
    					"action": []string{
    						"aa:*",
    					},
    					"resource": []string{
    						"*",
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		json0 := string(tmpJSON0)
    		_, err = tencentcloud.NewCamPolicyVersion(ctx, "example", &tencentcloud.CamPolicyVersionArgs{
    			PolicyId:       pulumi.Float64(171173780),
    			SetAsDefault:   pulumi.Bool(false),
    			PolicyDocument: pulumi.String(json0),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using Tencentcloud = Pulumi.Tencentcloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Tencentcloud.CamPolicyVersion("example", new()
        {
            PolicyId = 171173780,
            SetAsDefault = false,
            PolicyDocument = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["version"] = "3.0",
                ["statement"] = new[]
                {
                    new Dictionary<string, object?>
                    {
                        ["effect"] = "allow",
                        ["action"] = new[]
                        {
                            "sts:AssumeRole",
                        },
                        ["resource"] = new[]
                        {
                            "*",
                        },
                    },
                    new Dictionary<string, object?>
                    {
                        ["effect"] = "allow",
                        ["action"] = new[]
                        {
                            "cos:PutObject",
                        },
                        ["resource"] = new[]
                        {
                            "*",
                        },
                    },
                    new Dictionary<string, object?>
                    {
                        ["effect"] = "deny",
                        ["action"] = new[]
                        {
                            "aa:*",
                        },
                        ["resource"] = new[]
                        {
                            "*",
                        },
                    },
                    new Dictionary<string, object?>
                    {
                        ["effect"] = "deny",
                        ["action"] = new[]
                        {
                            "aa:*",
                        },
                        ["resource"] = new[]
                        {
                            "*",
                        },
                    },
                },
            }),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.CamPolicyVersion;
    import com.pulumi.tencentcloud.CamPolicyVersionArgs;
    import static com.pulumi.codegen.internal.Serialization.*;
    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 example = new CamPolicyVersion("example", CamPolicyVersionArgs.builder()
                .policyId(171173780)
                .setAsDefault("false")
                .policyDocument(serializeJson(
                    jsonObject(
                        jsonProperty("version", "3.0"),
                        jsonProperty("statement", jsonArray(
                            jsonObject(
                                jsonProperty("effect", "allow"),
                                jsonProperty("action", jsonArray("sts:AssumeRole")),
                                jsonProperty("resource", jsonArray("*"))
                            ), 
                            jsonObject(
                                jsonProperty("effect", "allow"),
                                jsonProperty("action", jsonArray("cos:PutObject")),
                                jsonProperty("resource", jsonArray("*"))
                            ), 
                            jsonObject(
                                jsonProperty("effect", "deny"),
                                jsonProperty("action", jsonArray("aa:*")),
                                jsonProperty("resource", jsonArray("*"))
                            ), 
                            jsonObject(
                                jsonProperty("effect", "deny"),
                                jsonProperty("action", jsonArray("aa:*")),
                                jsonProperty("resource", jsonArray("*"))
                            )
                        ))
                    )))
                .build());
    
        }
    }
    
    resources:
      example:
        type: tencentcloud:CamPolicyVersion
        properties:
          policyId: 1.7117378e+08
          setAsDefault: 'false'
          policyDocument:
            fn::toJSON:
              version: '3.0'
              statement:
                - effect: allow
                  action:
                    - sts:AssumeRole
                  resource:
                    - '*'
                - effect: allow
                  action:
                    - cos:PutObject
                  resource:
                    - '*'
                - effect: deny
                  action:
                    - aa:*
                  resource:
                    - '*'
                - effect: deny
                  action:
                    - aa:*
                  resource:
                    - '*'
    

    Create CamPolicyVersion Resource

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

    Constructor syntax

    new CamPolicyVersion(name: string, args: CamPolicyVersionArgs, opts?: CustomResourceOptions);
    @overload
    def CamPolicyVersion(resource_name: str,
                         args: CamPolicyVersionArgs,
                         opts: Optional[ResourceOptions] = None)
    
    @overload
    def CamPolicyVersion(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         policy_document: Optional[str] = None,
                         policy_id: Optional[float] = None,
                         set_as_default: Optional[bool] = None,
                         cam_policy_version_id: Optional[str] = None,
                         policy_versions: Optional[Sequence[CamPolicyVersionPolicyVersionArgs]] = None)
    func NewCamPolicyVersion(ctx *Context, name string, args CamPolicyVersionArgs, opts ...ResourceOption) (*CamPolicyVersion, error)
    public CamPolicyVersion(string name, CamPolicyVersionArgs args, CustomResourceOptions? opts = null)
    public CamPolicyVersion(String name, CamPolicyVersionArgs args)
    public CamPolicyVersion(String name, CamPolicyVersionArgs args, CustomResourceOptions options)
    
    type: tencentcloud:CamPolicyVersion
    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 CamPolicyVersionArgs
    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 CamPolicyVersionArgs
    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 CamPolicyVersionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CamPolicyVersionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CamPolicyVersionArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    PolicyDocument string
    Strategic text information.
    PolicyId double
    Strategy ID.
    SetAsDefault bool
    Whether to set as a version of the current strategy.
    CamPolicyVersionId string
    ID of the resource.
    PolicyVersions List<CamPolicyVersionPolicyVersion>
    Strategic version detailsNote: This field may return NULL, indicating that the valid value cannot be obtained.
    PolicyDocument string
    Strategic text information.
    PolicyId float64
    Strategy ID.
    SetAsDefault bool
    Whether to set as a version of the current strategy.
    CamPolicyVersionId string
    ID of the resource.
    PolicyVersions []CamPolicyVersionPolicyVersionArgs
    Strategic version detailsNote: This field may return NULL, indicating that the valid value cannot be obtained.
    policyDocument String
    Strategic text information.
    policyId Double
    Strategy ID.
    setAsDefault Boolean
    Whether to set as a version of the current strategy.
    camPolicyVersionId String
    ID of the resource.
    policyVersions List<CamPolicyVersionPolicyVersion>
    Strategic version detailsNote: This field may return NULL, indicating that the valid value cannot be obtained.
    policyDocument string
    Strategic text information.
    policyId number
    Strategy ID.
    setAsDefault boolean
    Whether to set as a version of the current strategy.
    camPolicyVersionId string
    ID of the resource.
    policyVersions CamPolicyVersionPolicyVersion[]
    Strategic version detailsNote: This field may return NULL, indicating that the valid value cannot be obtained.
    policy_document str
    Strategic text information.
    policy_id float
    Strategy ID.
    set_as_default bool
    Whether to set as a version of the current strategy.
    cam_policy_version_id str
    ID of the resource.
    policy_versions Sequence[CamPolicyVersionPolicyVersionArgs]
    Strategic version detailsNote: This field may return NULL, indicating that the valid value cannot be obtained.
    policyDocument String
    Strategic text information.
    policyId Number
    Strategy ID.
    setAsDefault Boolean
    Whether to set as a version of the current strategy.
    camPolicyVersionId String
    ID of the resource.
    policyVersions List<Property Map>
    Strategic version detailsNote: This field may return NULL, indicating that the valid value cannot be obtained.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the CamPolicyVersion 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 CamPolicyVersion Resource

    Get an existing CamPolicyVersion 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?: CamPolicyVersionState, opts?: CustomResourceOptions): CamPolicyVersion
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cam_policy_version_id: Optional[str] = None,
            policy_document: Optional[str] = None,
            policy_id: Optional[float] = None,
            policy_versions: Optional[Sequence[CamPolicyVersionPolicyVersionArgs]] = None,
            set_as_default: Optional[bool] = None) -> CamPolicyVersion
    func GetCamPolicyVersion(ctx *Context, name string, id IDInput, state *CamPolicyVersionState, opts ...ResourceOption) (*CamPolicyVersion, error)
    public static CamPolicyVersion Get(string name, Input<string> id, CamPolicyVersionState? state, CustomResourceOptions? opts = null)
    public static CamPolicyVersion get(String name, Output<String> id, CamPolicyVersionState state, CustomResourceOptions options)
    resources:  _:    type: tencentcloud:CamPolicyVersion    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:
    CamPolicyVersionId string
    ID of the resource.
    PolicyDocument string
    Strategic text information.
    PolicyId double
    Strategy ID.
    PolicyVersions List<CamPolicyVersionPolicyVersion>
    Strategic version detailsNote: This field may return NULL, indicating that the valid value cannot be obtained.
    SetAsDefault bool
    Whether to set as a version of the current strategy.
    CamPolicyVersionId string
    ID of the resource.
    PolicyDocument string
    Strategic text information.
    PolicyId float64
    Strategy ID.
    PolicyVersions []CamPolicyVersionPolicyVersionArgs
    Strategic version detailsNote: This field may return NULL, indicating that the valid value cannot be obtained.
    SetAsDefault bool
    Whether to set as a version of the current strategy.
    camPolicyVersionId String
    ID of the resource.
    policyDocument String
    Strategic text information.
    policyId Double
    Strategy ID.
    policyVersions List<CamPolicyVersionPolicyVersion>
    Strategic version detailsNote: This field may return NULL, indicating that the valid value cannot be obtained.
    setAsDefault Boolean
    Whether to set as a version of the current strategy.
    camPolicyVersionId string
    ID of the resource.
    policyDocument string
    Strategic text information.
    policyId number
    Strategy ID.
    policyVersions CamPolicyVersionPolicyVersion[]
    Strategic version detailsNote: This field may return NULL, indicating that the valid value cannot be obtained.
    setAsDefault boolean
    Whether to set as a version of the current strategy.
    cam_policy_version_id str
    ID of the resource.
    policy_document str
    Strategic text information.
    policy_id float
    Strategy ID.
    policy_versions Sequence[CamPolicyVersionPolicyVersionArgs]
    Strategic version detailsNote: This field may return NULL, indicating that the valid value cannot be obtained.
    set_as_default bool
    Whether to set as a version of the current strategy.
    camPolicyVersionId String
    ID of the resource.
    policyDocument String
    Strategic text information.
    policyId Number
    Strategy ID.
    policyVersions List<Property Map>
    Strategic version detailsNote: This field may return NULL, indicating that the valid value cannot be obtained.
    setAsDefault Boolean
    Whether to set as a version of the current strategy.

    Supporting Types

    CamPolicyVersionPolicyVersion, CamPolicyVersionPolicyVersionArgs

    CreateDate string
    Strategic version creation timeNote: This field may return NULL, indicating that the valid value cannot be obtained.
    Document string
    Strategic grammar textNote: This field may return NULL, indicating that the valid value cannot be obtained.
    IsDefaultVersion double
    Whether it is an effective version.0 means not, 1 means yesNote: This field may return NULL, indicating that the valid value cannot be obtained.
    VersionId double
    Strategic version numberNote: This field may return NULL, indicating that the valid value cannot be obtained.
    CreateDate string
    Strategic version creation timeNote: This field may return NULL, indicating that the valid value cannot be obtained.
    Document string
    Strategic grammar textNote: This field may return NULL, indicating that the valid value cannot be obtained.
    IsDefaultVersion float64
    Whether it is an effective version.0 means not, 1 means yesNote: This field may return NULL, indicating that the valid value cannot be obtained.
    VersionId float64
    Strategic version numberNote: This field may return NULL, indicating that the valid value cannot be obtained.
    createDate String
    Strategic version creation timeNote: This field may return NULL, indicating that the valid value cannot be obtained.
    document String
    Strategic grammar textNote: This field may return NULL, indicating that the valid value cannot be obtained.
    isDefaultVersion Double
    Whether it is an effective version.0 means not, 1 means yesNote: This field may return NULL, indicating that the valid value cannot be obtained.
    versionId Double
    Strategic version numberNote: This field may return NULL, indicating that the valid value cannot be obtained.
    createDate string
    Strategic version creation timeNote: This field may return NULL, indicating that the valid value cannot be obtained.
    document string
    Strategic grammar textNote: This field may return NULL, indicating that the valid value cannot be obtained.
    isDefaultVersion number
    Whether it is an effective version.0 means not, 1 means yesNote: This field may return NULL, indicating that the valid value cannot be obtained.
    versionId number
    Strategic version numberNote: This field may return NULL, indicating that the valid value cannot be obtained.
    create_date str
    Strategic version creation timeNote: This field may return NULL, indicating that the valid value cannot be obtained.
    document str
    Strategic grammar textNote: This field may return NULL, indicating that the valid value cannot be obtained.
    is_default_version float
    Whether it is an effective version.0 means not, 1 means yesNote: This field may return NULL, indicating that the valid value cannot be obtained.
    version_id float
    Strategic version numberNote: This field may return NULL, indicating that the valid value cannot be obtained.
    createDate String
    Strategic version creation timeNote: This field may return NULL, indicating that the valid value cannot be obtained.
    document String
    Strategic grammar textNote: This field may return NULL, indicating that the valid value cannot be obtained.
    isDefaultVersion Number
    Whether it is an effective version.0 means not, 1 means yesNote: This field may return NULL, indicating that the valid value cannot be obtained.
    versionId Number
    Strategic version numberNote: This field may return NULL, indicating that the valid value cannot be obtained.

    Import

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

    $ pulumi import tencentcloud:index/camPolicyVersion:CamPolicyVersion example 234290251#3
    

    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