Skip to content
This repository was archived by the owner on Oct 3, 2019. It is now read-only.
This repository was archived by the owner on Oct 3, 2019. It is now read-only.

Legacy numeric index syntax #17

@apparentlymart

Description

@apparentlymart

Due to limitations of HIL, Terraform has for a long time been supporting a weird index syntax using numeric "attributes", like data.alicloud_zones.default.zones.0.id. From HIL's perspective, that all just one long variable name with dots and digits in it.

Our expression parser currently rejects this because 0 is not a valid attribute name. Since identifiers cannot start with zero, it's safe for us to accept this as an alias for data.alicloud_zones.default.zones[0].id, though we may generate a warning in this case because that odd old form is deprecated now that we support proper attribute and index operators.

Error: Invalid attribute name

  on .terraform/init-from-module/root/alibaba-terraform-alicloud-ecs-instance-063c382/main.tf line 33:
  33:   instance_type = "${var.instance_type == "" ? data.alicloud_instance_types.default.instance_types.0.id : var.instance_type}"

An attribute name is required after a dot.

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