terraform-deployment-with-environments-example

An example Terraform project demonstrating continuous deployment pipeline using GitHub Actions' environment function.

MIT License

Stars
5

terraform-deployment-with-environments-example

An example Terraform project demonstrating continuous deployment pipeline using GitHub Actions' environment function.

Overview

  • Deployment workflow runs every time main branch is updated. It first runs terraform plan and require a manual approval. terraform apply will be executed when the job is approved.
  • Preview workflow runs terraform plan for each pull request and comment the plan result. The comment is updated when new commits are added to the pull request.

Prerequisites

  • Create two environments production and production-readonly.
    • Set required reviewers to production environment.
    • Associate credentials which has sufficient permissions to run terraform plan to production-readonly environment.
    • Associate credentials which has sufficient permissions to run terraform apply to production environment.
  • Terraform project is assumed to have a non-local backend to host state files.

References

Related Projects