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

Allow configuring token version for global STS endpoint #10707

Closed
mikn opened this issue Nov 1, 2019 · 8 comments
Closed

Allow configuring token version for global STS endpoint #10707

mikn opened this issue Nov 1, 2019 · 8 comments
Labels
new-resource Introduces a new resource. service/iam Issues and PRs that pertain to the iam service.

Comments

@mikn
Copy link

mikn commented Nov 1, 2019

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

With the introduction of ap-east-1 and me-south-1, they are the first regions to only accept V2 STS tokens. However, to allow for backwards compatibility the global STS endpoint (https://sts.amazonaws.com) issues V1 tokens per default. This means that you cannot use a token from the global STS endpoint to authenticate against regional endpoints for these two new regions (and any following regions).

It would be helpful to be able to use terraform to configure this setting. Here's the API documentation for the call: https://docs.aws.amazon.com/IAM/latest/APIReference/API_SetSecurityTokenServicePreferences.html

New or Affected Resource(s)

  • aws_organizations_account (?)

I'm not sure under which resource this configuration flag should be put, as it is an AWS account setting under IAM, but it isn't bound to any specific IAM resource. I'm open to suggestions!

Potential Terraform Configuration

resource "aws_organizations_account" "this" {
  global_sts_token_version = "v2"
}

References

@mikn mikn added the enhancement Requests to existing resources that expand the functionality or scope. label Nov 1, 2019
@ghost ghost added the service/organizations Issues and PRs that pertain to the organizations service. label Nov 1, 2019
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Nov 1, 2019
@ewbankkit
Copy link
Contributor

ewbankkit commented Nov 1, 2019

@mikn Could you try setting AWS_STS_REGIONAL_ENDPOINTS=regional in your environment (if possible)?
Plus use v2.34.0 of the AWS provider.
Thanks.

@ewbankkit
Copy link
Contributor

@mikn
Copy link
Author

mikn commented Nov 1, 2019

For me, either changing this setting on the AWS account, or setting AWS_STS_REGIONAL_ENDPOINTS=regional both work. It is more convenient for us to not require an environment variable for every terraform user, so being able to configure this setting would still be helpful (or if you change the default setting in the AWS provider, that could also work for us).

@ewbankkit
Copy link
Contributor

@mikn Agreed. We could add a new argument (like sts_regional_endpoints) to the provider configuration.

@mikn
Copy link
Author

mikn commented Nov 1, 2019

@ewbankkit I'm sorry, I don't think I answered the question you actually were asking. I think this still belongs in a resource, as a provider configuration flag only would cover the Terraform use-case but not other AWS API clients. Most implementations (and even the official AWS libraries) work under the assumption that a token from the global STS endpoint is valid for all regions (an assumption that they now broke unless you flip this flag).

By exposing the configuration of token version on the global STS service through a resource, you can provision accounts through Terraform with this setting on, making this assumption true again, and it would mitigate most "wtf" moments across most clients (unless they assume a fixed token size).

In other words, we would most likely need to change this configuration setting no matter whether Terraform works or not.

@bflad
Copy link
Contributor

bflad commented Nov 1, 2019

My recommendation here would be to split off the new provider configuration into its own feature request, while treating this feature request as implementing a new resource such as:

resource "aws_iam_security_token_service_preferences" "example" {
  global_endpoint_token_version = "v2Token"
}

That uses the following APIs:

@bflad bflad added new-resource Introduces a new resource. service/iam Issues and PRs that pertain to the iam service. and removed enhancement Requests to existing resources that expand the functionality or scope. needs-triage Waiting for first response or review from a maintainer. service/organizations Issues and PRs that pertain to the organizations service. labels Nov 1, 2019
@ghost
Copy link

ghost commented Jan 30, 2020

I'm going to close this issue due to inactivity (90 days without response ⏳ ). This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost closed this as completed Jan 30, 2020
@ghost
Copy link

ghost commented Mar 27, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 27, 2020
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-resource Introduces a new resource. service/iam Issues and PRs that pertain to the iam service.
Projects
None yet
Development

No branches or pull requests

3 participants