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

relax import for_each validation #36119

Merged
merged 1 commit into from
Nov 29, 2024
Merged

Conversation

jbardin
Copy link
Member

@jbardin jbardin commented Nov 27, 2024

Import blocks with for_each were intended to require resource blocks with a matching expansion. This validation however did not take place in prior releases, and configurations with this mismatch currently exist in production.

That simple validation also does not take into account a single resource instance inside of an expanded module, which is a valid use case and harder to check for at the point of validation. That will still fail correctly during plan if the targets are not available.

We can skip this validation for now, and work on generating static validation errors later on if possible, taking into account the expanded module case.

Fixes #36111

Import blocks with for_each were intended to require resource blocks
with a matching expansion. This validation however did not take place in
prior releases, and configurations with this mismatch currently exist in
production.

That simple validation also does not take into account a single resource
instance inside of an expanded module, which is a valid use case and
harder to check for at the point of validation. That will still fail
correctly during plan if the targets are not available.

We can skip this validation for now, and work on generating static
validation errors later on if possible, taking into account the expanded
module case.
@jbardin jbardin added the 1.10-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged label Nov 27, 2024
@jbardin jbardin requested a review from a team as a code owner November 27, 2024 15:44
@jbardin jbardin merged commit 8ea5947 into main Nov 29, 2024
8 checks passed
@jbardin jbardin deleted the jbardin/import-expansion-validation branch November 29, 2024 15:34
Copy link
Contributor

Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch.

Copy link
Contributor

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 Dec 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1.10-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Terraform v1.10.0 rejects for_each on imports in some valid cases
2 participants