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

[Question]: Best practice for "terraform apply -auto-approve" in CI/CD #30

Open
reza-mirjahanian opened this issue Jan 19, 2024 · 0 comments
Labels
question Further information is requested

Comments

@reza-mirjahanian
Copy link

reza-mirjahanian commented Jan 19, 2024

Using terraform apply -auto-approve in a CI/CD pipeline is generally not recommended as a best practice. The -auto-approve flag bypasses the interactive approval of the plan before applying it. This means that changes to your infrastructure could be made without manual review, which could potentially lead to unintended modifications or even destructive actions.

However, in the continuous integration and continuous deployment (CI/CD) process (like Github Actions) we make everything automatic, which is a key part of CI/CD. There is no opportunity for interactive questions or human reviews. Could you guide me on how I should combine these concepts? Ideally, could you provide a sample code snippet in Github Actions or something similar as an example?

      - name: Terraform Apply
        run: terraform apply -auto-approve
        env:
          TF_VAR_aws_s3_bucket: ${{ secrets.AWS_S3_BUCKET }}
          TF_VAR_aws_region: ${{ secrets.AWS_REGION }}
          TF_VAR_jwtSecret: ${{ secrets.JWT_SECRET }}
@reza-mirjahanian reza-mirjahanian added the question Further information is requested label Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant