cn-terraform / terraform-aws-ecs-fargate

AWS ECS Fargate Terraform Module
https://registry.terraform.io/modules/cn-terraform/ecs-fargate
Apache License 2.0
87 stars 57 forks source link

Defauting to https when not using https #14

Closed advissor closed 3 years ago

advissor commented 4 years ago
  1. Defauting to https when not using https

  2. I assume it is looking for 443 specifically, based on error text

  3. we didn't set neither lb_http_ports or lb_enable_http

  4. We set port 8888 in container and elb listener . [ { "containerPort": 8888 , "hostPort": 8888 , "protocol": "http" } ]

  5. Module version 2.0.17

What combination of parameters do we need to use in order to use just HTTP? Which combination is mandatory for HTTPS?

When trying this config we see errors : 
Error: error creating ELBv2 Listener: ValidationError: A certificate must be specified for HTTPS listeners
    status code: 400

  on .terraform/modules/ecs-fargate.ecs-alb/terraform-aws-ecs-alb-1.0.2/main.tf line 171, in resource "aws_lb_listener" "lb_https_listeners":
 171: resource "aws_lb_listener" "lb_https_listeners" {

Error: InvalidParameterException: The container prod-ecs-jmapper-container did not have a container port 443 defined. "prod-ecs-jmapper-service"

  on .terraform/modules/ecs-fargate.ecs-fargate-service/terraform-aws-ecs-fargate-service-2.0.4/main.tf line 32, in resource "aws_ecs_service" "service":
  32: resource "aws_ecs_service" "service" {
advissor commented 4 years ago

Also, if we go for HTTPs , we would need to enable the https listener. 443 is possible only with certificate, though I dont see in module inputs possibility to specify it Something like acm certs for https listener

advissor commented 4 years ago

@jnonino could you please take a look at this. Do you have a working template for https with specifying the cert for listener?

jnonino commented 3 years ago

Working on this. Load balancer is fixed in version 1.0.7. Next release of terraform-aws-ecs-fargate will include this fix.

jnonino commented 3 years ago

Can you try in version 2.0.22 Please reopen this issue if you continue experiencing problems.

rafilkmp3 commented 3 years ago

HI this still happening Im using latest versions @jnonino

❯ tfenv use 1.0.6
Switching default version to v1.0.6
Switching completed

❯ terraform init -upgrade
Upgrading modules...
Downloading cn-terraform/ecs-fargate/aws 2.0.26 for ecs-cluster...
- ecs-cluster in .terraform/modules/ecs-cluster
Downloading cn-terraform/ecs-cluster/aws 1.0.7 for ecs-cluster.ecs-cluster...
- ecs-cluster.ecs-cluster in .terraform/modules/ecs-cluster.ecs-cluster
Downloading cn-terraform/ecs-fargate-service/aws 2.0.15 for ecs-cluster.ecs-fargate-service...
- ecs-cluster.ecs-fargate-service in .terraform/modules/ecs-cluster.ecs-fargate-service
Downloading cn-terraform/ecs-alb/aws 1.0.9 for ecs-cluster.ecs-fargate-service.ecs-alb...
- ecs-cluster.ecs-fargate-service.ecs-alb in .terraform/modules/ecs-cluster.ecs-fargate-service.ecs-alb
Downloading cn-terraform/ecs-service-autoscaling/aws 1.0.3 for ecs-cluster.ecs-fargate-service.ecs-autoscaling...
- ecs-cluster.ecs-fargate-service.ecs-autoscaling in .terraform/modules/ecs-cluster.ecs-fargate-service.ecs-autoscaling
Downloading cn-terraform/ecs-fargate-task-definition/aws 1.0.23 for ecs-cluster.td...
- ecs-cluster.td in .terraform/modules/ecs-cluster.td
Downloading cloudposse/ecs-container-definition/aws 0.53.0 for ecs-cluster.td.container_definition...
- ecs-cluster.td.container_definition in .terraform/modules/ecs-cluster.td.container_definition
Downloading terraform-aws-modules/vpc/aws 3.7.0 for vpc...
- vpc in .terraform/modules/vpc

Initializing the backend...

Initializing provider plugins...
- Finding hashicorp/aws versions matching ">= 3.38.0"...
- Finding hashicorp/local versions matching ">= 1.2.0"...
- Installing hashicorp/aws v3.57.0...
- Installed hashicorp/aws v3.57.0 (signed by HashiCorp)
- Using previously-installed hashicorp/local v2.1.0

image

rafilkmp3 commented 3 years ago

Even downgrade to this old version its impossible to use this module with provide example ( without https)

terraform init -upgrade
Upgrading modules...
Downloading cn-terraform/ecs-fargate/aws 2.0.22 for ecs-cluster...
- ecs-cluster in .terraform/modules/ecs-cluster
Downloading cn-terraform/ecs-cluster/aws 1.0.6 for ecs-cluster.ecs-cluster...