Error getting folder ID
Closed this issue · 0 comments
glavk commented
For terragrunt code:
include {
path = find_in_parent_folders()
}
locals {
# Load the relevant env.hcl file based on where terragrunt was invoked. This works because find_in_parent_folders
# always works at the context of the child configuration.
folder_vars = read_terragrunt_config(find_in_parent_folders("folder.hcl"))
environment = local.folder_vars.locals.environment
domain = local.folder_vars.locals.domain
folder_id = local.folder_vars.locals.folder_id
labels = {
Owner = "Terraform"
Environment = local.environment
}
}
terraform {
source = "git::https://github.com/terraform-yc-modules/terraform-yc-vpc.git//.?ref=1.0.2"
}
inputs = {
network_name = local.environment
network_description = "network for ${local.domain}"
folder_id = local.folder_id
create_vpc = true
create_nat_gw = true
# default security group
create_sg = false
# subnets for bastion and alb (ingress) only
public_subnets = [
{
"v4_cidr_blocks" : ["10.20.0.0/16"],
"zone" : "ru-central1-a"
}
]
# subnets with single NAT and without public ips
private_subnets = [
{
"v4_cidr_blocks" : ["10.21.0.0/16"],
"zone" : "ru-central1-a"
}
]
# DNS zone for private zone requests
domain_name = local.domain
labels = local.labels
}
I get this plan and error during creation gateway and route table:
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# yandex_vpc_gateway.egress_gateway[0] will be created
+ resource "yandex_vpc_gateway" "egress_gateway" {
+ created_at = (known after apply)
+ folder_id = (known after apply)
+ id = (known after apply)
+ labels = (known after apply)
+ name = "prod-egress-gateway"
+ shared_egress_gateway {}
}
# yandex_vpc_route_table.private[0] will be created
+ resource "yandex_vpc_route_table" "private" {
+ created_at = (known after apply)
+ folder_id = (known after apply)
+ id = (known after apply)
+ labels = (known after apply)
+ name = "prod-private"
+ network_id = "enpd9b1s0561emne88qm"
+ static_route {
+ destination_prefix = "0.0.0.0/0"
+ gateway_id = (known after apply)
}
}
# yandex_vpc_route_table.public[0] will be created
+ resource "yandex_vpc_route_table" "public" {
+ created_at = (known after apply)
+ folder_id = (known after apply)
+ id = (known after apply)
+ labels = (known after apply)
+ name = "prod-public"
+ network_id = "enpd9b1s0561emne88qm"
}
# yandex_vpc_subnet.private["10.21.0.0/16"] will be created
+ resource "yandex_vpc_subnet" "private" {
+ created_at = (known after apply)
+ description = "prod subnet for zone ru-central1-a"
+ folder_id = "b1gr7v5ac923lngsdpvc"
+ id = (known after apply)
+ labels = {
+ "Environment" = "prod"
+ "Owner" = "Terraform"
}
+ name = "private-prod-ru-central1-a:10.21.0.0/16"
+ network_id = "enpd9b1s0561emne88qm"
+ route_table_id = (known after apply)
+ v4_cidr_blocks = [
+ "10.21.0.0/16",
]
+ v6_cidr_blocks = (known after apply)
+ zone = "ru-central1-a"
+ dhcp_options {
+ domain_name = "flowwow.az"
+ domain_name_servers = []
+ ntp_servers = []
}
}
# yandex_vpc_subnet.public["10.20.0.0/16"] will be created
+ resource "yandex_vpc_subnet" "public" {
+ created_at = (known after apply)
+ description = "prod subnet for zone ru-central1-a"
+ folder_id = "b1gr7v5ac923lngsdpvc"
+ id = (known after apply)
+ labels = {
+ "Environment" = "prod"
+ "Owner" = "Terraform"
}
+ name = "public-prod-ru-central1-a:10.20.0.0/16"
+ network_id = "enpd9b1s0561emne88qm"
+ route_table_id = (known after apply)
+ v4_cidr_blocks = [
+ "10.20.0.0/16",
]
+ v6_cidr_blocks = (known after apply)
+ zone = "ru-central1-a"
+ dhcp_options {
+ domain_name = "flowwow.az"
+ domain_name_servers = []
+ ntp_servers = []
}
}
Plan: 5 to add, 0 to change, 0 to destroy.
Changes to Outputs:
+ private_subnets = {
+ "10.21.0.0/16" = {
+ folder_id = "b1gr7v5ac923lngsdpvc"
+ name = "private-prod-ru-central1-a:10.21.0.0/16"
+ subnet_id = (known after apply)
+ v4_cidr_blocks = [
+ "10.21.0.0/16",
]
+ zone = "ru-central1-a"
}
}
+ public_subnets = {
+ "10.20.0.0/16" = {
+ folder_id = "b1gr7v5ac923lngsdpvc"
+ name = "public-prod-ru-central1-a:10.20.0.0/16"
+ subnet_id = (known after apply)
+ v4_cidr_blocks = [
+ "10.20.0.0/16",
]
+ zone = "ru-central1-a"
}
}
yandex_vpc_gateway.egress_gateway[0]: Creating...
yandex_vpc_route_table.public[0]: Creating...
╷
│ Error: Error getting folder ID while creating gateway: cannot determine folder_id: please set 'folder_id' key in this resource or at provider level
│
│ with yandex_vpc_gateway.egress_gateway[0],
│ on main.tf line 56, in resource "yandex_vpc_gateway" "egress_gateway":
│ 56: resource "yandex_vpc_gateway" "egress_gateway" {
│
╵
╷
│ Error: Error getting folder ID while creating route table: cannot determine folder_id: please set 'folder_id' key in this resource or at provider level
│
│ with yandex_vpc_route_table.public[0],
│ on main.tf line 62, in resource "yandex_vpc_route_table" "public":
│ 62: resource "yandex_vpc_route_table" "public" {
│