terraform-aws-modules / terraform-aws-ecs

Terraform module to create AWS ECS resources 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/ecs/aws
Apache License 2.0
573 stars 542 forks source link

module is incompatible with data resources #219

Closed benkeil closed 2 months ago

benkeil commented 3 months ago

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.

⚠️ 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

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

github-actions[bot] commented 2 months ago

This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days

github-actions[bot] commented 2 months ago

This issue was automatically closed because of stale in 10 days

github-actions[bot] commented 1 month ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.