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

Allow variable references in depends_on #290

Merged
merged 1 commit into from
Nov 1, 2023
Merged

Conversation

dbanck
Copy link
Member

@dbanck dbanck commented Oct 27, 2023

This PR allows variable references in depends_on aligning it with Terraform.

UX

Before
CleanShot 2023-10-27 at 15 58 38@2x

After
CleanShot 2023-10-27 at 15 58 16@2x


@dbanck dbanck added the bug Something isn't working label Oct 27, 2023
@dbanck dbanck self-assigned this Oct 27, 2023
@dbanck dbanck requested a review from a team as a code owner October 27, 2023 13:59
Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

I believe that local references are also allowed but we can address that in a separate PR.

locals {
  foo = true
}

resource "random_pet" "name" {
  depends_on = [local.foo]
}

^ that is considered valid by plan/apply/validate but we also raise it as an error:

Screenshot 2023-10-31 at 12 06 08

Whether it's a good practice and good idea is another question, but it's at least ignored/allowed by Core.

@dbanck dbanck merged commit e138364 into main Nov 1, 2023
4 checks passed
@dbanck dbanck deleted the b-add-vars-to-depends_on branch November 1, 2023 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Variable references are not recognised in depends_on
3 participants