tencentcloud.CamRolePolicyAttachmentByName
Explore with Pulumi AI
Provides a resource to create a CAM role 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 camRoleBasic = config.get("camRoleBasic") || "keep-cam-role";
const policy = tencentcloud.getCamPolicies({
name: camPolicyBasic,
});
const roles = tencentcloud.getCamRoles({
name: camRoleBasic,
});
const rolePolicyAttachmentBasic = new tencentcloud.CamRolePolicyAttachmentByName("rolePolicyAttachmentBasic", {
roleName: camRoleBasic,
policyName: camPolicyBasic,
});
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_role_basic = config.get("camRoleBasic")
if cam_role_basic is None:
cam_role_basic = "keep-cam-role"
policy = tencentcloud.get_cam_policies(name=cam_policy_basic)
roles = tencentcloud.get_cam_roles(name=cam_role_basic)
role_policy_attachment_basic = tencentcloud.CamRolePolicyAttachmentByName("rolePolicyAttachmentBasic",
role_name=cam_role_basic,
policy_name=cam_policy_basic)
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
}
camRoleBasic := "keep-cam-role"
if param := cfg.Get("camRoleBasic"); param != "" {
camRoleBasic = param
}
_, err := tencentcloud.GetCamPolicies(ctx, &tencentcloud.GetCamPoliciesArgs{
Name: pulumi.StringRef(camPolicyBasic),
}, nil)
if err != nil {
return err
}
_, err = tencentcloud.GetCamRoles(ctx, &tencentcloud.GetCamRolesArgs{
Name: pulumi.StringRef(camRoleBasic),
}, nil)
if err != nil {
return err
}
_, err = tencentcloud.NewCamRolePolicyAttachmentByName(ctx, "rolePolicyAttachmentBasic", &tencentcloud.CamRolePolicyAttachmentByNameArgs{
RoleName: pulumi.String(camRoleBasic),
PolicyName: pulumi.String(camPolicyBasic),
})
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 camRoleBasic = config.Get("camRoleBasic") ?? "keep-cam-role";
var policy = Tencentcloud.GetCamPolicies.Invoke(new()
{
Name = camPolicyBasic,
});
var roles = Tencentcloud.GetCamRoles.Invoke(new()
{
Name = camRoleBasic,
});
var rolePolicyAttachmentBasic = new Tencentcloud.CamRolePolicyAttachmentByName("rolePolicyAttachmentBasic", new()
{
RoleName = camRoleBasic,
PolicyName = camPolicyBasic,
});
});
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.GetCamPoliciesArgs;
import com.pulumi.tencentcloud.inputs.GetCamRolesArgs;
import com.pulumi.tencentcloud.CamRolePolicyAttachmentByName;
import com.pulumi.tencentcloud.CamRolePolicyAttachmentByNameArgs;
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 camRoleBasic = config.get("camRoleBasic").orElse("keep-cam-role");
final var policy = TencentcloudFunctions.getCamPolicies(GetCamPoliciesArgs.builder()
.name(camPolicyBasic)
.build());
final var roles = TencentcloudFunctions.getCamRoles(GetCamRolesArgs.builder()
.name(camRoleBasic)
.build());
var rolePolicyAttachmentBasic = new CamRolePolicyAttachmentByName("rolePolicyAttachmentBasic", CamRolePolicyAttachmentByNameArgs.builder()
.roleName(camRoleBasic)
.policyName(camPolicyBasic)
.build());
}
}
configuration:
camPolicyBasic:
type: string
default: keep-cam-policy
camRoleBasic:
type: string
default: keep-cam-role
resources:
rolePolicyAttachmentBasic:
type: tencentcloud:CamRolePolicyAttachmentByName
properties:
roleName: ${camRoleBasic}
policyName: ${camPolicyBasic}
variables:
policy:
fn::invoke:
function: tencentcloud:getCamPolicies
arguments:
name: ${camPolicyBasic}
roles:
fn::invoke:
function: tencentcloud:getCamRoles
arguments:
name: ${camRoleBasic}
Create CamRolePolicyAttachmentByName Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new CamRolePolicyAttachmentByName(name: string, args: CamRolePolicyAttachmentByNameArgs, opts?: CustomResourceOptions);
@overload
def CamRolePolicyAttachmentByName(resource_name: str,
args: CamRolePolicyAttachmentByNameArgs,
opts: Optional[ResourceOptions] = None)
@overload
def CamRolePolicyAttachmentByName(resource_name: str,
opts: Optional[ResourceOptions] = None,
policy_name: Optional[str] = None,
role_name: Optional[str] = None,
cam_role_policy_attachment_by_name_id: Optional[str] = None)
func NewCamRolePolicyAttachmentByName(ctx *Context, name string, args CamRolePolicyAttachmentByNameArgs, opts ...ResourceOption) (*CamRolePolicyAttachmentByName, error)
public CamRolePolicyAttachmentByName(string name, CamRolePolicyAttachmentByNameArgs args, CustomResourceOptions? opts = null)
public CamRolePolicyAttachmentByName(String name, CamRolePolicyAttachmentByNameArgs args)
public CamRolePolicyAttachmentByName(String name, CamRolePolicyAttachmentByNameArgs args, CustomResourceOptions options)
type: tencentcloud:CamRolePolicyAttachmentByName
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 CamRolePolicyAttachmentByNameArgs
- 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 CamRolePolicyAttachmentByNameArgs
- 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 CamRolePolicyAttachmentByNameArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args CamRolePolicyAttachmentByNameArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args CamRolePolicyAttachmentByNameArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
CamRolePolicyAttachmentByName 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 CamRolePolicyAttachmentByName resource accepts the following input properties:
- Policy
Name string - Name of the policy.
- Role
Name string - Name of the attached CAM role.
- Cam
Role stringPolicy Attachment By Name Id - ID of the resource.
- Policy
Name string - Name of the policy.
- Role
Name string - Name of the attached CAM role.
- Cam
Role stringPolicy Attachment By Name Id - ID of the resource.
- policy
Name String - Name of the policy.
- role
Name String - Name of the attached CAM role.
- cam
Role StringPolicy Attachment By Name Id - ID of the resource.
- policy
Name string - Name of the policy.
- role
Name string - Name of the attached CAM role.
- cam
Role stringPolicy Attachment By Name Id - ID of the resource.
- policy_
name str - Name of the policy.
- role_
name str - Name of the attached CAM role.
- cam_
role_ strpolicy_ attachment_ by_ name_ id - ID of the resource.
- policy
Name String - Name of the policy.
- role
Name String - Name of the attached CAM role.
- cam
Role StringPolicy Attachment By Name Id - ID of the resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the CamRolePolicyAttachmentByName resource produces the following output properties:
- Create
Mode double - Mode of Creation of the CAM role policy attachment.
1
means the CAM policy attachment is created by production, and the others indicate syntax strategy ways. - Create
Time string - The create time of the CAM role policy attachment.
- Id string
- The provider-assigned unique ID for this managed resource.
- Policy
Type string - Type of the policy strategy.
User
means customer strategy andQCS
means preset strategy.
- Create
Mode float64 - Mode of Creation of the CAM role policy attachment.
1
means the CAM policy attachment is created by production, and the others indicate syntax strategy ways. - Create
Time string - The create time of the CAM role policy attachment.
- Id string
- The provider-assigned unique ID for this managed resource.
- Policy
Type string - Type of the policy strategy.
User
means customer strategy andQCS
means preset strategy.
- create
Mode Double - Mode of Creation of the CAM role policy attachment.
1
means the CAM policy attachment is created by production, and the others indicate syntax strategy ways. - create
Time String - The create time of the CAM role policy attachment.
- id String
- The provider-assigned unique ID for this managed resource.
- policy
Type String - Type of the policy strategy.
User
means customer strategy andQCS
means preset strategy.
- create
Mode number - Mode of Creation of the CAM role policy attachment.
1
means the CAM policy attachment is created by production, and the others indicate syntax strategy ways. - create
Time string - The create time of the CAM role policy attachment.
- id string
- The provider-assigned unique ID for this managed resource.
- policy
Type string - Type of the policy strategy.
User
means customer strategy andQCS
means preset strategy.
- create_
mode float - Mode of Creation of the CAM role policy attachment.
1
means the CAM policy attachment is created by production, and the others indicate syntax strategy ways. - create_
time str - The create time of the CAM role policy attachment.
- id str
- The provider-assigned unique ID for this managed resource.
- policy_
type str - Type of the policy strategy.
User
means customer strategy andQCS
means preset strategy.
- create
Mode Number - Mode of Creation of the CAM role policy attachment.
1
means the CAM policy attachment is created by production, and the others indicate syntax strategy ways. - create
Time String - The create time of the CAM role policy attachment.
- id String
- The provider-assigned unique ID for this managed resource.
- policy
Type String - Type of the policy strategy.
User
means customer strategy andQCS
means preset strategy.
Look up Existing CamRolePolicyAttachmentByName Resource
Get an existing CamRolePolicyAttachmentByName 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?: CamRolePolicyAttachmentByNameState, opts?: CustomResourceOptions): CamRolePolicyAttachmentByName
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
cam_role_policy_attachment_by_name_id: Optional[str] = None,
create_mode: Optional[float] = None,
create_time: Optional[str] = None,
policy_name: Optional[str] = None,
policy_type: Optional[str] = None,
role_name: Optional[str] = None) -> CamRolePolicyAttachmentByName
func GetCamRolePolicyAttachmentByName(ctx *Context, name string, id IDInput, state *CamRolePolicyAttachmentByNameState, opts ...ResourceOption) (*CamRolePolicyAttachmentByName, error)
public static CamRolePolicyAttachmentByName Get(string name, Input<string> id, CamRolePolicyAttachmentByNameState? state, CustomResourceOptions? opts = null)
public static CamRolePolicyAttachmentByName get(String name, Output<String> id, CamRolePolicyAttachmentByNameState state, CustomResourceOptions options)
resources: _: type: tencentcloud:CamRolePolicyAttachmentByName 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
Role stringPolicy Attachment By Name Id - ID of the resource.
- Create
Mode double - Mode of Creation of the CAM role policy attachment.
1
means the CAM policy attachment is created by production, and the others indicate syntax strategy ways. - Create
Time string - The create time of the CAM role policy attachment.
- Policy
Name string - Name of the policy.
- Policy
Type string - Type of the policy strategy.
User
means customer strategy andQCS
means preset strategy. - Role
Name string - Name of the attached CAM role.
- Cam
Role stringPolicy Attachment By Name Id - ID of the resource.
- Create
Mode float64 - Mode of Creation of the CAM role policy attachment.
1
means the CAM policy attachment is created by production, and the others indicate syntax strategy ways. - Create
Time string - The create time of the CAM role policy attachment.
- Policy
Name string - Name of the policy.
- Policy
Type string - Type of the policy strategy.
User
means customer strategy andQCS
means preset strategy. - Role
Name string - Name of the attached CAM role.
- cam
Role StringPolicy Attachment By Name Id - ID of the resource.
- create
Mode Double - Mode of Creation of the CAM role policy attachment.
1
means the CAM policy attachment is created by production, and the others indicate syntax strategy ways. - create
Time String - The create time of the CAM role policy attachment.
- policy
Name String - Name of the policy.
- policy
Type String - Type of the policy strategy.
User
means customer strategy andQCS
means preset strategy. - role
Name String - Name of the attached CAM role.
- cam
Role stringPolicy Attachment By Name Id - ID of the resource.
- create
Mode number - Mode of Creation of the CAM role policy attachment.
1
means the CAM policy attachment is created by production, and the others indicate syntax strategy ways. - create
Time string - The create time of the CAM role policy attachment.
- policy
Name string - Name of the policy.
- policy
Type string - Type of the policy strategy.
User
means customer strategy andQCS
means preset strategy. - role
Name string - Name of the attached CAM role.
- cam_
role_ strpolicy_ attachment_ by_ name_ id - ID of the resource.
- create_
mode float - Mode of Creation of the CAM role policy attachment.
1
means the CAM policy attachment is created by production, and the others indicate syntax strategy ways. - create_
time str - The create time of the CAM role policy attachment.
- policy_
name str - Name of the policy.
- policy_
type str - Type of the policy strategy.
User
means customer strategy andQCS
means preset strategy. - role_
name str - Name of the attached CAM role.
- cam
Role StringPolicy Attachment By Name Id - ID of the resource.
- create
Mode Number - Mode of Creation of the CAM role policy attachment.
1
means the CAM policy attachment is created by production, and the others indicate syntax strategy ways. - create
Time String - The create time of the CAM role policy attachment.
- policy
Name String - Name of the policy.
- policy
Type String - Type of the policy strategy.
User
means customer strategy andQCS
means preset strategy. - role
Name String - Name of the attached CAM role.
Import
CAM role policy attachment can be imported using the id, e.g.
$ pulumi import tencentcloud:index/camRolePolicyAttachmentByName:CamRolePolicyAttachmentByName foo ${role_name}#${policy_name}
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.