Skip to content

Conversation

@SarahFrench
Copy link
Member

@SarahFrench SarahFrench commented Aug 26, 2025

This PR is stacked on #37509

This PR updates the backend.Backend interface's StateMgr method to return diagnostics instead of errors. This will allow backends to return warnings in future, instead of just errors.

I've also updated any calling code that uses any implementations of that method. This includes test code.

Target Release

N/A

Rollback Plan

  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

CHANGELOG entry

  • This change is user-facing and I added a changelog entry.
  • This change is not user-facing.

@SarahFrench SarahFrench added the no-changelog-needed Add this to your PR if the change does not require a changelog entry label Aug 26, 2025
@SarahFrench SarahFrench force-pushed the sarah/update-statemgr-method-diagnostics branch from 390e471 to e501728 Compare August 27, 2025 09:15
@SarahFrench
Copy link
Member Author

SarahFrench commented Aug 27, 2025

Testing:

pg backend:

% go test github.com/hashicorp/terraform/internal/backend/remote-state/pg   
ok      github.com/hashicorp/terraform/internal/backend/remote-state/pg 0.958s

kubernetes backend:

% go test github.com/hashicorp/terraform/internal/backend/remote-state/kubernetes
ok      github.com/hashicorp/terraform/internal/backend/remote-state/kubernetes 54.540s

gcs backend

% go test github.com/hashicorp/terraform/internal/backend/remote-state/gcs
ok      github.com/hashicorp/terraform/internal/backend/remote-state/gcs        122.954s

I don't have the resources/knowledge for testing s3 and azure Working on it!

@SarahFrench SarahFrench force-pushed the sarah/update-statemgr-method-diagnostics branch from e69068e to 65b3b88 Compare August 27, 2025 18:31
@SarahFrench
Copy link
Member Author

SarahFrench commented Aug 27, 2025

I just rebased this PR on top of X so that the s3 test failures resulting from diagnostic comparisons are resolved. This means it's easier to see what failures could be caused by this PR's changes.

I ran the s3 tests locally and they passed:

% go test github.com/hashicorp/terraform/internal/backend/remote-state/s3
ok      github.com/hashicorp/terraform/internal/backend/remote-state/s3 12.926s

@SarahFrench
Copy link
Member Author

I ran the azure tests on this PR and found the outcome was just like in this comment on another PR: #37502

  • TestAccBackendAzureADAuthBasic fails due to missing permissions, I think the ability to interact with Active Directory?
  • Flakey tests: The tests below fail when run alongside other tests, but pass when run individually. I think there's manipulation of ENVs that impacts across tests somewhere, but I don't want to dig into that.

--- FAIL: TestRemoteClientAccessKeyBasic (0.00s)
helpers_test.go:159: Missing ARM_SUBSCRIPTION_ID
--- FAIL: TestRemoteClientSasTokenBasic (0.00s)
helpers_test.go:159: Missing ARM_SUBSCRIPTION_ID
--- FAIL: TestAccBackendServicePrincipalLocked (0.00s)
helpers_test.go:159: Missing ARM_SUBSCRIPTION_ID

@SarahFrench SarahFrench changed the base branch from main to sarah/fix-diag-comparison-s3-tests August 27, 2025 18:45
@SarahFrench SarahFrench force-pushed the sarah/update-statemgr-method-diagnostics branch from 65b3b88 to 2d86ba1 Compare August 28, 2025 11:42
Base automatically changed from sarah/fix-diag-comparison-s3-tests to main August 28, 2025 13:33
@SarahFrench SarahFrench marked this pull request as ready for review August 28, 2025 14:58
@SarahFrench SarahFrench requested review from a team as code owners August 28, 2025 14:58
@radeksimko radeksimko merged commit 8503c45 into main Sep 4, 2025
13 checks passed
@radeksimko radeksimko deleted the sarah/update-statemgr-method-diagnostics branch September 4, 2025 10:14
@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2025

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no-changelog-needed Add this to your PR if the change does not require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants