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

Persist namespace to state on import #1563

Merged
merged 7 commits into from
Aug 4, 2022

Conversation

benashz
Copy link
Contributor

@benashz benashz commented Aug 4, 2022

Whenever a namespaced resource was being imported with the TERRAFORM_VAULT_NAMESPACE_IMPORT the namespace field was not being stored in the TF state. This would cause the imported resource to be flagged as needing recreation on terraform apply, since a change to the namespace was being detected.

The fix is to detect the import on any resource read, and set the imported namespace in the state. This is done by wrapping a schema's Read or ReadContext function on all resources.

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

Relates OR Closes #0000

Release note for CHANGELOG:


Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccXXX'

...

@benashz benashz added this to the 3.8.1 milestone Aug 4, 2022
Copy link
Contributor

@vinay-gopalan vinay-gopalan left a comment

Choose a reason for hiding this comment

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

Looks great!

@benashz benashz merged commit eae35c2 into main Aug 4, 2022
@benashz benashz deleted the VAULT-7434/persist-namespace-to-state-on-import branch August 4, 2022 18:38
marcboudreau pushed a commit to marcboudreau/terraform-provider-vault that referenced this pull request Nov 6, 2022
* Add read wrapper function for namespace import
* Wrap all relevant schema.Resource.Read funcs
* Wrap all relevant schema.Resource.ReadContext funcs
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 this pull request may close these issues.

2 participants