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

Automated cleanup process should include deleting S3 resources (i.e. TF state files) #499

Open
theipster opened this issue Oct 5, 2024 · 0 comments · May be fixed by #500
Open

Automated cleanup process should include deleting S3 resources (i.e. TF state files) #499

theipster opened this issue Oct 5, 2024 · 0 comments · May be fixed by #500
Labels
enhancement New feature or request

Comments

@theipster
Copy link

theipster commented Oct 5, 2024

Describe the outcome you'd like

Background context: as currently documented, the process of removing an account from AFT involves some manual actions to remove orphaned S3 resources too:

To remove an account from the AFT pipelines

The following procedure describes how to remove an account from AFT.

  1. [...]

  2. [...]

  3. Delete Terraform state from Amazon S3 backend

    In the AFT management account, delete all relevant folders inside of the Amazon S3 buckets for the account that you want to remove from AFT.

    [...]

    Example: Terraform OSS

    When you choose Terraform OSS, you find 3 folders for each account in the aft-backend-012345678901-primary-region and aft-backend-012345678901-secondary-region Amazon S3 buckets. These folders are related to the account customizations state, customizations pipeline state, and global customizations state

    Example: Terraform Cloud or Terraform Enterprise

    When you choose Terraform Cloud or Terraform Enterprise, you find a folder for each account in the aft-backend-012345678901-primary-region and aft-backend-012345678901-secondary-region Amazon S3 buckets. These folders are related to the customizations pipeline state.

Conveniently, AFT already has an aft-cleanup-resources Lambda function (source) that runs at the appropriate lifecycle step, so it would make sense to incorporate the manual step into the Lambda function.

Is your feature request related to a problem you are currently experiencing? If so, please describe.

When removing an account from AFT, additional manual actions must be taken to remove orphaned S3 resources. This is particularly a problem when running AFT at scale.

Additional context

Deleting these S3 resources should be safe and reversible anyway, given that these S3 buckets have versioning enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
1 participant