Terraform: Difference between revisions

 
(One intermediate revision by the same user not shown)
Line 23:
 
Source: [https://linoxide.com/devops/install-terraform-provision-aws-ec2-instance/ linoxide.com]
 
 
Create EC2 user under:
Line 39 ⟶ 38:
<pre>
provider "aws" {
access_key = "AKIAJTS6BYLDFVH4QNWAAKIAJTS6BwYereLDFVNWA"
secret_key = "lWjjHcTnaEAmghlWjjHcTnadsEAmgh/fFYpQmSFUCUy9Twv512SIa2vYfFYpQmSFUCUsy9Twvdd5122vY"
region = "us-west-2"
}
 
resource "aws_instance" "aman-ubuntu-terraform-instance" {
ami = "ami-23b34343"
instance_type = "t2.micro"
tags {
Name = "Amanmy-terraform-ubuntu-instance"
}
}
</pre>
 
Provision the instance:
terraform plan
terraform apply
 
Check the instance:
terraform show
 
Remove the Instance:
 
terraform destroy