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

Breaking change in v2.12.1 #833

Closed
stuartpurgavie opened this issue Jul 30, 2020 · 5 comments · Fixed by #837
Closed

Breaking change in v2.12.1 #833

stuartpurgavie opened this issue Jul 30, 2020 · 5 comments · Fixed by #837
Labels

Comments

@stuartpurgavie
Copy link

stuartpurgavie commented Jul 30, 2020

Terraform Version

0.12.29

Affected Resource(s)

  • data.vault_aws_access_credentials

Terraform Configuration Files

provider "aws" {}

provider "vault" {
  address = "https://vault.domain.com"
  token   = "${var.route53_vault_token}"
}

data "vault_aws_access_credentials" "route53_creds" {
  backend = "team-repo-prod-aws"
  role    = "route53_aws_domain_com_deploy"
}

provider "aws" {
  alias      = "route53"
  access_key = "${data.vault_aws_access_credentials.route53_creds.access_key}"
  secret_key = "${data.vault_aws_access_credentials.route53_creds.secret_key}"
}

Debug Output

Error: Error refreshing state: 1 error(s) occurred:

* data.vault_aws_access_credentials.route53_creds: 1 error(s) occurred:

* data.vault_aws_access_credentials.route53_creds: data.vault_aws_access_credentials.route53_creds: error reading from Vault: Error making API request.

URL: GET https://vault.lllint.com/v1/team-repo-prod-aws/config/root
Code: 403. Errors:

* 1 error occurred:
	* permission denied

Expected Behavior

Vault policy for this role should not require access to the root configuration endpoint.

Actual Behavior

Terraform requires a new Vault permission unexpectedly.

Steps to Reproduce

  1. terraform apply

Attached policy used to be:

// Allow token to create creds against the aws Account
path "team-repo-prod-aws/creds/route53_aws_domain_com_deploy" {
  capabilities = ["read"]
}

Now needs to be updated to:

// Allow token to create creds against the aws Account
path "team-repo-prod-aws/creds/route53_aws_domain_com_deploy" {
  capabilities = ["read"]
}

// Breaking change in Terraform Vault provider v2.12.1 now requires this permission
path "team-repo-prod-aws/config/root" {
  capabilities = ["read"]
}

Important Factoids

  • This moves the provider away from the principle of least privilege. Either a new data resource should be required, or the existing resource should only check the endpoint if the region data is specifically referenced.
  • If additional permissions or paths are required, from a maintenance perspective you may want to consider bumping the MINOR number in semver instead of the PATCH number, as it is likely to create a breaking change, not in the provider, but in the end user's deployment environment.

References

N/A

@kalafut kalafut added the bug label Jul 31, 2020
@vauchok
Copy link

vauchok commented Jul 31, 2020

The same for me, but with 405:

Error: Error refreshing state: 3 errors occurred:
	* data.vault_aws_access_credentials.creds: 1 error occurred:
	* data.vault_aws_access_credentials.creds: data.vault_aws_access_credentials.creds: error reading from Vault: Error making API request.

URL: GET https://xxx/v1/aws/sso/config/root
Code: 405. Errors:

* 1 error occurred:
	* unsupported operation

Thanks @WDouglasWest
He reviewed the merge and found the issue

@davesade
Copy link

Similar here as well:

Error: Error refreshing state: 1 error occurred:
	* data.vault_aws_access_credentials.aws: 1 error occurred:
	* data.vault_aws_access_credentials.aws: data.vault_aws_access_credentials.aws: error reading from Vault: Error making API request.

URL: GET https://xxxxxxx.:443/v1/aws/ssc/config/root
Code: 405. Errors:

* 1 error occurred:
	* unsupported operation

With version 2.12.0 it still works as expected.

@catsby
Copy link
Contributor

catsby commented Jul 31, 2020

Thanks for the report! We're looking into this now and hope to update the provider today (Friday, July 31st 2020). That update may be simply reverting this change, but I don't know for sure at this time. Thank you again for reporting and your patience.

@kalafut
Copy link
Contributor

kalafut commented Jul 31, 2020

Fixed in #837

@kalafut kalafut closed this as completed Jul 31, 2020
@catsby
Copy link
Contributor

catsby commented Jul 31, 2020

Additional follow-up: The breaking change that was introduced in v2.12.1 was reverted in #837 and released in v2.12.2. Apologies for the trouble!

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

Successfully merging a pull request may close this issue.

5 participants