Terraform Your Cloud Resume Challenge
|Challenge name||Cloud(s)||Challenge goal||Contributor|
|Getting Started with Infrastructure as Code||AWS, Google Cloud, Microsoft Azure||Explain the importance of infrastructure as code and how to scale it in an organization. Deploy an infrastructure resources to the cloud of your choice.||@joatmon08, @ksatirli|
Imagine you created your resume using a cloud provider’s CLI or browser-based console.
- What happens if you accidentally delete the underlying infrastructure for your resume?
- What if you want to change it to a different cloud provider?
How can you reproduce your resume easily if you delete it or want to move it to another cloud provider? When you create your infrastructure resources using a CLI or browser-based Console, you have to spend time remembering the steps to recreate your resume. What settings did you make for your DNS? What name does the storage bucket have?
To solve these problems, you’ll extend your Cloud Resume Challenge project to deploy your resume to the cloud provider of your choice using Infrastructure as Code. Infrastructure as Code captures and deploys the settings you need for your infrastructure in a codified manner. You can use it to quickly reproduce your resume across different cloud providers and make changes to underlying infrastructure.
You will use HashiCorp Terraform to write your Infrastructure as Code and deploy your resume. Terraform is an open source tool widely used to create Infrastructure as Code. You can choose to get the Terraform Associate certification, an introductory certification that orients you on the value of Infrastructure as Code and how HashiCorp Terraform can help you deploy more consistently. You can sit this exam online for USD 70.50. HashiCorp offers tutorials for the Terraform Associate exam.
- Install Terraform.
- An active account (and associated credentials) with AWS, Google Cloud, or Microsoft Azure.
Configure access credentials for your cloud provider’s CLI. These will differ depending on your cloud provider.
Write the Terraform provider configuration for your cloud of choice.
- Terraform providers require access credentials so that Terraform can interact with the API of your provider.
- Optional steps:
- You can provide access credentials either through your system’s environment, or by defining them in the provider configuration block. If you set up your CLI, you do not need to write the credentials in the provider configuration.
- Pin your provider’s version to create a more resilient codebase.
Initialize your working directory with Terraform to download and set up the provider.
Convert your resume’s storage bucket into Terraform configuration. You’ll need to define the Terraform resource for your cloud provider’s storage service. You can find a list of providers and their resources in the Terraform Registry.
The main cloud providers offer the following resources:
Preview the execution plan for Terraform to make changes to your cloud provider. Terraform’s plan should show a storage bucket getting added. You’ll always want to review the plan before making changes.
Once you review the execution plan and are satisfied with the intended changes, apply your change with Terraform to create the storage bucket.
Examine the state file for Terraform, you should find your bucket listed in the file. Terraform uses state to store information about the resources it created and its existence in the cloud provider.
Convert your resume’s HTTPS infrastructure into Terraform configuration. Preview the plan and apply changes to set up HTTPS.
- You can pass the domain name of the storage bucket to your HTTPS infrastructure by referencing the resource attribute in your Terraform configuration.
- You do not have to copy and paste the domain name as a string into your configuration.
Convert your resume’s DNS infrastructure into Terraform configuration. Preview the plan and apply changes to set up DNS.
Convert your resume’s database infrastructure into Terraform configuration. Preview the plan and apply changes to set up database.
Convert your resume’s API (serverless functions and gateway) infrastructure that communicates with the database into Terraform configuration. Preview the plan and apply changes to set up the API.
Change an attribute in a Terraform resource, such as database capacity. Preview the plan and apply changes. Terraform’s plan show that the resource will have a update.
- Destroy your resources with Terraform and re-apply to reproduce your resume infrastructure.
- Create a GitHub repository for your Terraform configuration.
- Automate your Terraform configuration with CI/CD to deploy changes to your resume’s backend infrastructure. For example, you can use Github Actions to control how Terraform applies changes.
- In this challenge, you created new resources for your resume. Try importing your existing backend infrastructure into Terraform management.
- In previous challenges, you might have used AWS CloudFormation or Azure Resource Manager to create your resume with Infrastructure as Code. Try translating your previous configuration to Terraform with the following approaches, from most to least ideal:
Finally, in the text of your resume, you should link a short blog post describing some things while creating your resume’s infrastructure resources with Terraform.