![]() 1 workflow will run Terraform Apply manually/on demand. Create 2x GitHub Action YAML workflow files - 1 workflow will run Terraform Plan automatically on push/pull request events.Store the API Token as a secret in GitHub.Create an API Token for Terraform Cloud.Update our Terraform main.tf file to use Terraform Cloud as the remote backend.Set the Service Principal connection details as environment variables in Terraform Cloud.To implement this example solution architecture we’ll need to: Here’s a simple diagram that shows a bird’s eye view. The key underlying message I want to share is the concept of an automated ‘Infrastructure as Code’ workflow from any source control to any cloud and the benefits you gain. Note: Although my solution above uses some specific platforms/products - they’re all interchangeable. Target cloud environment: Microsoft Azure.Terraform remote backend: Terraform Cloud.Workflow automation: GitHub Actions and HashiCorp’s GitHub Action (setup-terraform).Source control: GitHub private repository.So my example solution architecture for today’s blog looks like this: Back in 2018, HashiCorp’s Terraform team jumped onboard to release hashicorp/terraform-github-actions and as of May 2020 have released hashicorp/setup-terraform. Quick background - GitHub Actions (GHA) has continually evolved since it’s public beta in late 2018 to the workflow automation tool we know today. If you’re interested in using Azure DevOps check out Terraform with Azure DevOps by my colleague Santhosh Kumar. In this blog I’m going to take you through the 4th option – deploy using GitHub Actions. Which option you select above depends on many factors such as where your code is stored and the CI/CD platform features you might need. Deploy using Terraform Cloud/Enterprise.Now overall there’s multiple solutions available to leverage when deploying your Terraform code to a cloud environment. Using GitHub Actions and Terraform to achieve an automated ‘Infrastructure as Code’ (IaC) workflow helps to reduce the possibility of human error and ensures our deployment time is kept minimal. Using GitHub Actions and Terraform for IaC Automation
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |