When we comment it out in both places it prompts us to ask for the region and keys
although, we do have the region and keys in terraform.tfvars
commenting it out in both places is for putting the region and keys in environment variables
If we put those in environment variables and run terraform plan we get these errors now. Well the overall network is 10.4.0.0/16 we want several 24 bit subnets.
╷
│ Warning: Redundant empty provider block
│
│ on ../gateway/main.tf line 1:
│ 1: provider "aws" {
│
│ Earlier versions of Terraform used empty provider blocks ("proxy provider configurations") for child modules to declare their need to be passed a provider configuration by their callers. That approach was ambiguous and is now
│ deprecated.
│
│ If you control this module, you can migrate to the new declaration syntax by removing all of the empty provider "aws" blocks and then adding or updating an entry like the following to the required_providers block of
│ module.launch_gateway_into_vpc:
│ aws = {
│ source = "hashicorp/aws"
│ }
╵
╷
│ Error: Error in function call
│
│ on ../modules/vpc/main.tf line 17, in resource "aws_subnet" "public_subnets":
│ 17: cidr_block = cidrsubnet(aws_vpc.vpc.cidr_block, var.subnets_bit_length, each.value)
│ ├────────────────
│ │ while calling cidrsubnet(prefix, newbits, netnum)
│ │ aws_vpc.vpc.cidr_block is "10.4.0.0/16"
│ │ each.value is "1"
│ │ var.subnets_bit_length is 24
│
│ Call to function "cidrsubnet" failed: insufficient address space to extend prefix of 16 by 24.
╵
╷
│ Error: Error in function call
│
│ on ../modules/vpc/main.tf line 30, in resource "aws_subnet" "private_subnets":
│ 30: cidr_block = cidrsubnet(aws_vpc.vpc.cidr_block, var.subnets_bit_length, each.value)
│ ├────────────────
│ │ while calling cidrsubnet(prefix, newbits, netnum)
│ │ aws_vpc.vpc.cidr_block is "10.4.0.0/16"
│ │ each.value is "2"
│ │ var.subnets_bit_length is 24
│
│ Call to function "cidrsubnet" failed: insufficient address space to extend prefix of 16 by 24