airbnb / streamalert

StreamAlert is a serverless, realtime data analysis framework which empowers you to ingest, analyze, and alert on data from any environment, using datasources and alerting logic you define.
https://streamalert.io
Apache License 2.0
2.86k stars 334 forks source link

Resolve TF 12 error #1251

Closed gavinelder closed 4 years ago

gavinelder commented 4 years ago

to: cc: @airbnb/streamalert-maintainers related to: resolves:

Background

The following resolves an error in TF application as per https://github.com/hashicorp/terraform/issues/22480#issuecomment-521762472

Error: Unsupported attribute

  on modules/tf_lambda/iam.tf line 24, in resource "aws_iam_role_policy_attachment" "lambda_basic_policy":
  24:   role       = aws_iam_role.role.id
    |----------------
    | aws_iam_role.role is empty tuple

This value does not have any attributes.

Error: Unsupported attribute

  on modules/tf_lambda/iam.tf line 24, in resource "aws_iam_role_policy_attachment" "lambda_basic_policy":
  24:   role       = aws_iam_role.role.id
    |----------------
    | aws_iam_role.role is empty tuple

This value does not have any attributes.

Changes

Add relevant tf12 compatibale count.index for use in the count statement.

Testing

The following was tested and applied locally and used to deploy the latest 3.2.1 version tag.

chunyong-lin commented 4 years ago

hi @gavinelder have you figured out what's the issue? I see you closed this PR and want to make sure nothing block you.

gavinelder commented 4 years ago

@chunyong-lin it looks like I am trying to solve a TF State migration issue, the changes to the Lambda TF module changes the resource index so is failing on an apply.

By carrying targetted appplies this can be resolved.