aws-samples / serverless-jenkins-on-aws-fargate

MIT No Attribution
122 stars 111 forks source link

Error: An argument named "capacity_providers" is not expected here. #37

Open apikhtovnikov opened 6 months ago

apikhtovnikov commented 6 months ago

Hi Team,

Please advise:

╷ │ Error: Unsupported attribute │ │ on main.tf line 45, in module "serverless_jenkins": │ 45: alb_acm_certificate_arn = module.acm.this_acm_certificate_arn │ ├──────────────── │ │ module.acm is a object │ │ This object does not have an attribute named "this_acm_certificate_arn". ╵ ╷ │ Error: Unsupported argument │ │ on ..\modules\jenkins_platform\ecs.tf line 4, in resource "aws_ecs_cluster" "jenkins_controller": │ 4: capacity_providers = ["FARGATE"] │ │ An argument named "capacity_providers" is not expected here. ╵ ╷ │ Error: Unsupported argument │ │ on ..\modules\jenkins_platform\ecs.tf line 14, in resource "aws_ecs_cluster" "jenkins_agents": │ 14: capacity_providers = ["FARGATE_SPOT"] │ │ An argument named "capacity_providers" is not expected here.

cmccartin commented 5 months ago

It looks like the terraform ecs resources have changed.

Here's what I changed in modules/jenkins_platform/ecs.tf:

resource "aws_ecs_cluster" jenkins_controller {
  name               = "${var.name_prefix}-main"
  tags               = var.tags
  setting {
    name = "containerInsights"
    value = "enabled"
  }
}

resource "aws_ecs_cluster_capacity_providers" "jenkins_controller" {
  cluster_name = "${var.name_prefix}-main"
  capacity_providers = ["FARGATE"]

  default_capacity_provider_strategy {
    capacity_provider = "FARGATE"
  }

}

resource "aws_ecs_cluster" jenkins_agents {
  name               = "${var.name_prefix}-spot"
  tags               = var.tags
  setting {
    name = "containerInsights"
    value = "enabled"
  }
}

resource "aws_ecs_cluster_capacity_providers" "jenkins_agents" {
  cluster_name = "${var.name_prefix}-spot"
  capacity_providers = ["FARGATE_SPOT"]

  default_capacity_provider_strategy {
    capacity_provider = "FARGATE_SPOT"
  }

}