Hi,
I am using official hashicorp git repo template for Terraform which I am doing in my gitlab using CI pipeline. So far the furthest i came with the aws provider version 4.67 (from version 5+ i am getting tags error).
Validation phase is successful, but i am stopped at the subnets part (i already replaced aws_subnet_ids with the new aws_subnets version) but I keep getting null results for subnets. I have checked, i get VPC data successfully.
*i am using a new fresh region, so all network data is default
My code in main.tf:
data "aws_vpc" "default" {
default = var.vpc_id == null ? true : false
id = var.vpc_id
}
data "aws_subnets" "default" {
filter {
name = "vpc-id"
values = [var.vpc_id]
}
}
data "aws_subnet" "default" {
for_each = data.aws_subnets.default.ids
id = each.value
}
output "subnet_cidr_blocks" {
value = [for s in data.aws_subnet.default : s.cidr_block]
}
Error i keep getting:
│ Error: Null value found in list
│
│ with data.aws_subnets.default,
│ on main.tf line 149, in data "aws_subnets" "default":
│ 149: data "aws_subnets" "default" {
│
│ Null values are not allowed for this attribute value.
I have made some simple terraform configs (mostly for my ESXi VM creation with cloud-config), but this is whole new level
If anyone please has any idea what am I doing wrong.