Skip to content

Fix function refs in variable validation#2052

Merged
cam72cam merged 6 commits intomainfrom
2051_fix_functions_in_variable_validation
Oct 17, 2024
Merged

Fix function refs in variable validation#2052
cam72cam merged 6 commits intomainfrom
2051_fix_functions_in_variable_validation

Conversation

@cam72cam
Copy link
Member

@cam72cam cam72cam commented Oct 4, 2024

The nodeModuleVariable.References() function is not called within the function transformer as it is on an expanded object. Instead these references are determined pre-expansion and provided to the provider function transformer

I still need to try to find a test case that explicitly triggers this, instead of the race condition in the issue.

Resolves #2051

Target Release

1.9.0,1.8.4,1.7.4

Checklist

  • I have read the contribution guide.
  • I have not used an AI coding assistant to create this PR.
  • I have written all code in this PR myself OR I have marked all code I have not written myself (including modified code, e.g. copied from other places and then modified) with a comment indicating where it came from.
  • I (and other contributors to this PR) have not looked at the Terraform source code while implementing this PR.

Go checklist

  • I have run golangci-lint on my change and receive no errors relevant to my code.
  • I have run existing tests to ensure my code doesn't break anything.
  • I have added tests for all relevant use cases of my code, and those tests are passing.
  • I have only exported functions, variables and structs that should be used from other packages.
  • I have added meaningful comments to all exported functions, variables, and structs.

Website/documentation checklist

  • I have locally started the website as described here and checked my changes.

The nodeModuleVariable.References() function is not called within the
function transformer as it is on an expanded object.  Instead these
references are determined pre-expansion and provided to the provider
function transformer

Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
@github-actions
Copy link

github-actions bot commented Oct 4, 2024

Reminder for the PR assignee: If this is a user-visible change, please update the changelog as part of the PR.

Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
@cam72cam cam72cam changed the title [WIP] Fix function refs in variable validation Fix function refs in variable validation Oct 7, 2024
@cam72cam cam72cam marked this pull request as ready for review October 7, 2024 18:20
@cam72cam cam72cam requested a review from a team as a code owner October 7, 2024 18:20
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
ghost
ghost previously approved these changes Oct 8, 2024
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
@cam72cam cam72cam merged commit 7cacb9f into main Oct 17, 2024
@cam72cam cam72cam deleted the 2051_fix_functions_in_variable_validation branch October 17, 2024 16:37
MS99-9 pushed a commit to MS99-9/opentofu that referenced this pull request Oct 20, 2024
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Signed-off-by: Mohamed Medhat Mohamed Ibrahim Shalaby <mohamed.shalaby@tum.de>
Yantrio pushed a commit that referenced this pull request Oct 23, 2024
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
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.

Intermittent tofu validate error when variable conditions use provider defined functions

2 participants