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

Fix a panic when creating HVS app or secret #1154

Merged
merged 4 commits into from
Dec 16, 2024
Merged

Conversation

divyapola5
Copy link
Contributor

🛠️ Description

This change adds in a fix for the bug. There is a panic when creating an app or a secret and this change addresses the issue.

🏗️ Acceptance tests

  • Are there any feature flags that are required to use this functionality?
  • Have you added an acceptance test for the functionality being added?
  • Have you run the acceptance tests on this branch?

Output from acceptance testing:
Screenshot 2024-12-13 at 3 11 05 PM
Screenshot 2024-12-13 at 3 11 24 PM
Screenshot 2024-12-13 at 3 25 21 PM

$ make testacc TESTARGS='-run=TestAccXXX'

...

@divyapola5 divyapola5 requested a review from a team as a code owner December 13, 2024 21:31
@divyapola5 divyapola5 requested review from a team as code owners December 13, 2024 21:33
.changelog/1154.txt Outdated Show resolved Hide resolved
@maxcoulombe
Copy link
Contributor

maxcoulombe commented Dec 13, 2024

The changes look good. I was able to reproduce the panic then when building this branch it fixed my TF project.

I did find another bug that we could fix at the same time or as a follow-up PR - up to you.

If you change the name of a hcp_vault_secrets_secret I'd expect that the secret with the previous name gets deleted and the a secret with the new name gets created. However, the TF provider treats it as an update and creates the new secret while not deleting the previous one. Same if the app name changes, the resource gets duplicated instead of recreated.

I think it can be simply fixed by adding this to the "app_name" and "secret_name" on the hcp_vault_secrets_secret schema.

PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},

Does it make sense?

@divyapola5
Copy link
Contributor Author

divyapola5 commented Dec 13, 2024

The changes look good. I was able to reproduce the panic then when building this branch it fixed my TF project.

I did find another bug that we could fix at the same time or as a follow-up PR - up to you.

If you change the name of a hcp_vault_secrets_secret I'd expect that the secret with the previous name gets deleted and the a secret with the new name gets created. However, the TF provider treats it as an update and creates the new secret while not deleting the previous one. Same if the app name changes, the resource gets duplicated instead of recreated.

I think it can be simply fixed by adding this to the "app_name" and "secret_name" on the hcp_vault_secrets_secret schema.

PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},

Does it make sense?

Ah did not know about this. Sure, will put up a new PR for this.

@divyapola5 divyapola5 merged commit 29db09e into main Dec 16, 2024
6 checks passed
@divyapola5 divyapola5 deleted the divyapola5/HV-3233 branch December 16, 2024 14:26
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.

4 participants