terraform-aws-ecs icon indicating copy to clipboard operation
terraform-aws-ecs copied to clipboard

module is incompatible with data resources

Open benkeil opened this issue 1 year ago β€’ 0 comments

Description

Please provide a clear and concise description of the issue you are encountering, and a reproduction of your configuration (see the examples/* directory for references that you can copy+paste and tailor to match your configs if you are unable to copy your exact configuration). The reproduction MUST be executable by running terraform init && terraform apply without any further changes.

If your request is for a new feature, please use the Feature request template.

  • [x] βœ‹ I have searched the open/closed issues and my issue is not listed.

⚠️ Note

Before you submit an issue, please perform the following first:

  1. Remove the local .terraform directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!): rm -rf .terraform/
  2. Re-initialize the project root to pull down modules: terraform init
  3. Re-attempt your terraform plan or apply and check if the issue still persists

Versions

  • Module version [Required]: 5.11.4

Reproduction Code [Required]

When using cdktf, the tasks_iam_role_statements variable (and probably all others statement iam variables too) are incompatible with by cdktf generated data resources.

builder.tasksIamRoleStatements(listOf(DataAwsIamPolicyDocumentStatement.builder()
    .effect("Allow")
    ...
    .condition(listOf(...))
    .build()))

The problem is, that part:

dynamic "condition" {
  for_each = try(statement.value.conditions, [])

  content {
    test     = condition.value.test
    values   = condition.value.values
    variable = condition.value.variable
  }
}

which looks for conditions instead of condition.

Expected behavior

Use condition instead of conditions to make it interact with cdktf.

Actual behavior

You need to manually map all statements.

Terminal Output Screenshot(s)

Additional context

benkeil avatar Aug 20 '24 14:08 benkeil