Skip to content

cloudzero-aws: data.aws_region.current.name is deprecated in AWS provider v6 #111

Description

@stk0vrfl0w

We consume the cloudzero-aws module for the cross-account IAM role and supply
our own CUR, so we set cur_bucket_name and leave create_cur at its default.
With the AWS provider on v6, every plan picks up two deprecation warnings out of
terraform/cloudzero-aws/cur.tf:

Warning: Deprecated attribute

  on .terraform/modules/cloudzero/terraform/cloudzero-aws/cur.tf line 162, in resource "aws_cur_report_definition" "cloudzero":
 162:   s3_region                  = data.aws_region.current.name

The attribute "name" is deprecated. Refer to the provider documentation for
details.

There are two references, both to data.aws_region.current.name:

  • line 162, the s3_region argument on aws_cur_report_definition.cloudzero
  • line 171, the us-east-1 precondition

The AWS provider renamed that attribute to region in v6, so .region looks
like a drop-in replacement. versions.tf declares aws >= 5.0, which permits
v6, so anyone already on the v6 line sees this.

The part that makes it a little awkward from outside the module is that the
warnings appear even when create_cur is false. Terraform still evaluates the
attribute reference for deprecation regardless of the resource's count, so a
consumer who only wants the IAM role and brings their own CUR bucket gets both
warnings on every plan, and there is no way to suppress them from the calling
module. It is cosmetic, but it trains people to skim past plan warnings, which
we would rather avoid.

Thanks!

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