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

Make sure only the correct user can update the terraform state #2046

Open
kencho51 opened this issue Oct 2, 2024 · 0 comments
Open

Make sure only the correct user can update the terraform state #2046

kencho51 opened this issue Oct 2, 2024 · 0 comments

Comments

@kencho51
Copy link
Contributor

kencho51 commented Oct 2, 2024

User story

As a developer
I want to make sure the correct AWS resources is used by terraform when provisioning a new envirionment
So that we don't have incorrect resources (IAM users) used in the wrong environment

Acceptance Criteria

Given I am provisioning a new infrastructure for Upstream project
When initialise terraform for an environment
Then the correct resources should be save in the terraform states

Additional infos

Is your feature request related to a problem? Please describe.

gigadb-upstream-alt-$user was found in the upstream terraform state file, which should be prohibited.

Describe the solution you'd like
A clear and concise description of what you want to happen.

Perform checking/validation tf_init.sh step, could be in this block:

terraform init \
          -backend-config="address=https://gitlab.com/api/v4/projects/$encoded_gitlab_project/terraform/state/${target_environment}_infra" \
          -backend-config="lock_address=https://gitlab.com/api/v4/projects/$encoded_gitlab_project/terraform/state/${target_environment}_infra/lock" \
          -backend-config="unlock_address=https://gitlab.com/api/v4/projects/$encoded_gitlab_project/terraform/state/${target_environment}_infra/lock" \
          -backend-config="username=$GITLAB_USERNAME" \
          -backend-config="password=$GITLAB_PRIVATE_TOKEN" \
          -backend-config="lock_method=POST" \
          -backend-config="unlock_method=DELETE" \
          -backend-config="retry_wait_min=5"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: To Estimate
Development

No branches or pull requests

2 participants