Skip to content

Latest commit

 

History

History

task-001-vars-provider-ec2-dataSources

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

OBJECTIVE :

  • To create an EC2 instance using resource
  • To use the data source aws_ami to get the AMI ID of the instance we want to create

The following commands will be executed.

  • Initialization
$ terraform init -var-file=../../terraform.tfvars
  • Planning
$ terraform plan -var-file=../../terraform.tfvars
...
Plan: 1 to add, 0 to change, 0 to destroy.
...
  • Apply
$ terraform apply -var-file=../../terraform.tfvars
...
Enter a value: yes
...
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
  • Verifying the instance created by logging into the console

  • Destroy
$ terraform destroy -var-file=../../terraform.tfvars
...
  Enter a value: yes
...
Destroy complete! Resources: 1 destroyed.