RolePolicyAttachment
Provides a RAM Role attachment resource.
Example Usage
using Pulumi;
using AliCloud = Pulumi.AliCloud;
class MyStack : Stack
{
public MyStack()
{
// Create a RAM Role Policy attachment.
var role = new AliCloud.Ram.Role("role", new AliCloud.Ram.RoleArgs
{
Description = "this is a role test.",
Document = @" {
""Statement"": [
{
""Action"": ""sts:AssumeRole"",
""Effect"": ""Allow"",
""Principal"": {
""Service"": [
""apigateway.aliyuncs.com"",
""ecs.aliyuncs.com""
]
}
}
],
""Version"": ""1""
}
",
Force = true,
});
var policy = new AliCloud.Ram.Policy("policy", new AliCloud.Ram.PolicyArgs
{
Description = "this is a policy test",
Document = @" {
""Statement"": [
{
""Action"": [
""oss:ListObjects"",
""oss:GetObject""
],
""Effect"": ""Allow"",
""Resource"": [
""acs:oss:*:*:mybucket"",
""acs:oss:*:*:mybucket/*""
]
}
],
""Version"": ""1""
}
",
Force = true,
});
var attach = new AliCloud.Ram.RolePolicyAttachment("attach", new AliCloud.Ram.RolePolicyAttachmentArgs
{
PolicyName = policy.Name,
PolicyType = policy.Type,
RoleName = role.Name,
});
}
}
Coming soon!
import pulumi
import pulumi_alicloud as alicloud
# Create a RAM Role Policy attachment.
role = alicloud.ram.Role("role",
description="this is a role test.",
document=""" {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"apigateway.aliyuncs.com",
"ecs.aliyuncs.com"
]
}
}
],
"Version": "1"
}
""",
force=True)
policy = alicloud.ram.Policy("policy",
description="this is a policy test",
document=""" {
"Statement": [
{
"Action": [
"oss:ListObjects",
"oss:GetObject"
],
"Effect": "Allow",
"Resource": [
"acs:oss:*:*:mybucket",
"acs:oss:*:*:mybucket/*"
]
}
],
"Version": "1"
}
""",
force=True)
attach = alicloud.ram.RolePolicyAttachment("attach",
policy_name=policy.name,
policy_type=policy.type,
role_name=role.name)import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
// Create a RAM Role Policy attachment.
const role = new alicloud.ram.Role("role", {
description: "this is a role test.",
document: ` {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": [
"apigateway.aliyuncs.com",
"ecs.aliyuncs.com"
]
}
}
],
"Version": "1"
}
`,
force: true,
});
const policy = new alicloud.ram.Policy("policy", {
description: "this is a policy test",
document: ` {
"Statement": [
{
"Action": [
"oss:ListObjects",
"oss:GetObject"
],
"Effect": "Allow",
"Resource": [
"acs:oss:*:*:mybucket",
"acs:oss:*:*:mybucket/*"
]
}
],
"Version": "1"
}
`,
force: true,
});
const attach = new alicloud.ram.RolePolicyAttachment("attach", {
policyName: policy.name,
policyType: policy.type,
roleName: role.name,
});Create a RolePolicyAttachment Resource
new RolePolicyAttachment(name: string, args: RolePolicyAttachmentArgs, opts?: CustomResourceOptions);def RolePolicyAttachment(resource_name, opts=None, policy_name=None, policy_type=None, role_name=None, __props__=None);func NewRolePolicyAttachment(ctx *Context, name string, args RolePolicyAttachmentArgs, opts ...ResourceOption) (*RolePolicyAttachment, error)public RolePolicyAttachment(string name, RolePolicyAttachmentArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args RolePolicyAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args RolePolicyAttachmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RolePolicyAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
RolePolicyAttachment Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The RolePolicyAttachment resource accepts the following input properties:
- Policy
Name string Name of the RAM policy. This name can have a string of 1 to 128 characters, must contain only alphanumeric characters or hyphen “-”, and must not begin with a hyphen.
- Policy
Type string Type of the RAM policy. It must be
CustomorSystem.- Role
Name string Name of the RAM Role. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphens, such as “-”, “_“, and must not begin with a hyphen.
- Policy
Name string Name of the RAM policy. This name can have a string of 1 to 128 characters, must contain only alphanumeric characters or hyphen “-”, and must not begin with a hyphen.
- Policy
Type string Type of the RAM policy. It must be
CustomorSystem.- Role
Name string Name of the RAM Role. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphens, such as “-”, “_“, and must not begin with a hyphen.
- policy
Name string Name of the RAM policy. This name can have a string of 1 to 128 characters, must contain only alphanumeric characters or hyphen “-”, and must not begin with a hyphen.
- policy
Type string Type of the RAM policy. It must be
CustomorSystem.- role
Name string Name of the RAM Role. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphens, such as “-”, “_“, and must not begin with a hyphen.
- policy_
name str Name of the RAM policy. This name can have a string of 1 to 128 characters, must contain only alphanumeric characters or hyphen “-”, and must not begin with a hyphen.
- policy_
type str Type of the RAM policy. It must be
CustomorSystem.- role_
name str Name of the RAM Role. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphens, such as “-”, “_“, and must not begin with a hyphen.
Outputs
All input properties are implicitly available as output properties. Additionally, the RolePolicyAttachment resource produces the following output properties:
Look up an Existing RolePolicyAttachment Resource
Get an existing RolePolicyAttachment 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?: RolePolicyAttachmentState, opts?: CustomResourceOptions): RolePolicyAttachmentstatic get(resource_name, id, opts=None, policy_name=None, policy_type=None, role_name=None, __props__=None);func GetRolePolicyAttachment(ctx *Context, name string, id IDInput, state *RolePolicyAttachmentState, opts ...ResourceOption) (*RolePolicyAttachment, error)public static RolePolicyAttachment Get(string name, Input<string> id, RolePolicyAttachmentState? state, CustomResourceOptions? opts = null)- 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.
The following state arguments are supported:
- Policy
Name string Name of the RAM policy. This name can have a string of 1 to 128 characters, must contain only alphanumeric characters or hyphen “-”, and must not begin with a hyphen.
- Policy
Type string Type of the RAM policy. It must be
CustomorSystem.- Role
Name string Name of the RAM Role. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphens, such as “-”, “_“, and must not begin with a hyphen.
- Policy
Name string Name of the RAM policy. This name can have a string of 1 to 128 characters, must contain only alphanumeric characters or hyphen “-”, and must not begin with a hyphen.
- Policy
Type string Type of the RAM policy. It must be
CustomorSystem.- Role
Name string Name of the RAM Role. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphens, such as “-”, “_“, and must not begin with a hyphen.
- policy
Name string Name of the RAM policy. This name can have a string of 1 to 128 characters, must contain only alphanumeric characters or hyphen “-”, and must not begin with a hyphen.
- policy
Type string Type of the RAM policy. It must be
CustomorSystem.- role
Name string Name of the RAM Role. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphens, such as “-”, “_“, and must not begin with a hyphen.
- policy_
name str Name of the RAM policy. This name can have a string of 1 to 128 characters, must contain only alphanumeric characters or hyphen “-”, and must not begin with a hyphen.
- policy_
type str Type of the RAM policy. It must be
CustomorSystem.- role_
name str Name of the RAM Role. This name can have a string of 1 to 64 characters, must contain only alphanumeric characters or hyphens, such as “-”, “_“, and must not begin with a hyphen.
Package Details
- Repository
- https://github.com/pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloudTerraform Provider.