Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change credential_types output to credential_type #5975

Merged
merged 1 commit into from
Jan 4, 2019
Merged

Conversation

jefferai
Copy link
Member

Fixes #5972

@jefferai jefferai added this to the 1.0.2 milestone Dec 18, 2018
@jefferai
Copy link
Member Author

@joelthompson does this seem like the right thing to do?

"policy_document": r.PolicyDocument,
"default_sts_ttl": int64(r.DefaultSTSTTL.Seconds()),
"max_sts_ttl": int64(r.MaxSTSTTL.Seconds()),
"credential_type": strings.Join(r.CredentialTypes, ","),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it also be wrapped with square brackets if the length is over 1? I ask because of this example in the issue: "credential_types": ["assumed_role"].

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note too, that the role_arns is an array type as well and should just be role_arn. I'd also assume that when you set role_arn that it conflicts with policy_arn and policy.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tyrannosaurus-becks The brackets are just the way it's being displayed. They're caused by the fact that it's coming back as an array even though the input is (now) a single string. The only reason it would be multiple values at this point is legacy roles, so this is a way to still allow legacy roles to display possibly more than one type while making the output the same type as the input.

@jasonmcintosh I'd also assume that when you set role_arn that it conflicts with policy_arn and policy. -- can you explain?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so if you set role_arn, that should be a conflicts with policy_document values. As I believe you don't want to try and modify a role.... just trying to think of the combinations and how they interact on this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jasonmcintosh I'm not really following. Why should role_arns be role_arn? The logic allows for multiple values.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jefferai Not saying role_arns should be role_arn - saying role_arns should conflict with policy_arn and policy - as you can't have both a role_arn you're explicitly providing as well as a dynamically generated account.

Will see if this solves one of my headaches using terraform resource vault_generic_secret to create various vault roles. Still need to get the vault provider in terraform to work with this as well. https://github.com/terraform-providers/terraform-provider-vault/blob/master/vault/resource_aws_secret_backend_role.go . currently doesn't support role_arns :(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @jasonmcintosh, agree that role_arns and policy_arns don't make sense together. The role creation code, I believe, prohibits creating roles with both values.

role_arns and policy_document are compatible -- the latter will scope down the the permissions granted to a role being assumed.

Is there something I'm missing in what you're saying?

Copy link
Contributor

@tyrannosaurus-becks tyrannosaurus-becks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Jeff!

@tyrannosaurus-becks tyrannosaurus-becks self-assigned this Dec 20, 2018
@jefferai jefferai merged commit 2dcd0ae into master Jan 4, 2019
@jefferai jefferai deleted the issue-5972 branch January 4, 2019 19:49
Copy link
Contributor

@joelthompson joelthompson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @jeffrai for not seeing this sooner. Yep, this makes sense to me!

"policy_document": r.PolicyDocument,
"default_sts_ttl": int64(r.DefaultSTSTTL.Seconds()),
"max_sts_ttl": int64(r.MaxSTSTTL.Seconds()),
"credential_type": strings.Join(r.CredentialTypes, ","),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @jasonmcintosh, agree that role_arns and policy_arns don't make sense together. The role creation code, I believe, prohibits creating roles with both values.

role_arns and policy_document are compatible -- the latter will scope down the the permissions granted to a role being assumed.

Is there something I'm missing in what you're saying?

@jasonmcintosh
Copy link
Contributor

If code operates that way sounds good to me! I’ll check this out do some tests. May work on an integration test project to validate current provider against current vault.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants