Skip to content

Commit

Permalink
iam: Override role on RolePolicy to accept a Role
Browse files Browse the repository at this point in the history
This brings RolePolicy in line with RolePolicyAttachment in accepting a
Role rather than requiring the ID.
  • Loading branch information
jen20 committed Jul 17, 2018
1 parent a47acc6 commit 41e258f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 9 additions & 1 deletion resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,15 @@ func Provider() tfbridge.ProviderInfo {
// deletes the same attachment we just created, since it is structurally equivalent!
DeleteBeforeReplace: true,
},
"aws_iam_role_policy": {Tok: awsResource(iamMod, "RolePolicy")},
"aws_iam_role_policy": {
Tok: awsResource(iamMod, "RolePolicy"),
Fields: map[string]*tfbridge.SchemaInfo{
"role": {
Type: "string",
AltTypes: []tokens.Type{awsType(iamMod+"/role", "Role")},
},
},
},
"aws_iam_role": {
Tok: awsResource(iamMod, "Role"),
Fields: map[string]*tfbridge.SchemaInfo{
Expand Down
8 changes: 5 additions & 3 deletions sdk/nodejs/iam/rolePolicy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import * as pulumi from "@pulumi/pulumi";

import {Role} from "./role";

/**
* Provides an IAM role policy.
*/
Expand Down Expand Up @@ -37,7 +39,7 @@ export class RolePolicy extends pulumi.CustomResource {
/**
* The IAM role to attach to the policy.
*/
public readonly role: pulumi.Output<string>;
public readonly role: pulumi.Output<string | Role>;

/**
* Create a RolePolicy resource with the given unique name, arguments, and options.
Expand Down Expand Up @@ -94,7 +96,7 @@ export interface RolePolicyState {
/**
* The IAM role to attach to the policy.
*/
readonly role?: pulumi.Input<string>;
readonly role?: pulumi.Input<string | Role>;
}

/**
Expand All @@ -119,5 +121,5 @@ export interface RolePolicyArgs {
/**
* The IAM role to attach to the policy.
*/
readonly role: pulumi.Input<string>;
readonly role: pulumi.Input<string | Role>;
}

0 comments on commit 41e258f

Please sign in to comment.