Back to articles
Terraform Has a Free API — Here's How to Manage Cloud Infrastructure as Code
How-ToDevOps

Terraform Has a Free API — Here's How to Manage Cloud Infrastructure as Code

via Dev.to DevOpsAlex Spinov

Terraform by HashiCorp lets you define cloud infrastructure using declarative configuration files. It supports AWS, GCP, Azure, and 3,000+ providers — all free and open source. Installation brew install terraform # or download from terraform.io Basic AWS Setup # main.tf terraform { required_providers { aws = { source = "hashicorp/aws" version = "~> 5.0" } } } provider "aws" { region = "us-east-1" } resource "aws_instance" "web" { ami = "ami-0c55b159cbfafe1f0" instance_type = "t3.micro" tags = { Name = "web-server" } } output "public_ip" { value = aws_instance . web . public_ip } Workflow terraform init # Download providers terraform plan # Preview changes terraform apply # Apply changes terraform destroy # Remove all resources Variables # variables.tf variable "instance_type" { description = "EC2 instance type" type = string default = "t3.micro" } variable "environment" { type = string validation { condition = contains ([ "dev" , "staging" , "prod" ], var . environment ) error_message

Continue reading on Dev.to DevOps

Opens in a new tab

Read Full Article
7 views

Related Articles