Description
Describe the Bug
I am encountering an "Invalid count argument" error when using the Cloud Posse module for codepipeline. The error occurs in the data "aws_iam_policy_document" "codestar" block.
│ Error: Invalid count argument │ │ on .terraform/modules/codepipeline_frontend/main.tf line 185, in data "aws_iam_policy_document" "codestar": │ 185: count = local.codestar_enabled ? 1 : 0 │ │ The "count" value depends on resource attributes that cannot be determined until apply, so Terraform cannot predict how many instances will be created. To work around this, use the -target argument to first apply only the resources that the count depends on.
Expected Behavior
Terraform should be able to evaluate the count
argument without errors.
Steps to Reproduce
Steps to Reproduce
- Use the Cloud Posse module for
codepipeline
use the codestar connection ARN. - Set up the module with the necessary variables and resources.
- Run
terraform plan
.
Screenshots
No response
Environment
- WSL 2 on windows 11
Additional Context
code:
module "codepipeline_frontend" { source = "cloudposse/ecs-codepipeline/aws" codestar_connection_arn = aws_codestarconnections_connection.github_connection.arn branch = var.github_branch repo_name = var.frontend_github_repo_name region = var.region ecs_cluster_name = module.ecs_cluster.cluster_name image_repo_name = var.frontend_github_repo_name repo_owner = var.github_username service_name = "frontend" s3_bucket_force_destroy = true depends_on = [module.ecs_cluster,aws_codestarconnections_connection.github_connection] webhook_enabled = false codestar_output_artifact_format = "CODEBUILD_CLONE_REF" cache_type = "NO_CACHE" }