Create a terraform environment environment for db-benchmarking
Steps taken from: https://ops.gitlab.net/gitlab-com/gitlab-com-infrastructure#creating-a-new-environment
Part of https://gitlab.com/gitlab-com/gl-infra/infrastructure/-/issues/12113
-
Follow the instructions in environments/env-projects/README.md to create or import a GCP project: https://ops.gitlab.net/gitlab-com/gitlab-com-infrastructure/-/merge_requests/2245 -
In the production GitLab AWS account, create a new IAM user terraform-$ENVwith programmatic access. Direct attach a new custom policy (named the same as the user) modeled on the existingterraform-$ENVusers (basicallys3:ListBucketfor thegitlab-com-infrastructurebucket, ands3:*forgitlab-com-infrastructure/terraform/$ENV, but it is best to copy/paste/edit one of the existing policies, changing the path in the second stanza -
Create a 1password entry "terraform-private/env_vars/$ENV.env" in the production vault. It should contain AWS IAM env var declarations for the credentials generated in the previous step. -
In gitlab-com-infrastructure, run tf-get-secrets(it's in./bin, which is always on$PATHin order to properly interact with this repo). The new env file should be downloaded. You should now be able to runtf init -upgradeinenvironments/$ENVand plan/apply. -
Create CI env vars for the new environment: -
Entries for each var in the private/env-varsfile, including the AWS credentials. -
A file entry with key GCLOUD_TERRAFORM_PRIVATE_KEY_JSONwhose value is the contents of the private key file created for theterraform-ciuser previously.
-
-
Add a section to .gitlab-ci.ymlfor the new environment. Look to existing entries for inspiration: https://ops.gitlab.net/gitlab-com/gitlab-com-infrastructure/-/merge_requests/2246 -
CI should now plan (and eventually apply) plans for the new environment.