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

Fix: terraform plan and apply conditions #2232

Merged
merged 2 commits into from
Jul 26, 2024

Conversation

lalver1
Copy link
Member

@lalver1 lalver1 commented Jul 19, 2024

This PR is a follow-up to PR #2213. The terraform plan and apply steps were not running when expected because the conditions on the steps were not evaluating correctly. Contrary to the documentation, we noticed that parameters don't get evaluated in conditions. Because of this, even though tag_type was set in Terraform apply, this step wouldn't run when a tag was pushed.

This PR fixes this behavior by changing parameters.tag_type to variables['tag_type'] for Terraform plan and Terraform apply which requires:

  • moving the step that generates the tag_type from azure-pipelines.yml into deploy.yml so that tag_type doesn't get passed as a parameter anymore
  • using tag.py to determine the value of IS_TAG instead of an Azure pipeline expression since env: does not support evaluating expressions and variables: is out of scope in deploy.yaml.

@lalver1 lalver1 self-assigned this Jul 19, 2024
@github-actions github-actions bot added the infrastructure Terraform, Azure, etc. label Jul 19, 2024
Copy link

github-actions bot commented Jul 19, 2024

Coverage report

This PR does not seem to contain any modification to coverable code.

@lalver1 lalver1 force-pushed the fix/terraform-plan-apply-conditions branch from 1f22c94 to dd57ccc Compare July 25, 2024 21:13
@lalver1 lalver1 marked this pull request as ready for review July 25, 2024 21:47
@lalver1 lalver1 requested a review from a team as a code owner July 25, 2024 21:47
Copy link
Member

@angela-tran angela-tran left a comment

Choose a reason for hiding this comment

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

This reads very nicely and cleanly to me! Nice work @lalver1

Copy link
Member

@thekaveman thekaveman left a comment

Choose a reason for hiding this comment

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

Nice work sticking with this one!

@lalver1
Copy link
Member Author

lalver1 commented Jul 26, 2024

Thanks @angela-tran and @thekaveman !

@lalver1 lalver1 merged commit a10beb7 into main Jul 26, 2024
15 checks passed
@lalver1 lalver1 deleted the fix/terraform-plan-apply-conditions branch July 26, 2024 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working infrastructure Terraform, Azure, etc.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants