My terraform files for provisioning an AWS EC2 instance with Docker CE running in CentOS 7
Important:
You have to create an AWS credentials with all permission for create EC2 instance, Security Groups, Elastic IP, EBS, VPC, Subnet, Internet Gateway and NAT Gateway.
In your AWS credentials file, section profile, you have to write the same value that you set to in name
variable:
~/.aws/credentials:
[standalone-server]
aws_access_key_id =
aws_secret_access_key =
variables.tf:
variable "name" {
default = "standalone-server"
}
terraform init
terraform plan -out tfplan -input=false
terraform apply -input=false tfplan
By default AWS Elastic IP Address assign is disable, if you want to enable an Elasitc IP, run:
terraform plan -out tfplan -input=false -var 'elastic_ip=true'
terraform apply -input=false tfplan
By default AWS NAT Gateway is disable, if you want to enable a NAT Gateway, please run:
terraform plan -out tfplan -input=false -var 'enable_nat_gateway=true'
terraform apply -input=false tfplan
terraform plan -destroy -out destroy.plan
terraform apply "destroy.plan"
This is a terraform files that have been created for deployment of EC2 instance with Docker CE running in CentOS 7 x86_64.
We welcome contributions! If you have an idea or contribution that might improve this repository, see CONTRIBUTING for more information on how to get started. Questions are also welcome (as issues). We gladly credit all contributors.