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

Chore/1333 replace terraform cloud #1887

Merged
merged 31 commits into from
Feb 14, 2024

Conversation

joshgamache
Copy link
Contributor

@joshgamache joshgamache commented Jan 26, 2024

Addresses #1333 - Project link
Adds Terraform scripts and Helm charts to run them. Resource states migrated from Terraform Cloud to a Google Cloud Storage bucket.

Changes 🚧

  • Added Terraform module, imported from cas-shelf
  • Added Helm templates to handle:
    • Terraform module loading to configMaps
    • OpenShift service account for use by Terraform
    • Terraform apply job

To test 🔬

  • The Helm charts are built into the automation around deploys via ShipIt. Once a deploy has been run, you can check the job Terraform-apply in OpenShift to see if the run was successful.

Notes📝

  • 🔒 Terraform Cloud state has been locked to enable migration of state to state buckets
  • The script has been run and resources have been transitioned from Terraform Cloud to GCP buckets holding state for each namespace (cif-dev, cif-test, cif-prod).
  • Resources have been migrated rather than recreated, only the state "owning" the resource changes.
  • The resources kubernetes_secret.secret_sa have had Terraform changes, but only the addition of a default value (consistent with our use of them) due to a new provider version.
  • The script used for migration (/chart/cas-cif/terraform/tf-migration.sh) is kept here for history. It will be removed by Add directions and script for migration off of Terraform Cloud cas-pipeline#83

@joshgamache joshgamache self-assigned this Jan 26, 2024
@joshgamache joshgamache requested review from Sepehr-Sobhani, dleard, mikevespi and JoshLarouche and removed request for dleard January 26, 2024 22:29
@joshgamache joshgamache added the DevOps For DevOps related issues label Jan 26, 2024
@joshgamache joshgamache marked this pull request as ready for review January 26, 2024 22:52
Copy link
Contributor

@pbastia pbastia 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! A few comments about bash formatting, looks good otherwise.
I'd suggest also:

  • moving tf-migration.sh and migration.example.tfvars out of the helm chart, I don't think there is a to have these in there?
  • move all the terraform yaml templates to chart/cas-cif/templates/terraform instead of the jobs folder

chart/cas-cif/templates/jobs/terraform-apply.yaml Outdated Show resolved Hide resolved
chart/cas-cif/templates/jobs/terraform-apply.yaml Outdated Show resolved Hide resolved
@joshgamache
Copy link
Contributor Author

joshgamache commented Jan 30, 2024

  • moving tf-migration.sh and migration.example.tfvars out of the helm chart, I don't think there is a to have these in there?
  • move all the terraform yaml templates to chart/cas-cif/templates/terraform instead of the jobs folder

I cleaned up the directories with the suggestions you made. Especially with the service account related file split, it keeps them consistently together.

I removed the migration script entirely, as it is unneeded now that the migrations have been run.

@joshgamache joshgamache requested a review from pbastia January 30, 2024 18:48
Copy link
Contributor

@pbastia pbastia left a comment

Choose a reason for hiding this comment

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

Slick!

@joshgamache joshgamache linked an issue Feb 5, 2024 that may be closed by this pull request
3 tasks
Copy link
Contributor

@mikevespi mikevespi left a comment

Choose a reason for hiding this comment

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

Awesome stuff! Leaving it Approved but not merged as per discussion today about merging with eyes on. Aside from that let's make sure we get a tech-debt card to create custom GCP role instead of their generic admin, they over permit.

Great stuff!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DevOps For DevOps related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tech Debt: Remove dependency on Terraform Cloud and cas-shelf
4 participants