Skip to content

Conversation

pkoutsovasilis
Copy link
Contributor

@pkoutsovasilis pkoutsovasilis commented Sep 9, 2025

What does this PR do?

This PR fixes issues with ESS stack cleanup in CI by:

  • Moving the ASDF_TERRAFORM_VERSION definition to the global pipeline environment so it is available to all steps, ensuring asdf provides the required terraform binary.
  • Passing the ess_region variable explicitly to terraform destroy in both Bash and PowerShell scripts, since it is required to properly clean up FIPS ESS stacks that do not use the default region specified in Terraform files.
  • Ensuring the correct set of Terraform environment variables is consistently provided during ESS stack cleanup.

Why is it important?

Without these changes, ESS stacks are not be cleaned up correctly after CI runs due to missing terraform binaries, unset environment variables, or incorrect region handling. This results in orphaned cloud resources, higher costs, and hitting stack quotas, which can block new CI runs from provisioning fresh environments.

Before this PR link. With this PR link.

Checklist

  • I have read and understood the pull request guidelines of this project.
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in ./changelog/fragments using the changelog tool
  • I have added an integration test or an E2E test

Disruptive User Impact

None expected. These changes affect only CI pipelines and cleanup scripts.

How to test this PR locally

Open a draft PR and see that ESS cleanup steps are actually cleaning up the stacks.

Related issues

N/A

@pkoutsovasilis pkoutsovasilis self-assigned this Sep 9, 2025
@pkoutsovasilis pkoutsovasilis added skip-changelog backport-active-all Automated backport with mergify to all the active branches labels Sep 9, 2025
@pkoutsovasilis pkoutsovasilis force-pushed the ci/fix_terraform_asdf_version branch 2 times, most recently from df7ea06 to 0234b52 Compare September 9, 2025 23:31
@pkoutsovasilis pkoutsovasilis force-pushed the ci/fix_terraform_asdf_version branch from 0234b52 to abee87b Compare September 10, 2025 06:44
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @pkoutsovasilis

@pkoutsovasilis pkoutsovasilis changed the title fix: specify terraform env var everywhere fix: ESS stack clean up steps Sep 10, 2025
@pkoutsovasilis pkoutsovasilis marked this pull request as ready for review September 10, 2025 10:57
@pkoutsovasilis pkoutsovasilis requested a review from a team as a code owner September 10, 2025 10:57
Copy link
Member

@v1v v1v left a comment

Choose a reason for hiding this comment

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

LGTM - thanks for the fix

@pkoutsovasilis pkoutsovasilis merged commit 6918b7b into elastic:main Sep 10, 2025
23 checks passed
Copy link
Contributor

@Mergifyio backport 8.18 8.19 9.0 9.1

Copy link
Contributor

mergify bot commented Sep 10, 2025

backport 8.18 8.19 9.0 9.1

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Sep 10, 2025
* fix: specify terraform env var everywhere

* fix: proper env vars for ESS Stack clean up

* fix: error when terraform fails to destroy ESS stack

* fix: pass ess_region in terraform destroy

(cherry picked from commit 6918b7b)

# Conflicts:
#	.buildkite/bk.integration-fips.pipeline.yml
#	.buildkite/scripts/steps/ess.ps1
mergify bot pushed a commit that referenced this pull request Sep 10, 2025
* fix: specify terraform env var everywhere

* fix: proper env vars for ESS Stack clean up

* fix: error when terraform fails to destroy ESS stack

* fix: pass ess_region in terraform destroy

(cherry picked from commit 6918b7b)
mergify bot pushed a commit that referenced this pull request Sep 10, 2025
* fix: specify terraform env var everywhere

* fix: proper env vars for ESS Stack clean up

* fix: error when terraform fails to destroy ESS stack

* fix: pass ess_region in terraform destroy

(cherry picked from commit 6918b7b)

# Conflicts:
#	.buildkite/bk.integration-fips.pipeline.yml
mergify bot pushed a commit that referenced this pull request Sep 10, 2025
* fix: specify terraform env var everywhere

* fix: proper env vars for ESS Stack clean up

* fix: error when terraform fails to destroy ESS stack

* fix: pass ess_region in terraform destroy

(cherry picked from commit 6918b7b)
pkoutsovasilis added a commit that referenced this pull request Sep 10, 2025
* fix: ESS stack clean up steps (#9832)

* fix: specify terraform env var everywhere

* fix: proper env vars for ESS Stack clean up

* fix: error when terraform fails to destroy ESS stack

* fix: pass ess_region in terraform destroy

(cherry picked from commit 6918b7b)

# Conflicts:
#	.buildkite/bk.integration-fips.pipeline.yml
#	.buildkite/scripts/steps/ess.ps1

* fix: resolve conflicts

---------

Co-authored-by: Panos Koutsovasilis <[email protected]>
pkoutsovasilis added a commit that referenced this pull request Sep 10, 2025
* fix: specify terraform env var everywhere

* fix: proper env vars for ESS Stack clean up

* fix: error when terraform fails to destroy ESS stack

* fix: pass ess_region in terraform destroy

(cherry picked from commit 6918b7b)

Co-authored-by: Panos Koutsovasilis <[email protected]>
pkoutsovasilis added a commit that referenced this pull request Sep 10, 2025
* fix: specify terraform env var everywhere

* fix: proper env vars for ESS Stack clean up

* fix: error when terraform fails to destroy ESS stack

* fix: pass ess_region in terraform destroy

(cherry picked from commit 6918b7b)

Co-authored-by: Panos Koutsovasilis <[email protected]>
pkoutsovasilis added a commit that referenced this pull request Sep 10, 2025
* fix: ESS stack clean up steps (#9832)

* fix: specify terraform env var everywhere

* fix: proper env vars for ESS Stack clean up

* fix: error when terraform fails to destroy ESS stack

* fix: pass ess_region in terraform destroy

(cherry picked from commit 6918b7b)

# Conflicts:
#	.buildkite/bk.integration-fips.pipeline.yml

* fix: resolve conflicts

---------

Co-authored-by: Panos Koutsovasilis <[email protected]>
intxgo pushed a commit to intxgo/elastic-agent that referenced this pull request Sep 24, 2025
* fix: specify terraform env var everywhere

* fix: proper env vars for ESS Stack clean up

* fix: error when terraform fails to destroy ESS stack

* fix: pass ess_region in terraform destroy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-active-all Automated backport with mergify to all the active branches skip-changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants