tencentcloud.CamPolicyVersion
Explore with Pulumi AI
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:
- Policy
Document string - Strategic text information.
- Policy
Id double - Strategy ID.
- Set
As boolDefault - Whether to set as a version of the current strategy.
- Cam
Policy stringVersion Id - ID of the resource.
- Policy
Versions List<CamPolicy Version Policy Version> - Strategic version detailsNote: This field may return NULL, indicating that the valid value cannot be obtained.
- Policy
Document string - Strategic text information.
- Policy
Id float64 - Strategy ID.
- Set
As boolDefault - Whether to set as a version of the current strategy.
- Cam
Policy stringVersion Id - ID of the resource.
- Policy
Versions []CamPolicy Version Policy Version Args - Strategic version detailsNote: This field may return NULL, indicating that the valid value cannot be obtained.
- policy
Document String - Strategic text information.
- policy
Id Double - Strategy ID.
- set
As BooleanDefault - Whether to set as a version of the current strategy.
- cam
Policy StringVersion Id - ID of the resource.
- policy
Versions List<CamPolicy Version Policy Version> - Strategic version detailsNote: This field may return NULL, indicating that the valid value cannot be obtained.
- policy
Document string - Strategic text information.
- policy
Id number - Strategy ID.
- set
As booleanDefault - Whether to set as a version of the current strategy.
- cam
Policy stringVersion Id - ID of the resource.
- policy
Versions CamPolicy Version Policy Version[] - 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_ booldefault - Whether to set as a version of the current strategy.
- cam_
policy_ strversion_ id - ID of the resource.
- policy_
versions Sequence[CamPolicy Version Policy Version Args] - Strategic version detailsNote: This field may return NULL, indicating that the valid value cannot be obtained.
- policy
Document String - Strategic text information.
- policy
Id Number - Strategy ID.
- set
As BooleanDefault - Whether to set as a version of the current strategy.
- cam
Policy StringVersion Id - ID of the resource.
- policy
Versions 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.
- Cam
Policy stringVersion Id - ID of the resource.
- Policy
Document string - Strategic text information.
- Policy
Id double - Strategy ID.
- Policy
Versions List<CamPolicy Version Policy Version> - Strategic version detailsNote: This field may return NULL, indicating that the valid value cannot be obtained.
- Set
As boolDefault - Whether to set as a version of the current strategy.
- Cam
Policy stringVersion Id - ID of the resource.
- Policy
Document string - Strategic text information.
- Policy
Id float64 - Strategy ID.
- Policy
Versions []CamPolicy Version Policy Version Args - Strategic version detailsNote: This field may return NULL, indicating that the valid value cannot be obtained.
- Set
As boolDefault - Whether to set as a version of the current strategy.
- cam
Policy StringVersion Id - ID of the resource.
- policy
Document String - Strategic text information.
- policy
Id Double - Strategy ID.
- policy
Versions List<CamPolicy Version Policy Version> - Strategic version detailsNote: This field may return NULL, indicating that the valid value cannot be obtained.
- set
As BooleanDefault - Whether to set as a version of the current strategy.
- cam
Policy stringVersion Id - ID of the resource.
- policy
Document string - Strategic text information.
- policy
Id number - Strategy ID.
- policy
Versions CamPolicy Version Policy Version[] - Strategic version detailsNote: This field may return NULL, indicating that the valid value cannot be obtained.
- set
As booleanDefault - Whether to set as a version of the current strategy.
- cam_
policy_ strversion_ id - ID of the resource.
- policy_
document str - Strategic text information.
- policy_
id float - Strategy ID.
- policy_
versions Sequence[CamPolicy Version Policy Version Args] - Strategic version detailsNote: This field may return NULL, indicating that the valid value cannot be obtained.
- set_
as_ booldefault - Whether to set as a version of the current strategy.
- cam
Policy StringVersion Id - ID of the resource.
- policy
Document String - Strategic text information.
- policy
Id Number - Strategy ID.
- policy
Versions List<Property Map> - Strategic version detailsNote: This field may return NULL, indicating that the valid value cannot be obtained.
- set
As BooleanDefault - Whether to set as a version of the current strategy.
Supporting Types
CamPolicyVersionPolicyVersion, CamPolicyVersionPolicyVersionArgs
- Create
Date 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.
- Is
Default doubleVersion - 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 double - Strategic version numberNote: This field may return NULL, indicating that the valid value cannot be obtained.
- Create
Date 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.
- Is
Default float64Version - 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 float64 - Strategic version numberNote: This field may return NULL, indicating that the valid value cannot be obtained.
- create
Date 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.
- is
Default DoubleVersion - 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 Double - Strategic version numberNote: This field may return NULL, indicating that the valid value cannot be obtained.
- create
Date 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.
- is
Default numberVersion - 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 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_ floatversion - 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.
- create
Date 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.
- is
Default NumberVersion - 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 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.