Skip to content

Error: Unsupported attribute "region" #1202

@akshat-dubey-lego

Description

@akshat-dubey-lego

Description

Terraform Plan fails even if create_vpc is true and enable_flow_log is set to false.
Error: Unsupported attribute

on .terraform/modules/vpc/vpc-flow-logs.tf line 28, in locals:
28: "arn:${data.aws_partition.current[0].partition}:logs:${data.aws_region.current[0].region}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*"

This object has no argument, nested block, or exported attribute named
"region".

It works till v5.21.0.

  • [ x] ✋ I have searched the open/closed issues and my issue is not listed.

Versions

  • Module version [Required]: v5.21.1

  • Terraform version:

  • Provider version(s): hashicorp/aws v5.100.0

Reproduction Code [Required]

data "aws_availability_zones" "available" {}

locals {
name = "example"
vpc_cidr = "10.20.7.0/25"
azs = slice(data.aws_availability_zones.available.names, 0, 3)
}

module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "~> 5.0"

name = local.name
cidr = local.vpc_cidr
azs = local.azs

public_subnets = ["10.20.7.0/28", "10.20.7.16/28"]
private_subnets = [for k in range(length(local.azs)) : cidrsubnet(local.vpc_cidr, 3, k + 2)]
database_subnets = [for k in range(length(local.azs)) : cidrsubnet(local.vpc_cidr, 3, k + 5)]

enable_nat_gateway = true
create_database_subnet_group = true
}

Steps to reproduce the behavior:

No Yes

terraform init
terraform plan

Expected behavior

VPC should be set up/matched from existing terraform state

Actual behavior

Error: Unsupported attribute

on .terraform/modules/vpc/vpc-flow-logs.tf line 28, in locals:
28: "arn:${data.aws_partition.current[0].partition}:logs:${data.aws_region.current[0].region}:${data.aws_caller_identity.current[0].account_id}:log-group:${log_group.name}:*"

This object has no argument, nested block, or exported attribute named
"region".

Terminal Output Screenshot(s)

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions