terraform workspace new workspace_name
terraform workspace select workspace_name
terraform workspace list
terraform workspace show
terraform plan -var-file dev.tfvars -out=my_plan.tfplan
terraform plan -var-file prod.tfvars -out=my_plan.tfplan
terraform apply my_plan.tfplan
terraform destroy -var-file dev.tfvars
Note: Create and provision the VPC module in order to make it available for the rest of the project.
This is where we can deploy our EC2 instances.
This is to route traffic from the subnets to the Internet Gateway or internally
To find out about the owner for an ami:
- Log into aws console
- Choose an ami from the ec2 catalog
- Click on Images
- Click on Amazon Machine Images (AMIs) --> Public images, paste it and check Owner
Note: In this case, once I run terraform plan from the 6-data_sources.tf file, there are no changes since I'm using dev.tfvars and the ami value is provided there also.
- In the terminal type:
ssh-keygen -t ed25519
- Enter file name by previously copying the path and then give it a proper path+name ei.
/Users/me/.ssh/dev-env-key