Terraform 1.4.3: how to to Set Up Custom VPC Peering with Variable CIDR Blocks in AWS
I can't seem to get Could someone explain I've been banging my head against this for hours. I've been struggling with this for a few days now and could really use some help. I'm having trouble setting up a VPC peering connection in AWS using Terraform 1.4.3. I've defined two VPCs with variable CIDR blocks, but when I try to create the peering connection, I get an behavior stating `"behavior: VPC Peering Connection (pcx-xxxxxx) does not exist"`. I've ensured that both VPCs are in the same region, but I keep hitting this wall. Here's a snippet of my configuration: ```hcl variable "vpc1_cidr" { default = "10.0.0.0/16" } variable "vpc2_cidr" { default = "10.1.0.0/16" } resource "aws_vpc" "vpc1" { cidr_block = var.vpc1_cidr tags = { Name = "VPC1" } } resource "aws_vpc" "vpc2" { cidr_block = var.vpc2_cidr tags = { Name = "VPC2" } } resource "aws_vpc_peering_connection" "peer" { vpc_id = aws_vpc.vpc1.id peer_vpc_id = aws_vpc.vpc2.id } ``` I've tried running `terraform apply` multiple times, but the behavior continues. I've also verified that both VPCs are created successfully before the peering connection is defined by checking the AWS console. Additionally, I tried using explicit references for the VPC IDs without success. Can anyone suggest what might be going wrong or if there's something I'm missing in the setup? This is part of a larger web app I'm building. Thanks in advance! Hoping someone can shed some light on this. This is happening in both development and production on Linux. How would you solve this? Any examples would be super helpful. Thanks in advance!