Lotus AI Logo 

Terraform documentation

Internal terraform documentation for managing infrastructure.

Troubleshooting

Recreate a Resource

You can force the recreation (delete/create or -/+) by using the -replace=ADDRESS argument with terraform plan or terraform apply:

terraform apply -replace=aws_lightsail_instance_public_ports.myserver-sig-public-ports

This replaces the former workflow of terraform taint <resource_address> followed by a plan and apply. If you are using an older version of Terraform, then you would need to use taint instead:

terraform taint aws_lightsail_instance_public_ports.myserver-sig-public-ports

Stack Overflow

Terraform Basics

We use the AWS provider.

Resources are services like EC2 instances, S3 buckets, and VPCs.

Variables and Outputs are used to pass information between resources.

Data Sources are used to fetch information from external sources.

Terraform Commands

terraform init

terraform validate

terraform plan

terraform apply

terraform destroy

Code pipeline & Docker hub

Prefer using images from ecr instead of dockerhub for security reasons.

Gallery


FROM public.ecr.aws/docker/library/node:20-bullseye

Advanced Topics

Modules are used to organize and reuse code.

State Management is the process of storing the state of your infrastructure.

Provisioners are used to execute scripts on resources.

Workspaces are used to manage multiple states of the same infrastructure.

Importing Existing Infrastructure can be done with the terraform import command.