Show / Hide Table of Contents

Class RolePolicyAttachment

Attaches a Managed IAM Policy to an IAM role

NOTE: The usage of this resource conflicts with the aws.iam.PolicyAttachment resource and will permanently show a difference if both are defined.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var role = new Aws.Iam.Role("role", new Aws.Iam.RoleArgs
    {
        AssumeRolePolicy = @"    {
  ""Version"": ""2012-10-17"",
  ""Statement"": [
    {
      ""Action"": ""sts:AssumeRole"",
      ""Principal"": {
        ""Service"": ""ec2.amazonaws.com""
      },
      ""Effect"": ""Allow"",
      ""Sid"": """"
    }
  ]
}

",
    });
    var policy = new Aws.Iam.Policy("policy", new Aws.Iam.PolicyArgs
    {
        Description = "A test policy",
        Policy = @"{
""Version"": ""2012-10-17"",
""Statement"": [
{
  ""Action"": [
    ""ec2:Describe*""
  ],
  ""Effect"": ""Allow"",
  ""Resource"": ""*""
}
]
}

",
    });
    var test_attach = new Aws.Iam.RolePolicyAttachment("test-attach", new Aws.Iam.RolePolicyAttachmentArgs
    {
        PolicyArn = policy.Arn,
        Role = role.Name,
    });
}

}
Inheritance
System.Object
Resource
CustomResource
RolePolicyAttachment
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Aws.Iam
Assembly: Pulumi.Aws.dll
Syntax
public class RolePolicyAttachment : CustomResource

Constructors

View Source

RolePolicyAttachment(String, RolePolicyAttachmentArgs, CustomResourceOptions)

Create a RolePolicyAttachment resource with the given unique name, arguments, and options.

Declaration
public RolePolicyAttachment(string name, RolePolicyAttachmentArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

RolePolicyAttachmentArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

PolicyArn

The ARN of the policy you want to apply

Declaration
public Output<string> PolicyArn { get; }
Property Value
Type Description
Output<System.String>
View Source

Role

The role the policy should be applied to

Declaration
public Output<string> Role { get; }
Property Value
Type Description
Output<System.String>

Methods

View Source

Get(String, Input<String>, RolePolicyAttachmentState, CustomResourceOptions)

Get an existing RolePolicyAttachment resource's state with the given name, ID, and optional extra properties used to qualify the lookup.

Declaration
public static RolePolicyAttachment Get(string name, Input<string> id, RolePolicyAttachmentState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

RolePolicyAttachmentState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
RolePolicyAttachment
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.