Skip to content

Terraform syntax warnings do not check data source or output blocks #25828

@gdavison

Description

@gdavison

The terraform init and terraform validate commands output syntax warnings for deprecated interpolation syntax for resources, but do not return warnings when the deprecated interpolation is on data source or output blocks.

Terraform Version

This error occurs in both 0.12 and 0.13

$ terraform version
Terraform v0.12.29
+ provider.aws v3.1.0
$ terraform version
Terraform v0.13.0
+ provider registry.terraform.io/hashicorp/aws v3.1.0

Terraform Configuration Files

variable "api_gateway_name" {
  type = string
}

data "aws_api_gateway_rest_api" "selected" {
  name = "${var.api_gateway_name}"
}

data "aws_cognito_user_pools" "selected" {
  name = "selected"
}

resource "aws_api_gateway_authorizer" "cognito" {
  name          = "cognito"
  type          = "COGNITO_USER_POOLS"
  rest_api_id   = "${data.aws_api_gateway_rest_api.selected.id}"
  provider_arns = data.aws_cognito_user_pools.selected.arns
}

output "api_id" {
  value = "${aws_api_gateway_authorizer.cognito.rest_api_id}"
}

Expected Behavior

The warning

Warning: Interpolation-only expressions are deprecated

should be generated for

  • data source aws_api_gateway_rest_api.selected name
  • resource aws_api_gateway_authorizer.cognito rest_api_id
  • output api_id value

Actual Behavior

The warning

Warning: Interpolation-only expressions are deprecated

is only generated for

  • resource aws_api_gateway_authorizer.cognito rest_api_id

Steps to Reproduce

  1. terraform init
  2. (Optionally) terraform validate

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugexplaineda Terraform Core team member has described the root cause of this issue in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions