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

Cannot refresh/plan using vault generated STS Federation Token creds for AWS #15728

Closed
Yuxael opened this issue Aug 4, 2017 · 3 comments
Closed

Comments

@Yuxael
Copy link

Yuxael commented Aug 4, 2017

Terraform Version

Terraform v0.10.0

Terraform Configuration Files

data "vault_generic_secret" "aws_creds" {
  path = "aws/sts/deploy"
}


provider "aws" {
    region = "${var.ec2_region}"
    access_key = "${data.vault_generic_secret.aws_creds.data["access_key"]}"
    secret_key = "${data.vault_generic_secret.aws_creds.data["secret_key"]}"
    token = "${data.vault_generic_secret.aws_creds.data["security_token"]}"
}

Debug Output

https://gist.github.com/Yuxael/9f3c0ff87f26053688a3bb6d8420877d

Expected Behavior

AWS credentials regenerated and terraform refresh/plan should run successfully

Actual Behavior

Just hangs for eternity. It keeps looping over dag/walk: vertex ... shown at the end of debug.

Steps to Reproduce

  1. Run 'terraform refresh/apply(whatever that generates/updatestfstate`, should work first time).
  2. Wait until lease time for STS token expire.
  3. Run again terraform refresh/plan (will hang forever - cancel).
  4. Manually remove data.vault_generic_secret.aws_creds section from tfstate.
  5. Run once again terraform refresh/plan (will work this time).

Important Factoids

When running first time it runs successfully and do refresh tfstate or outputs a plan. Reruns also works fine until lease time for credentials expires, then it behaves like debug shows.

What bothers me is also the fact that is saves credentials generated by Vault in tfstate:

"data.vault_generic_secret.aws_creds": {
                    "type": "vault_generic_secret",
                    "depends_on": [],
                    "primary": {
                        "id": "0d3e2d54-5e3f-a933-3d2c-a2f8e4a29d34",
                        "attributes": {
                            "data.%": "3",
                            "data.access_key": "<redacted>",
                            "data.secret_key": "<redacted>",
                            "data.security_token": "<redacted>",
                            "data_json": "{\"access_key\":\"<redacted>\",\"secret_key\":\"<redacted>\",\"security_token\":\"<redacted>\"}",
                            "id": "0d3e2d54-5e3f-a933-3d2c-a2f8e4a29d34",
                            "lease_duration": "3599",
                            "lease_id": "aws/sts/deploy/c9808580-0640-b8f2-eaeb-0c6db0997dd5",
                            "lease_renewable": "false",
                            "lease_start_time": "RFC7779",
                            "path": "aws/sts/deploy"
                        },
                        "meta": {},
                        "tainted": false
}

This is talked about in issue #516 and is directly connected with this problem because in order to make plan and refresh commands work again I have to manually delete those stale credentials from tfstate.

References

@jbardin
Copy link
Member

jbardin commented Aug 4, 2017

Hi @Yuxael,

Thanks for filing such a thorough issue.

I'm going to tag this for the vault provider for now. It seems that the vault data source is being read correctly, but the credentials aren't being refreshed.

@hashibot
Copy link
Contributor

hashibot commented Aug 4, 2017

This issue has been automatically migrated to hashicorp/terraform-provider-vault#9 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to this issue and let us know.

@hashibot hashibot closed this as completed Aug 4, 2017
@ghost
Copy link

ghost commented Apr 8, 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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants