Giter Club home page Giter Club logo

terraform-aws-consul-ecs's Introduction

Consul AWS ECS Modules

This repo contains a set of modules for deploying Consul Service Mesh on AWS ECS (Elastic Container Service).

Documentation

See https://developer.hashicorp.com/consul/docs/ecs for full documentation.

Architecture

Architecture

Each task is created via the mesh-task module. This module adds additional containers known as sidecar containers to your task definition.

Specifically, it adds the following containers:

  • consul-ecs-mesh-init – This is the first container that starts up inside an ECS task. This is short lived.
    • At startup it connects to the available Consul servers and performs a login with the configured IAM Auth method to obtain an ACL token with appropriate privileges.
    • Using the token, it registers the service and proxy entities to Consul's catalog.
    • It then bootstraps the configuration JSON required by the Consul dataplane container and writes it to a shared volume.
    • After this point the container exits.
  • consul-dataplane – Runs for the full lifecycle of the task. This container runs the Consul dataplane that configures and starts the Envoy proxy, which controls all the service mesh traffic. All requests to and from the application run through the proxy.
  • consul-ecs-health-sync - Runs for the full lifecycle of the task. This container is primarily responsible for syncing back ECS container health into Consul.
    • At startup it connects to the available Consul servers and performs a login with the configured IAM Auth method to obtain an ACL token with appropriate privileges.
    • Using the token it fetches the Consul health checks registered by the mesh-init container when registering the service/proxy to Consul.
    • After this, the container enters into its reconciliation loop where it periodically syncs the health of ECS containers into Consul.
    • Upon receiving SIGTERM, it marks the corresponding service instance in Consul as unhealthy and waits for the dataplane container to shutdown.
    • Finally, it deregisters the service and proxy entities from Consul's catalog and performs a Consul logout.

The controller module runs a controller that automatically provisions ACL tokens for tasks on the mesh. It also deregisters service instances from Consul for missing/finished tasks in ECS.

The dev-server module runs a development/testing-only Consul server as an ECS task.

Please see our Architecture docs for more details.

Usage

See https://www.consul.io/docs/ecs.

Modules

  • mesh-task: This module creates an ECS Task Definition that adds additional containers to your application task, so it can be part of the Consul service mesh.

  • dev-server [For Development/Testing Only]: This module deploys a Consul server onto your ECS Cluster for development/testing purposes. The server does not have persistent storage and so is not suitable for production deployments.

  • gateway-task: This module creates an ECS Task Definition that adds required containers to deploy a Consul gateway (API/Mesh/Terminating) as a ECS workload.

  • controller: This modules deploys a controller that automatically provisions ACL tokens for services on the Consul service mesh. It also keeps an eye on the tasks and deregisters the service instances of those tasks that go missing or get finished.

Roadmap

Please refer to our roadmap here.

License

This code is released under the Mozilla Public License 2.0. Please see LICENSE for more details.

terraform-aws-consul-ecs's People

Contributors

allisaurus avatar cthain avatar danstough avatar dependabot[bot] avatar erichaberkorn avatar ganeshrockz avatar greenlantern16 avatar hashicorp-copywrite[bot] avatar ishustava avatar jcolemorrison avatar kisunji avatar kkavish avatar lkysow avatar reskin89 avatar roncodingenthusiast avatar sanon-dev avatar shywiz avatar v-rosa avatar zmadell523 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

terraform-aws-consul-ecs's Issues

improvement local.defaulted_check_containers validations

The issue

When a task_definition passed to mesh-task contains the property healthCheck = null, the healt check side-car will always report a failiure.

The why

In https://github.com/hashicorp/terraform-aws-consul-ecs/blob/v0.5.2/modules/mesh-
task/main.tf#L71-L74 only the keys existence is tested, but specially for healthCheck the value should also be tested, mainly because the task_def passed in var.container_definitions might contain healthCheck = null due to optional flags in task_def creation.

This will pass the task_def to

healthSyncContainers = local.defaulted_check_containers
even it doesn't have a healt_check command

feature/bugfix: allow usage of cross account AWS SecretManager secrets

Current implementation assumes that AWS SecretManager instances to store Consul secrets are located in the same AWS account as the ECS services (acl-controller and mesh-task) and using the default AWS KMS keys.

It would be helpful to have the option to use CMK/external AWS Secrets instance. The only change needed would be to pass the KMS key and adjust the service execution policies.

I've created a small PR with this approach. Yet it's not clear to me how to proceed with this secret consul_https_ca_cert_arn, but we can review it in the PR: TODO.

GetSecretValue IAM permission for acl-controller

Module: acl-controller

Regarding secrets, currently the module has the following input variables:

  • consul_bootstrap_token_secret_arn
  • consul_server_ca_cert_arn

The module then creates IAM permissions to the GetSecretValue action. Normally this works fine with secret ARNs that only contain a single value such as:

arn:aws:secretsmanager:<region>:<aws_account_id>:secret:<secret_name>

But when a secret with a JSON structure is used, then the ARN in the ECS task definition becomes:

arn:aws:secretsmanager:region:aws_account_id:secret:secret-name:json-key:version-stage:version-id

Unfortunately the IAM permission fails (does not apply) when this type of secret ARN is used and the acl-controller fails to start because its unable to retrieve the secret value.

I was able to confirm this by manually updating the IAM policy by removing the :json-key:version-stage:version-id suffix and the acl-controller was then able to start successfully.

How would it be possible to use secrets with ARNs that specify a JSON key?

Improve bootstrap time of v0.7.x mesh-task

I've noticied that bootstrap times of consul side-cars in v0.7.x are taking more than I expected, let's say 1m40s-2m00 with very simple services which need ~10secs to bootstrap.

I've started playing the with the health check configurations of consul-dataplane and consul-ecs-control-plane.

See v-rosa@e196aad

I've managed to reduce consul bootstrap to ~50-60 seconds.

Do you think these health check values are adequate? This was tested with a service which have only 1 upstream and 1 down stream. Do the number of configured up/downstreams affect heavily the bootstrap time?

I also understand the that the v0.8.0 is being cooked which will change the side cars structure. Do you think is valuable to hotfix v0.7.x? Personally at my company we won't know when we'll be able to jump to v0.8.0 and meanwhile these bootstrap times are kinda unconfortable.

Mesh-Task Creating Roles

The the roles variables state they will create a role if none is provided, it seems roles for cloudwatch "create log group" are still being created.

In many areas and business there is governance on IAM role creation and as such, no roles should be created at all if iam role ARNs are already provided.

AWS execute command is not compatible with task def readonlyRootFilesystem

Currently it's not possible to run the ecs execute-command action if the task-def sets readonlyRootFilesystem to true. E.g.

aws ecs execute-command  \
    --region us-east-1 \
    --cluster stg-internal-pet \
    --task 355ef4d394294fdd91acb5af1876806f \
    --container consul-ecs-controller \
    --command "/bin/bash" \
    --interactive

Given by default ECS Controller enables both:

Execute command won't work if some work arounds are implemented, like:

Or if we disable readonlyRootFilesystem when we decide to enable enable_execute_command at the ECS service level.

Btw this issue was introduced by me here: 8a8b9b0

Add ability to specify tags to task definitions

In the current Terraform configuration the tag value of consul.hashicorp.com/mesh is hard coded. In order to append to this value the Terraform template must be changed to accept tags provided through the tags variable.

  tags = {
    "consul.hashicorp.com/mesh" = "true"
  }

v0.8.0 tf perpetual drift when enable_transparent_proxy is false

Hey, we're testing the Consul ECS v0.8.0 terraform module, more specifically the mesh-task.

While testing we've found that after applying the changes, subsequent plans will keep displaying perpetual diffs in the container definitions about default values not being present. This doesn't happens in the v0.7.1 at least.

Terraform version: v1.3.7
AWS Provider version: v5.50.0
ECS deployment model: Fargate (meaning variable enable_transparent_proxy is set to false, this is relevant as per my findings).

Perpetual drift:

# module.ecs_services["consul-test-module-clt-test-task"].module.consul_mesh_template[0].aws_ecs_task_definition.this must be replaced
-/+ resource "aws_ecs_task_definition" "this" {
      ~ arn                      = "arn:aws:ecs:us-east-1:redacted:task-definition/stg-consul-test-module-clt-test-task-template:5" -> (known after apply)
      ~ arn_without_revision     = "arn:aws:ecs:us-east-1:redacted:task-definition/stg-consul-test-module-clt-test-task-template" -> (known after apply)
      ~ container_definitions    = jsonencode(
          ~ [ # forces replacement
              ~ {
                  - cpu              = 0 -> null
                    name             = "some-container-injected"
                  - portMappings     = [] -> null
                  - systemControls   = [] -> null
                  - volumesFrom      = [] -> null
                    # (6 unchanged elements hidden)
                } # forces replacement,
              ~ {
                    name             = "consul-dataplane"
                  - systemControls   = [] -> null
                    # (14 unchanged elements hidden)
                } # forces replacement,
              ~ {
                    name             = "consul-ecs-health-sync"
                  - systemControls   = [] -> null
                    # (13 unchanged elements hidden)
                } # forces replacement,
              ~ {
                  ~ linuxParameters  = {
                      ~ capabilities       = {
                          - add  = [] -> null
                          - drop = [] -> null
                        }
                        # (1 unchanged element hidden)
                    }
                    name             = "consul-ecs-mesh-init"
                  - portMappings     = [] -> null
                  - systemControls   = [] -> null
                    # (9 unchanged elements hidden)
                } # forces replacement,
              ~ {
                  - cpu              = 0 -> null
                    name             = "consul-test-module-clt-test-task"
                  - systemControls   = [] -> null
                  - volumesFrom      = [] -> null
                    # (8 unchanged elements hidden)
                } # forces replacement,
              ~ {
                  - cpu              = 0 -> null
                    name             = "some-container-injected"
                  - portMappings     = [] -> null
                  - systemControls   = [] -> null
                  - volumesFrom      = [] -> null
                    # (7 unchanged elements hidden)
                } # forces replacement,
            ]
        )
      ~ id                       = "stg-consul-test-module-clt-test-task-template" -> (known after apply)
      ~ revision                 = 5 -> (known after apply)
        tags                     = {
            "Module"                              = "consul-test-module-clt"
            "Name"                                = "consul-test-module-clt-test-task"
            "consul.hashicorp.com/mesh"           = "true"
            "consul.hashicorp.com/module"         = "terraform-aws-consul-ecs"
            "consul.hashicorp.com/module-version" = "0.8.0"
            "consul.hashicorp.com/namespace"      = "default"
            "consul.hashicorp.com/partition"      = "stg"
            "consul.hashicorp.com/service-name"   = "consul-test-module-clt-test-task"
        }
        # (10 unchanged attributes hidden)
        # (3 unchanged blocks hidden)
    }

From my investigation, basically the issue seems related to the empty dictionary capabilities inside linuxParameters.

The initial apply creates this an empty capabilities dict inside linuxParameters dict:

           ~ {
                  ~ linuxParameters  = {
                      + capabilities       = {}
                        # (1 unchanged element hidden)
                    }
                    name             = "consul-ecs-mesh-init"
                  - portMappings     = [] -> null
                  - systemControls   = [] -> null
                    # (9 unchanged elements hidden)
                } # forces replacement,

The subsequent plan tries to change it to null:

# module.ecs_services["consul-test-module-clt-test-task"].module.consul_mesh_template[0].aws_ecs_task_definition.this must be replaced
-/+ resource "aws_ecs_task_definition" "this" {
      ~ arn                      = "arn:aws:ecs:us-east-1:redacted:task-definition/stg-consul-test-module-clt-test-task-template:5" -> (known after apply)
      ~ arn_without_revision     = "arn:aws:ecs:us-east-1:redacted:task-definition/stg-consul-test-module-clt-test-task-template" -> (known after apply)
      ~ container_definitions    = jsonencode(
          ~ [ # forces replacement
              ~ {
                  - cpu              = 0 -> null
                    name             = "some-container-injected"
                  - portMappings     = [] -> null
                  - systemControls   = [] -> null
                  - volumesFrom      = [] -> null
                    # (6 unchanged elements hidden)
                } # forces replacement,
              ~ {
                    name             = "consul-dataplane"
                  - systemControls   = [] -> null
                    # (14 unchanged elements hidden)
                } # forces replacement,
              ~ {
                    name             = "consul-ecs-health-sync"
                  - systemControls   = [] -> null
                    # (13 unchanged elements hidden)
                } # forces replacement,
              ~ {
                  ~ linuxParameters  = {
                      ~ capabilities       = {
                          - add  = [] -> null
                          - drop = [] -> null
                        }
                        # (1 unchanged element hidden)
                    }
                    name             = "consul-ecs-mesh-init"
                  - portMappings     = [] -> null
                  - systemControls   = [] -> null
                    # (9 unchanged elements hidden)
                } # forces replacement,
              ~ {
                  - cpu              = 0 -> null
                    name             = "consul-test-module-clt-test-task"
                  - systemControls   = [] -> null
                  - volumesFrom      = [] -> null
                    # (8 unchanged elements hidden)
                } # forces replacement,
              ~ {
                  - cpu              = 0 -> null
                    name             = "some-container-injected"
                  - portMappings     = [] -> null
                  - systemControls   = [] -> null
                  - volumesFrom      = [] -> null
                    # (7 unchanged elements hidden)
                } # forces replacement,
            ]
        )
      ~ id                       = "stg-consul-test-module-clt-test-task-template" -> (known after apply)
      ~ revision                 = 5 -> (known after apply)
        tags                     = {
            "Module"                              = "consul-test-module-clt"
            "Name"                                = "consul-test-module-clt-test-task"
            "consul.hashicorp.com/mesh"           = "true"
            "consul.hashicorp.com/module"         = "terraform-aws-consul-ecs"
            "consul.hashicorp.com/module-version" = "0.8.0"
            "consul.hashicorp.com/namespace"      = "default"
            "consul.hashicorp.com/partition"      = "stg"
            "consul.hashicorp.com/service-name"   = "consul-test-module-clt-test-task"
        }
        # (10 unchanged attributes hidden)
        # (3 unchanged blocks hidden)
    }

To avoid this, I need to slighty adjust the linuxParameters: #319

sidecar-proxy container remains in "Pending" status when using retry_join

I'm trying to connect the example mesh-task to a previously set up Consul server hosted in an EC2 instance, using the retry_join input in the mesh-task definition:

retry_join = "provider=aws tag_key=Name tag_value=consul"

However, when the task starts only the mesh-init and the consul-client enter the Running status, while the sidecar-proxy and example-client-app remain in Pending status:

image

If I switch back to the configuration using the consul_server_service_name input, every container starts successfully.

Things I've already checked that might be causing the issue:

  • Is Server accepting connections? -> Consul server is up and already connected to another sidecar service hosted in an EC2 instance
  • Are Security Groups correct? -> Both Server and ECS Tasks have all ports/protocols open to "0.0.0.0/0" connections
  • Is the app starting in Docker? -> I'm using the provided app from the examples

I'm not quite sure how I can debug the issue, as there are no log files for pending containers on ECS (or at least I believe there aren't any).

Could there be any config missing on my Consul server, or is there any issue when using retry_join with the AWS provider?

Inability to Modify Consul Connect Command

I wanted to use this module to deploy a terminating Gateway in ECS, however since I'm unable to modify the consul connect command in any way, I can't use this module to do so.

I believe some type of optional variable for this would be very helpful to take full advantage of envoy

Multiple services per task definition

Consul supports defining multiple services for different ports, with their own healthchecks and everything. This is something my company needs to support sending data between containers but also sending out metrics via an admin panel from our applications. Is there a chance this could be implemented in the near future?

Question: Is this Consul Connect?

Hey Folks! Hope this issue finds you all well! 😄

I found this repo at Consul's Docs Page.

I became interested in the consul because of its Service Mesh capability.

In the Service Mesh overview documentation page and in this another example repository aws-samples/amazon-ecs-fargate-consul-connect-example, they talk about "Consult Connect", as if "Connect" were a specific service/functionality.

But I couldn't find any mention of "Connect" here in this repository, although I believe the purpose is the same.

Just to be sure: does this repository implement a "Consul Connect" example? Is "Connect" still a thing?

v0.5.1 is incompatible with Consul Enterprise v1.13.3

I was testing the following demo: https://github.com/hashicorp/terraform-aws-hcp-consul/blob/main/examples/hcp-ecs-demo/main.tf

It relies on the mesk-task module of this repository to spin up an ECS service with all the needed side-cars.

Using Consul entreprise v1.13.3, its impossible to start the consul-client side car given the following error:

==> failed to parse /consul/agent-defaults.hcl: 1 error occurred:
* invalid config key telemetry.disable_compat_1.9

Looking at the release notes, this paramter should be removed from v1.13 onwards.

Given this mesk-task module is a dependency of the HCP feature which allows to bootstrap a Consul cluster with auto-generated terraform code, I would say it should fix by removing the parameter so users won't complain about a broken demo.

I can quickly open a PR to address it.

Gateway Task Does not Allow for `create_iam_role=false` or `custom_security_group_ids`

The gateway-task submodule does not provide a way to disable IAM role creation and thus providing my own IAM Role ARN.

The gateway-task submodule also does not provide a way to supply it with my own security group IDs for the ECS service/task, only allowing for creating an LB security group and nothing more (which seems mesh gateway specific, but is not very helpful if your kind is terminating-gateway).

Error decoding JSON: json: cannot unmarshal bool into Go struct field of type string

Hello!

The mesh-task submodule intakes a variable called log_configuration, to customize/configure logs for an ECS task built by this module. The variable is added to the merged container_definitions object for the generated ecs_task_definition resource.

Variable definition:

variable "log_configuration" {
description = "Task definition [log configuration object](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_LogConfiguration.html)."
type = any
default = null
}

Appended value:

logConfiguration = var.log_configuration

The AWS Developer guide includes an options block for logConfiguration that includes a setting for awslogs-create-group with values of true/false, to determine whether the task definition creates the Cloudwatch logs group, or references the defined values instead. Snippet below:

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_awslogs.html

                "options": {
                    "awslogs-group": "firelens-container",
                    "awslogs-region": "us-west-2",
                    "awslogs-create-group": "true",
                    "awslogs-stream-prefix": "firelens"

In my code, I have created a mesh-task:

variable "awslogs_create_group" {
  type    = bool
  default = true
}

# Object to add to log_configuration's "options" sub-block.
locals {
  logs_options = {

. . . 

    awslogs-create-group  = var.awslogs_create_group

. . . 

  }
}


module "mesh_task" {

. . .

  log_configuration = {
    logDriver = "awslogs"
    options   = local.logs_options
  }

. . . 
}

This module invocation returns a go struct error during terraform plan

Error: ECS Task Definition container_definitions is invalid: Error decoding JSON: json: cannot unmarshal bool into Go struct field LogConfiguration.LogConfiguration.Options of type string

│   with module..module.mesh_task["task"].aws_ecs_task_definition.this,
│   on .terraform/modules//modules/mesh-task/main.tf line 180, in resource "aws_ecs_task_definition" "this":180:   container_definitions = jsonencode(
│  181:     flatten(
│  182:       concat(
│  183:         local.container_defs_with_depends_on,
│  184:         [

. . .220:             logConfiguration = var.log_configuration

Changing awslogs-create-group's value from bool(true), to string(true) (Or, true -> "true") fixes this error to let the task definition create the cloudwatch group.

Looking at the log_configuration declaration, it seems like there isn't type checking or validation on the variable. There are validations for other variables: For example, the upstreams variable in variables.tf

Could it make sense to create an object definition for log_configuration, with a validation? Example below (Note: This is a rough suggestion, using existing validations in the module as reference)

variable "log_configuration" {
  type = object({
    logDriver = string
    options = object({
      awslogs-group         = string
      awslogs-region        = string
      awslogs-stream-prefix = string
      awslogs-create-group  = string
    })
  })
  validation {
    error_message = "awslogs-create-group must be a string 'true'"
    condition = allfalse(flatten([
      for log_var in var.log_configuration : [
        type(can(lookup(log_var.options, "awslogs-create-group"), string))
      ]
    ]))
  }
}

I couldn't find information on the available task definition values to configure in the mesh-task module, and relied on the ecs_task_definition resource, and this module's variables file to understand how to build the ECS task definition. Since some of the larger variables (log_configuration, container_definitions, volumes) are set to a type of any, it required some context switching to fully understand what was needed to get the mesh-task created, in addition to this specific error.

Thank you! 😺

acl-controller has write permissions to root file system

By default the task definition readonlyRootFilesystem is set to false. If not set to true, it will grant write permissions to the root file system. Could you clarify if write permission is needed for the acl-controller?

This triggers the following AWS Security Hub alert:

[ECS.5] This control checks if ECS containers are limited to read-only access to mounted root filesystems. This control fails if the ReadonlyRootFilesystem parameter in the container definition of ECS task definitions is set to ‘false’. Remediation instructions

grpc tls issue with ecs controller 0.8.0

Hello all, we are seeing the following tls communication issue when deploying the ecs controller with tls enabled.

Consul server version
Consul v1.17.0
Revision 4e3f428b
Build Date 2023-11-03T14:56:56Z
Protocol 2 spoken by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents)

ecs controller image
variable "consul_ecs_image" {
description = "Consul ECS image to use in all tasks."
type = string
default = "hashicorp/consul-ecs:0.8.0"
}

The ecs controller is running as a fargate task and we see the following error in the logs

[ERROR] connection error: error="fetching supported dataplane features: rpc error: code = Unavailable desc = connection error: desc = \"error reading server preface: remote error: tls: bad certificate\""

When running consul montior with trace logging on the server we see the corresponding server side error

2024-03-20T20:37:12.469Z [TRACE] agent: [core][Server #2] grpc: Server.Serve failed to create ServerTransport: connection error: desc = "ServerHandshake(\"10.255.186.202:46110\") failed: tls: client didn't provide a certificate"

We are passing the following to the controller

  source = "hashicorp/consul-ecs/aws//modules/controller"
  version = "0.8.0"

  name_prefix         = var.name
  ecs_cluster_arn     = var.ecs_cluster_arn
  region              = var.region
  subnets             = var.private_subnets
  consul_server_hosts = var.consul_server_hosts
  consul_ca_cert_arn  = var.consul_ca_cert_arn
  launch_type         = "FARGATE"

  consul_bootstrap_token_secret_arn = var.consul_server_bootstrap_token_arn

  log_configuration = {
    logDriver = "awslogs"
    options = {
      awslogs-group         = var.log_group_name
      awslogs-region        = var.region
      awslogs-stream-prefix = "consul-controller"
    }
  }

  consul_ecs_image = var.consul_ecs_image
  tls              = true
}

Are we missing something on the client side configuration?

consul_https_ca_cert_arn using ACM

How are we supposed to specify consul_https_ca_cert_arn when Consul's certificate is from ACM? In that use-case, we don't have access to the CA.

Add `container_definitions` to gateway-task

The gateway task submodule does not allow for adding in one's own container definitions to the task, I believe this should be added due to someone adding sidecars for things like:

  • log ingestion
  • metric collection
  • custom metric creation in cloudwatch (I have a sidecar that posts the active connections of envoy to cloudwatch for fargate scaling purposes)

It would be helpful to have a container definition to facilitate this. I'm going to work on a PR for this

conflict when setting different upstreams with the same port in mesh-task

Currently when a service-a needs to communicate with a upstream, let's say service-b:1234 the following mesh-task is needed:

module "service-a" {
  source = "../../modules/mesh-task"
  upstreams = [
    {
      destinationName = "service-b"
      localBindPort   = 1234
    }
  ]

  container_definitions = [{
    environment = [
      {
        name  = "UPSTREAM_URI_B"
        value = "http://localhost:1234"
      }
    ]

Now if service-a needs to have a new upstream (service-c) using the same port, wouldn't this create a conflict?

module "service-a" {
  source = "../../modules/mesh-task"
  upstreams = [
    {
      destinationName = "service-b"
      localBindPort   = 1234
    },
    {
      destinationName = "service-c"
      localBindPort   = 1234
    }
  ],
  container_definitions = [{
    environment = [
      {
        name  = "UPSTREAM_URI_B"
        value = "http://localhost:1234"
      },
      {
        name  = "UPSTREAM_URI_C"
        value = "http://localhost:1234" ## this doesn't make sense for me
      },
    ]
...
}

Would be possible to allow to set the upstreams like http://<consul-service-name>:<binding-port>, I tried this but apparently it doesn't work.

Default security group for the ecs service may not allow access from created load balancer

This is for the dev-server module of this project.

By default, the security group attached to the ECS service (in this case the consul server), is the default security group of the VPC used (reference).

Currently, this option is not configurable in this module (check main.tf line 66).

If the default security group of the VPC used does not permit the IP addresses used by the load balancer (as what happened in my case) then you won't be able to connect to the Consul UI via the load balancer.

Security group is missing for acl-controller

The acl-controller submodule creates an ECS service without specifying a security group (reference).

This results in the default security group for the VPC being used and if no inbound or outbound rules are defined, then the ECS service fails to start. AWS also seems to say that the security group is a required argument in the ECS dashboard.

This was verified by creating the acl-controller ECS service manually in the AWS console and specify a security group that does contains inbound and outbound rules.

The splat workaround no longer works with latest terraform

  • Terraform version: 1.2.3
  • Mesh module version: 0.4.1

https://github.com/hashicorp/terraform-aws-consul-ecs/blob/v0.4.1/modules/mesh-task/iam.tf#L2

The workaround still produces the following error:

│ 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.

I also tried specifying depends_on so that the IAM roles are created before the mesh module and that didn't work either.

Consul Client Command Incompatible with Fargate

Currently:

ECS_IPV4=$(curl -s $ECS_CONTAINER_METADATA_URI | jq -r '.Networks[0].IPv4Addresses[0]')

The Consul Client Command template does a curl against ECS_CONTAINER_METADATA_URI, Fargate now uses ECS_CONTAINER_METADATA_URI_V4 which the consul-ecs binary in the ecs container looks for, but the client command does not.

This makes the module incompatible with fargate.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.