Skip to content

Must use splat syntax to access X, because it has "count" set #6

Description

@slmingol

With the following module setup I'm getting a failure:

Warning: output "log_group_arn": must use splat syntax to access aws_cloudwatch_log_group.default attribute "arn", because it has "count" set; use aws_cloudwatch_log_group.default.*.arn to obtain a list of the attributes across all instances

Warning: output "vpc_flow_id": must use splat syntax to access aws_flow_log.vpc attribute "id", because it has "count" set; use aws_flow_log.vpc.*.id to obtain a list of the attributes across all instances

Warning: output "kinesis_id": must use splat syntax to access aws_kinesis_stream.default attribute "id", because it has "count" set; use aws_kinesis_stream.default.*.id to obtain a list of the attributes across all instances

Warning: output "kinesis_name": must use splat syntax to access aws_kinesis_stream.default attribute "name", because it has "count" set; use aws_kinesis_stream.default.*.name to obtain a list of the attributes across all instances

Warning: output "kinesis_shard_count": must use splat syntax to access aws_kinesis_stream.default attribute "shard_count", because it has "count" set; use aws_kinesis_stream.default.*.shard_count to obtain a list of the attributes across all instances

Warning: output "kinesis_arn": must use splat syntax to access aws_kinesis_stream.default attribute "arn", because it has "count" set; use aws_kinesis_stream.default.*.arn to obtain a list of the attributes across all instances

If I follow the suggestions for the above it then seems to work.

Here's my flow_logs module:

module "flow_logs" {
  source    									= "git::https://github.com/cloudposse/terraform-aws-cloudwatch-flow-logs.git?ref=master"
  vpc_id    									= "${var.vpc_id}"
  namespace 									= "${var.ns}"
  stage     									= "${var.env}"
}

If I update the outputs.tf for flog_logs like so it then appears to work:

output "log_group_arn" {
  value       = "${aws_cloudwatch_log_group.default.*.arn}"
  description = "ARN of the log group"
}

output "vpc_flow_id" {
  value       = "${aws_flow_log.vpc.*.id}"
  description = "Flow Log IDs of VPCs"
}

output "subnet_flow_ids" {
  value       = "${aws_flow_log.subnets.*.id}"
  description = "Flow Log IDs of subnets"
}

output "eni_flow_ids" {
  value       = "${aws_flow_log.eni.*.id}"
  description = "Flow Log IDs of ENIs"
}

output "kinesis_id" {
  value       = "${aws_kinesis_stream.default.*.id}"
  description = "Stream ID"
}

output "kinesis_name" {
  value       = "${aws_kinesis_stream.default.*.name}"
  description = "Stream name"
}

output "kinesis_shard_count" {
  value       = "${aws_kinesis_stream.default.*.shard_count}"
  description = "Count of Shards for Stream"
}

output "kinesis_arn" {
  value       = "${aws_kinesis_stream.default.*.arn}"
  description = "ARN of Stream"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions