Back to articles
Terraform Has a Free API: Infrastructure as Code That Manages Everything
How-ToDevOps

Terraform Has a Free API: Infrastructure as Code That Manages Everything

via Dev.to DevOpsAlex Spinov

Why Terraform Terraform by HashiCorp is THE infrastructure-as-code tool. Define cloud resources in HCL, plan changes before applying, and track state. Supports 3,000+ providers — AWS, GCP, Azure, Kubernetes, GitHub, and more. Install brew install terraform Create AWS Resources 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" Environment = "production" } } resource "aws_s3_bucket" "data" { bucket = "my-data-bucket" } Workflow terraform init # Download providers terraform plan # Preview changes terraform apply # Apply changes terraform destroy # Tear down Modules (Reusable Components) module "vpc" { source = "terraform-aws-modules/vpc/aws" version = "5.0.0" name = "production" cidr = "10.0.0.0/16" azs = [ "us-east-1a" , "us-east-1b" ] private_subnets = [ "10.0.1.0/24" , "10.0.2.0/24" ] publi

Continue reading on Dev.to DevOps

Opens in a new tab

Read Full Article
6 views

Related Articles