This Terraform configuration uses a Terraform module "vm_deployment" from the "samuellee-dev" HCP Terraform private module registry to deploy an EC2 instances with the "Terramino" static page
- VPC: Creates a Virtual Private Cloud (VPC) with the specified CIDR block.
- Subnet: Establishes a subnet within the VPC with public IP mapping enabled.
- Internet Gateway: Attaches an internet gateway to the VPC for internet access.
- Route Table: Defines a route table for the VPC with a default route via the internet gateway.
- Route Table Association: Associates the subnet with the route table for external connectivity.
- Security Group: Configures a security group allowing inbound traffic on ports 22 (SSH), 80 (HTTP), and 443 (HTTPS), and all outbound traffic.
- EC2 Instance: Launches an EC2 instance using the latest AMI identified in the
hcp_packer_artifact
data source.
-
Prerequisites:
- Terraform installed locally or in your CI/CD environment.
- AWS credentials configured with sufficient permissions to create the resources defined.
-
Configuration:
- Modify
variables.tf
to adjust parameters such as region, VPC CIDR, subnet CIDR, instance type, etc.
- Modify
-
Deployment:
terraform init terraform apply
Enter 'yes' when prompted to confirm the plan
-
Destroy:
terraform destroy
Enter 'yes' when prompted to confirm the plan
- Ensure AWS credentials are configured and have appropriate permissions.
- Customize variable values in variables.tf to suit your specific requirements before deployment.