Skip to content

Task definition is broken with pre-created secretsΒ #67

@Vlaaaaaaad

Description

@Vlaaaaaaad

Hi,

Looks like something regarding the secrets is broken. We discovered this during our upgrade to 0.12 and the v2.1.0 of this module.

The following config used to work:

module "atlantis" {
  source  = "terraform-aws-modules/atlantis/aws"
  version = "~> 2.1.0"

  name = "atlantis"

  # VPC
  cidr            = "10.20.0.0/16"
  azs             = ["us-east-1a", "us-east-1b", "us-east-1c"]
  private_subnets = ["10.20.1.0/24", "10.20.2.0/24", "10.20.3.0/24"]
  public_subnets  = ["10.20.101.0/24", "10.20.102.0/24", "10.20.103.0/24"]

  # DNS (without trailing dot)
  route53_zone_name = "example.com"
  # Atlantis
  atlantis_github_user       = "atlantis-bot"
  atlantis_repo_whitelist    = ["github.com/terraform-aws-modules/*"]
}

provider "aws" {
  region = "us-east-1"
}

Note that that's the same code from the example, without atlantis_github_user_token defined. We don't want to have that in code so we put it in SSM.
This module is smart enough that it can take it from SSM if it's not in the Terrafrom config. That's what was happening in v1.9.0.

In the v2.1.0 this leads to the following in the JSON task definition:

     "secrets": [
        {
          "valueFrom": "unknown_secret_name_value",
          "name": "unknown_secret_name_key"
        },
        {
          "valueFrom": "/atlantis/webhook/secret",
          "name": "unknown_secret_webhook_key"
        }
      ],

This is obviously wrong and leads to the Task definition failing cause it cannot find those SSM secrets.

I think in https://github.com/terraform-aws-modules/terraform-aws-atlantis/blob/master/main.tf#L17-L23 there's something bad. That breaks the definitions in https://github.com/terraform-aws-modules/terraform-aws-atlantis/blob/master/main.tf#L67-L81. Maybe instead of the token there should've been user as I define the user, but the token is always empty.

Am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions