Skip to content

Add additional validation that the backend used in a run is a supported type #36648

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

Merged

Conversation

SarahFrench
Copy link
Member

@SarahFrench SarahFrench commented Mar 6, 2025

This PR builds on #36541

Now there is validation to ensure that:

  • the backend block doesn't attempt to use a removed backend (e.g. artifactory, etcd)
  • the backend block doesn't include an invalid backend type (e.g. typo from a user, hallucinating LLM...)

Target Release

1.12.x

CHANGELOG entry

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

Will add a changelog in the final PR into main

@SarahFrench SarahFrench added the no-changelog-needed Add this to your PR if the change does not require a changelog entry label Mar 6, 2025
@SarahFrench SarahFrench marked this pull request as ready for review March 6, 2025 16:54
@SarahFrench SarahFrench requested a review from a team as a code owner March 6, 2025 16:54
for _, tf := range config.Module.Tests {
bucketHashes := make(map[int]string)
// Use an ordered list of backends, so that errors are raised by 2nd+ time
// that a backend config is used in a file.
for _, bc := range orderBackendsByDeclarationLine(tf.BackendConfigs) {
f := backendInit.Backend(bc.Backend.Type)
if f == nil {
detail := fmt.Sprintf("There is no backend type named %q.", bc.Backend.Type)
if msg, removed := backendInit.RemovedBackends[bc.Backend.Type]; removed {
Copy link
Member Author

Choose a reason for hiding this comment

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

This validation needs to be here because it also depends on internal/backend/init, which is hard to import elsewhere

@SarahFrench
Copy link
Member Author

Thanks!

@SarahFrench SarahFrench merged commit a8c57d1 into f-controlling-destroys Mar 6, 2025
14 of 16 checks passed
@SarahFrench SarahFrench deleted the sarah/check-valid-backend-in-run branch March 6, 2025 17:18
Copy link
Contributor

github-actions bot commented Apr 6, 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 Apr 6, 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