Skip to content

HimakarC/Terraform

Repository files navigation

#Terraform

To install Terraform in Linux:


--> wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
--> echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
--> sudo apt update
--> sudo apt-get install terraform

To use the terraform, you need to configure your aws account using Access Key ID and Access secret ID

Using Terraform

After installing Terraform:

--> Create a file with .tf extension.
--> Now write the script i.e commands to create EC2, Virtual Network, etc...
--> Use the command terraform init to preapre the working file where scripting is written.

#Script:

provider "aws"
{ profile = "default" region = "us-east-1" }

resource "aws_instance" "example" { ami = "ami-2757f631" instance_type = "t2.micro" }

--> Now use the command terraform plan to plan the changes to the aws account.

--> Now finally use the command terraform apply to perform the operation written in script.

About

Terraform

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages