CloudFormation or Terraform Terraform
✅ Cloud Support and other service support: Opensource, Support multi-clouds, e.g., Azure, GCP, and other services Jenkins, Kubernetes, etc.
✅ Module support: You can create a module to reuse the template.
✅ Command line: Terraform cli has simple syntax(terraform init)
✅ Language support: Support Hashicorp configuration
Ref from : Linkedin
Variables and Outputs
- Input Variables
- Local Values
- Output Values
Terraform Data Types
- Primiive (String, Number, Boolean)
- Collection (List, Set, Map)
- Structural (Tuple, Object)
- S3 Website Hosting
- Cloudfront Distribution
- Route53
- VPC
- EC2
- ECR Docker Image
- ECS Cluster & Service {Fargate}
- ECS Task Definition
- Attach Load Balance to Fargate
- SQS
- IoT Automation
- EKS
- Taint Docker
$ terraform state list
$ terraform state show --
$ terraform show
https://www.pedroalonso.net/blog/using-terraform-to-automate-the-deployment-of-postgresql-to-ec2
- https://towardsaws.com/create-ecs-cluster-using-terraform-7b18a2cbc0ba
- https://medium.com/ci-t/9-steps-to-ssh-into-an-aws-fargate-managed-container-46c1d5f834e2
- https://particule.io/en/blog/cicd-ecr-ecs/ (with Terraform)
- https://webcaptioner.com/blog/2017/12/deploy-from-gitlab-to-aws-fargate/
- https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_passrole.html
- https://www.architect.io/blog/2021-03-30/create-and-manage-an-aws-ecs-cluster-with-terraform/ {Full part}
Terraform Notes:
Open-Source, Declarative and Cloud Agnostic
Idempotency & Consistent
Infrastructure Lifecycle
- Reliability
- Manageability
- Sensibility
Terraform Lifecycle
- code, init, plan, validate, apply, destroy
- graph (For Visualizing Execution Plans) | terraform graph | dot -Tsvg ? graph.svg (Resource Graph)
Terraform Core and Plugins
- Core : RPC (Remote Procedure calls) to communicate with Terraform Plugins
- Plugins: expose an implemtation for a specific service or provisioner
HashiCorp Cloud Platform (Include Terraform as Part of Products)
Terraform Cloud can store state to support Terraform runs on local machines, it works even better as a remote run environment. It supports two main workflows for performing Terraform runs:
VCS-driven workflow
API-driven workflow
Learning : https://developer.hashicorp.com/terraform/tutorials/certification-associate-tutorials/variables https://www.techbeatly.com/hashicorp-certified-terraform-associate-learning-exam-tips/
Terraform Best Practices: https://www.terraform-best-practices.com/