Infrastructure as Code (IAC) project, creating basic resources and advancing to more complex structures. Datasources, modules, and outputs were covered to facilitate maintenance. Cluster state management was also applied, and multiple providers were configured to create additional resources.
The purpose is to use Cloud Providers' consoles only for reading and to pass through IAC for any resource changes, keeping what is in code as the single source of truth. And to automate infrastructure across any Cloud Provider.
- Terraform
- AWS
- Google Cloud Platform
- Azure
- Providers
- Modules
- Outputs
- Datasources
- Variables
- tf.state
- Workspaces
- Versioning
- Remote Backend
- Clone the project and access the directory
$ git clone https://github.com/luc-ribeiro/iac-terraform-devops.git
$ cd
-
Choose the Cloud Provider and install its respective CLI:
-
Log in to your Cloud Provider via CLI:
# GCP
$ gcloud auth application-default login
# Azure
$ az login
- To use AWS:
- You need to configure an SSO token in the console (Identity and Access Management);
- Create a user and set its permissions;
- Execute the command below and log in via the browser:
# AWS
$ aws configure sso
- Running Terraform, in the directory of the chosen Cloud Provider:
# Initialize Terraform
$ terraform init
# Validate if the HCL syntax is correct
$ terraform validate
# Validate what will be created and what the final outcome will be
$ terraform plan
# Create or alter resource in the infrastructure
$ terraform apply