Backport of backend/http: Refresh state earlier (align with other backends) into v1.14#38060
Conversation
|
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement Learn more about why HashiCorp requires a CLA and what the CLA includes temp seems not to be a GitHub user. Have you signed the CLA already but the status is still pending? Recheck it. |
1 similar comment
|
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement Learn more about why HashiCorp requires a CLA and what the CLA includes temp seems not to be a GitHub user. Have you signed the CLA already but the status is still pending? Recheck it. |
|
Addressed in #38061 |
|
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Backport
This PR is auto-generated from #38033 to be assessed for backporting due to the inclusion of the label 1.14-backport.
🚨
The person who merged in the original PR is:
@radeksimko
This person should resolve the merge-conflict(s) by either:
The below text is copied from the body of the original PR.
This updates the
httpbackend's behaviour such that it refreshes state prior to returning theStateMgr. In practice this should not have any impact on the end user, perhaps just that errors will be raised a little bit earlier.This change however enables us to now use that backend to test edge cases and prevent bugs such as #38027
Prior to this patch, the
httpbackend is not actually impacted by the crash reported in #38027Some backends (azure, gcs, kubernetes) are assumed to be impacted as they implement the exact same behaviour I'm trying to mimic here:
terraform/internal/backend/remote-state/azure/backend_state.go
Lines 107 to 110 in 193867f
terraform/internal/backend/remote-state/gcs/backend_state.go
Lines 108 to 111 in 193867f
terraform/internal/backend/remote-state/kubernetes/backend_state.go
Lines 94 to 97 in 193867f
Other backends implement the same logic conditionally (only refresh once a previously not-existing state was auto-created) but the bug likely impacts them in a similar way anyway:
terraform/internal/backend/remote-state/consul/backend_state.go
Lines 120 to 124 in 193867f
terraform/internal/backend/remote-state/cos/backend_state.go
Lines 126 to 130 in 193867f
terraform/internal/backend/remote-state/oci/backend_state.go
Lines 88 to 91 in 193867f
terraform/internal/backend/remote-state/oss/backend_state.go
Lines 162 to 166 in 193867f
terraform/internal/backend/remote-state/s3/backend_state.go
Lines 231 to 234 in 193867f
I'm open to breaking away the last commit and reviewing it alongside #38028 - we cannot really merge this PR on its own without #38028 anyway but having it crash like this in isolation hopefully demonstrates the value.
Overview of commits
9880dfe
18ea052
61ee0ba
0d0cfb5