Environment to practice IAC for AWS
git clone [email protected]:EE-Squads-AWS/ACG-Playground-Terraform.git
variable "aws_access_key" {
description = "The AWS Access Key"
default = "**************************"
}
variable "aws_secret_key" {
description = "The AWS Secret Key"
default = "**************************"
}
Alternatively use the Python script 'acg.py' which recursively creates a terraform.secret.tf file in the layer subdirectories
Example
python3 acg.py --access 123456789 --secret 123456789abcdefghijklmnopqrstuvwxyz
To apply a layer change your directory to the layer ie ./Terraform/layers/000base and run 'terraform apply'
You don't have to apply all layers, just the 000base layer and any subsequent layer listed in the 'Required layers' section in the main.tf file
A Cloud Guru doesn’t count playground use as activity so your account may end up being marked as ‘inactive’ if you aren’t doing courses/labs.
If you don't destroy your resources you may need to run a 'terraform state rm' next apply when using new access keys in ACG
module.vpc_basenetwork.aws_nat_gateway.natgw[0]: Creating...
╷
│ Error: error creating EC2 NAT Gateway: NotAvailableInZone: Nat Gateway is not available in this availability zone
│ status code: 400, request id: 4fd10fdc-bf3c-453a-8dc3-8e97667b2f94
│
│ with module.vpc_basenetwork.aws_nat_gateway.natgw[0],
│ on ../../modules/vpc_basenetwork/main.tf line 128, in resource "aws_nat_gateway" "natgw":
│ 128: resource "aws_nat_gateway" "natgw" {
│ Error: error modifying EC2 Subnet (subnet-01cf6852519754003) MapPublicIpOnLaunch: InvalidParameterValue: invalid value for parameter map-public-ip-on-launch: true
│ status code: 400, request id: 7f397919-6077-441f-8be6-9216c747cc1e
│
│ with module.vpc_basenetwork.aws_subnet.subnet_public[1],
│ on ../../modules/vpc_basenetwork/main.tf line 78, in resource "aws_subnet" "subnet_public":
│ 78: resource "aws_subnet" "subnet_public" {
│ Error: Error fetching Availability Zones: UnauthorizedOperation: You are not authorized to perform this operation.
│ status code: 403, request id: 805c4f7d-724e-499c-850d-cebeb26bb2ff
│
│ with module.base_vpc.data.aws_availability_zones.available,
│ on ../../modules/vpc_basenetwork/main.tf line 12, in data "aws_availability_zones" "available":
│ 12: data "aws_availability_zones" "available" {
│