Terraform Notes – Day 3 – 20 Sept 2023

DevOps

MOTOSHARE 🚗🏍️
Turning Idle Vehicles into Shared Rides & Earnings

From Idle to Income. From Parked to Purpose.
Earn by Sharing, Ride by Renting.
Where Owners Earn, Riders Move.
Owners Earn. Riders Move. Motoshare Connects.

With Motoshare, every parked vehicle finds a purpose. Owners earn. Renters ride.
🚀 Everyone wins.

Start Your Journey with Motoshare

Terraform Slides

https://devopsschool.com/slides/terraform/index.html

How to set Condition in terraform?

Dependency mgmt
	- implicit - Set by Providers
	- explicit - deponds_on

deponds_on
	
	explicitCode language: JavaScript (javascript)

How to loop or iterate in terraform?

Workspace

How to pass diff values to diff env using diff workspace?

Step 1 - Create terrafrom.tfvars [ Default Workspace ]

tagsvalue = "this-is-default"
numofecc2 = 20
cpu = 2
dbcpu = 6
appcpu =4
azs = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]

Step 2 - Create qa.tfvars

tagsvalue = "this-is-qa"
numofecc2 = 5
dbcpu = 4
appcpu = 2
azs = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]

Step 3 - Go to default workspace
$ terraform workspace select default
$ terraform apply --auto-approve [ Loading - terrafrom.tfvars and This would store state file in terraform.tfstate ] 

Step 4 - Go to qa workspace
$ terraform workspace select qa
$ terraform apply --auto-approve -var-file="qa.tfvars" [ This would store state file in terraform.tfstate.d/qa.terraform.tfstate ]


qa.tfvars	[ HIGH PRE]
terrafrom.tfvars   [ LOW PRE]Code language: PHP (php)

Terraform Meta Aruguments

connection {
  type        = "winrm"
  host        = aws_instance.example.private_ip
  user        = "Administrator"
  password    = "your_password"
  https       = true  # Enable HTTPS
  insecure    = true  # Ignore SSL certificate validation (for testing purposes, not recommended in production)
  port        = 5986  # Use the default HTTPS port for WinRM
  cacert      = "/path/to/ca.crt"  # Optional path to a CA certificate file (if required)
  cert        = "/path/to/client.crt"  # Optional path to a client certificate file (if required)
  key         = "/path/to/client.key"  # Optional path to the client certificate's private key file (if required)
  timeout     = "5m"  # Set a timeout for the WinRM connection
  max_retries = 3     # Maximum number of connection retries
}
Code language: PHP (php)
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x