Skip to content

maeghan-porter/terraform-aws-ecs-atlantis

 
 

Repository files navigation

terraform-aws-ecs-atlantis Latest Release Slack Community

README Header

Cloud Posse

terraform-aws-ecs-atlantis

A Terraform module for deploying Atlantis to an AWS ECS cluster.


This project is part of our comprehensive "SweetOps" approach towards DevOps.

Terraform Open Source Modules

It's 100% Open Source and licensed under the APACHE2.

We literally have hundreds of terraform modules that are Open Source and well-maintained. Check them out!

Screenshots

demo Example of a Pull Request comment from running terraform plan using atlantis

Introduction

Atlantis enables GitOps workflows so that teams can collaborate on operations using Pull Requests.

Under the hood, it's a small self-hosted daemon (#golang) that listens for Pull Request webhook events from GitHub.

With Atlantis, engineers can run terraform plan and terraform apply using "chat ops" type comments on the Pull Request.

Features

This module provisions the following resources:

  • ECS Atlantis web application, which includes:
    • ECR Docker registry
    • ALB target group, listener rule and alarms
    • ECS container definition (using a default backend)
    • ECS task definition and IAM role
    • ECS service and IAM role
    • ECS task autoscaling
    • ECS SNS based alarms
    • ECS Codepipeline to build our Atlantis image on GitHub release
    • ECS Codedeploy to deploy our ECS Atlantis web app
  • SSH key pair for Atlantis to pull private Github repositories, which are written to SSM for reading with chamber
  • Route53 alias for Atlantis
  • GitHub webhook to trigger Atlantis for a given repository

What this module does not provision:

  • ECS Cluster (BYOC)
  • ALB
  • ACM certificate
  • VPC
  • Subnets

Caveats

  • This project assumes that the repo being deployed defines a Dockerfile which runs atlantis. It might not work with the official version of atlantis. We use geodesic as our docker base image.
  • This project defines parameters which are not available in the official version of atlantis. Our fork implements the ability to restrict plan and apply to GitHub teams.

GitHub Repo Scopes

This module accepts two GitHub OAuth tokens:

  1. github_oauth_token with permissions to pull private repos. Used by CodePipeline to clone repos before the build, and by the atlantis server to clone repos and comment on Pull Requests.

    The token needs the following OAuth scopes:

    • repo
      • repo:status
      • repo_deployment
      • public_repo
      • repo:invite
  2. github_webhooks_token with permissions to create GitHub webhooks. Only used by Terraform GitHub Provider when provisioning the module.

    The token needs the following OAuth scopes:

    • admin:repo_hook
      • write:repo_hook
      • read:repo_hook

We suggest the following steps when creating the tokens and provisioning the module:

  1. Create a GitHub bot user
  2. Create the two Personal Access Tokens and add them to the bot
  3. In github.com/<org>/<repo>/settings/collaboration, create a Team for the bot and add the bot user to it
  4. Give Admin permissions to the Team (select it from the dropdown). We need it temporalily to provision GitHub webhooks on the repo
  5. Provision the module with Terraform. Terraform GitHub Provider will use the github_webhooks_token to create webhooks on the repo
  6. Go to github.com/<org>/<repo>/settings/hooks and make sure that two webhooks have been created: one for the CodePipeline with Releases events, the other is for the atlantis server with Issue comments, Pull request reviews, Pull requests, Pull request review comments and Pushes events
  7. IMPORTANT: Remove the Admin permissions and add Read permissions for the bot Team. The CodePipeline and atlantis server will use the github_oauth_token to clone repos, which does not require escalated privileges

IMPORTANT: Do not commit the tokens to source control (e.g. via terraform.tvfars).

NOTE: If the two tokens are not provided (left empty), they will be looked up from SSM Parameter Store. You can write atlantis atlantis_gh and github_webhooks_token to SSM Parameter Store before provisioning the module. For example, by using chamber:

  chamber write atlantis atlantis_gh_token "....."
  chamber write atlantis github_webhooks_token "....."

Security & Compliance

Security scanning is graciously provided by Bridgecrew. Bridgecrew is the leading fully hosted, cloud-native solution providing continuous Terraform security and compliance.

Benchmark Description
Infrastructure Security Infrastructure Security Compliance
CIS KUBERNETES Center for Internet Security, KUBERNETES Compliance
CIS AWS Center for Internet Security, AWS Compliance
CIS AZURE Center for Internet Security, AZURE Compliance
PCI-DSS Payment Card Industry Data Security Standards Compliance
NIST-800-53 National Institute of Standards and Technology Compliance
ISO27001 Information Security Management System, ISO/IEC 27001 Compliance
SOC2 Service Organization Control 2 Compliance
CIS GCP Center for Internet Security, GCP Compliance
HIPAA Health Insurance Portability and Accountability Compliance

Usage

IMPORTANT: We do not pin modules to versions in our examples because of the difficulty of keeping the versions in the documentation in sync with the latest released versions. We highly recommend that in your code you pin the version to the exact version you are using so that your infrastructure remains stable, and update versions in a systematic way so that they do not catch you by surprise.

Also, because of a bug in the Terraform registry (hashicorp/terraform#21417), the registry shows many of our inputs as required when in fact they are optional. The table below correctly indicates which inputs are required.

For a complete example, see examples/complete.

For automated tests of the complete example using bats and Terratest (which tests and deploys the example on AWS), see test.

Other examples:

NOTE:

If no github_oauth_token is set, the module attempts to look one up from SSM.

If no github_webhooks_token is set, Terraform GitHub Provider attempts to look one up in the GITHUB_TOKEN environment variable.

  provider "aws" {
    region = var.region
  }

  module "label" {
    source     = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.16.0"
    namespace  = var.namespace
    name       = var.name
    stage      = var.stage
    delimiter  = var.delimiter
    attributes = var.attributes
    tags       = var.tags
  }

  module "vpc" {
    source     = "git::https://github.com/cloudposse/terraform-aws-vpc.git?ref=tags/0.8.1"
    namespace  = var.namespace
    stage      = var.stage
    name       = var.name
    delimiter  = var.delimiter
    attributes = var.attributes
    cidr_block = var.vpc_cidr_block
    tags       = var.tags
  }

  module "subnets" {
    source               = "git::https://github.com/cloudposse/terraform-aws-dynamic-subnets.git?ref=tags/0.16.1"
    availability_zones   = var.availability_zones
    namespace            = var.namespace
    stage                = var.stage
    name                 = var.name
    attributes           = var.attributes
    delimiter            = var.delimiter
    vpc_id               = module.vpc.vpc_id
    igw_id               = module.vpc.igw_id
    cidr_block           = module.vpc.vpc_cidr_block
    nat_gateway_enabled  = true
    nat_instance_enabled = false
    tags                 = var.tags
  }

  module "alb" {
    source                                  = "git::https://github.com/cloudposse/terraform-aws-alb.git?ref=tags/0.7.0"
    namespace                               = var.namespace
    stage                                   = var.stage
    name                                    = var.name
    attributes                              = var.attributes
    delimiter                               = var.delimiter
    vpc_id                                  = module.vpc.vpc_id
    security_group_ids                      = [module.vpc.vpc_default_security_group_id]
    subnet_ids                              = module.subnets.public_subnet_ids
    internal                                = false
    http_enabled                            = true
    access_logs_enabled                     = false
    alb_access_logs_s3_bucket_force_destroy = true
    access_logs_region                      = var.region
    cross_zone_load_balancing_enabled       = true
    http2_enabled                           = true
    deletion_protection_enabled             = false
    tags                                    = var.tags
  }

  resource "aws_ecs_cluster" "default" {
    name = module.label.id
    tags = module.label.tags
  }

  resource "aws_sns_topic" "sns_topic" {
    name         = module.label.id
    display_name = "Test terraform-aws-ecs-atlantis"
    tags         = module.label.tags
  }

  module "kms_key" {
    source                  = "git::https://github.com/cloudposse/terraform-aws-kms-key.git?ref=tags/0.3.0"
    enabled                 = var.enabled
    namespace               = var.namespace
    stage                   = var.stage
    name                    = var.name
    attributes              = var.attributes
    delimiter               = var.delimiter
    tags                    = var.tags
    description             = "Test terraform-aws-ecs-atlantis KMS key"
    deletion_window_in_days = 7
    enable_key_rotation     = false
  }

  module "atlantis" {
    source = "cloudposse/ecs-atlantis/aws"
    # Cloud Posse recommends pinning every module to a specific version
    # version = "x.x.x"
    enabled    = var.enabled
    namespace  = var.namespace
    stage      = var.stage
    name       = var.name
    attributes = var.attributes
    delimiter  = var.delimiter
    tags       = var.tags

    region               = var.region
    vpc_id               = module.vpc.vpc_id
    policy_arn           = var.policy_arn
    ssh_private_key_name = var.ssh_private_key_name
    ssh_public_key_name  = var.ssh_public_key_name
    kms_key_id           = module.kms_key.key_id

    atlantis_gh_user           = var.atlantis_gh_user
    atlantis_gh_team_whitelist = var.atlantis_gh_team_whitelist
    atlantis_gh_webhook_secret = var.atlantis_gh_webhook_secret
    atlantis_log_level         = var.atlantis_log_level
    atlantis_repo_config       = var.atlantis_repo_config
    atlantis_repo_whitelist    = var.atlantis_repo_whitelist
    atlantis_port              = var.atlantis_port
    atlantis_webhook_format    = var.atlantis_webhook_format
    atlantis_url_format        = var.atlantis_url_format

    default_backend_image = var.default_backend_image
    healthcheck_path      = var.healthcheck_path
    short_name            = var.short_name
    hostname              = var.hostname
    parent_zone_id        = var.parent_zone_id

    // Container
    container_cpu    = var.container_cpu
    container_memory = var.container_memory

    // Authentication
    authentication_type                           = var.authentication_type
    alb_ingress_listener_unauthenticated_priority = var.alb_ingress_listener_unauthenticated_priority
    alb_ingress_listener_authenticated_priority   = var.alb_ingress_listener_authenticated_priority
    alb_ingress_unauthenticated_hosts             = var.alb_ingress_unauthenticated_hosts
    alb_ingress_authenticated_hosts               = var.alb_ingress_authenticated_hosts
    alb_ingress_unauthenticated_paths             = var.alb_ingress_unauthenticated_paths
    alb_ingress_authenticated_paths               = var.alb_ingress_authenticated_paths
    authentication_cognito_user_pool_arn          = var.authentication_cognito_user_pool_arn
    authentication_cognito_user_pool_client_id    = var.authentication_cognito_user_pool_client_id
    authentication_cognito_user_pool_domain       = var.authentication_cognito_user_pool_domain
    authentication_oidc_client_id                 = var.authentication_oidc_client_id
    authentication_oidc_client_secret             = var.authentication_oidc_client_secret
    authentication_oidc_issuer                    = var.authentication_oidc_issuer
    authentication_oidc_authorization_endpoint    = var.authentication_oidc_authorization_endpoint
    authentication_oidc_token_endpoint            = var.authentication_oidc_token_endpoint
    authentication_oidc_user_info_endpoint        = var.authentication_oidc_user_info_endpoint

    // ECS
    private_subnet_ids = module.subnets.private_subnet_ids
    ecs_cluster_arn    = aws_ecs_cluster.default.arn
    ecs_cluster_name   = aws_ecs_cluster.default.name
    security_group_ids = var.security_group_ids
    desired_count      = var.desired_count
    launch_type        = var.launch_type

    // ALB
    alb_zone_id                                     = module.alb.alb_zone_id
    alb_arn_suffix                                  = module.alb.alb_arn_suffix
    alb_dns_name                                    = module.alb.alb_dns_name
    alb_security_group                              = module.alb.security_group_id
    alb_ingress_unauthenticated_listener_arns       = [module.alb.http_listener_arn]
    alb_ingress_unauthenticated_listener_arns_count = 1

    // CodePipeline
    codepipeline_enabled                 = var.codepipeline_enabled
    github_oauth_token                   = var.github_oauth_token
    github_webhooks_token                = var.github_webhooks_token
    repo_owner                           = var.repo_owner
    repo_name                            = var.repo_name
    branch                               = var.branch
    build_timeout                        = var.build_timeout
    webhook_enabled                      = var.webhook_enabled
    webhook_secret_length                = var.webhook_secret_length
    webhook_events                       = var.webhook_events
    codepipeline_s3_bucket_force_destroy = var.codepipeline_s3_bucket_force_destroy

    // Autoscaling
    autoscaling_enabled      = var.autoscaling_enabled
    autoscaling_min_capacity = var.autoscaling_min_capacity
    autoscaling_max_capacity = var.autoscaling_max_capacity

    // Alarms
    alb_target_group_alarms_enabled                   = var.alb_target_group_alarms_enabled
    ecs_alarms_enabled                                = var.ecs_alarms_enabled
    alb_target_group_alarms_alarm_actions             = [aws_sns_topic.sns_topic.arn]
    alb_target_group_alarms_ok_actions                = [aws_sns_topic.sns_topic.arn]
    alb_target_group_alarms_insufficient_data_actions = [aws_sns_topic.sns_topic.arn]
    ecs_alarms_cpu_utilization_high_alarm_actions     = [aws_sns_topic.sns_topic.arn]
    ecs_alarms_cpu_utilization_high_ok_actions        = [aws_sns_topic.sns_topic.arn]
    ecs_alarms_cpu_utilization_low_alarm_actions      = [aws_sns_topic.sns_topic.arn]
    ecs_alarms_cpu_utilization_low_ok_actions         = [aws_sns_topic.sns_topic.arn]
    ecs_alarms_memory_utilization_high_alarm_actions  = [aws_sns_topic.sns_topic.arn]
    ecs_alarms_memory_utilization_high_ok_actions     = [aws_sns_topic.sns_topic.arn]
    ecs_alarms_memory_utilization_low_alarm_actions   = [aws_sns_topic.sns_topic.arn]
    ecs_alarms_memory_utilization_low_ok_actions      = [aws_sns_topic.sns_topic.arn]
  }

Makefile Targets

Available targets:

  help                                Help screen
  help/all                            Display help for all targets
  help/short                          This help short screen
  lint                                Lint terraform code

Requirements

Name Version
terraform >= 0.13.0
aws >= 2.0
random >= 2.0

Providers

Name Version
aws >= 2.0
random >= 2.0

Modules

Name Source Version
ecs_web_app cloudposse/ecs-web-app/aws 0.60.0
github_webhooks cloudposse/repository-webhooks/github 0.12.0
ssh_key_pair cloudposse/ssm-tls-ssh-key-pair/aws 0.10.0
this cloudposse/label/null 0.24.1

Resources

Name Type
aws_iam_role_policy_attachment.default resource
aws_route53_record.default resource
aws_security_group_rule.egress_http resource
aws_security_group_rule.egress_https resource
aws_security_group_rule.egress_tcp_dns resource
aws_security_group_rule.egress_udp_dns resource
aws_ssm_parameter.atlantis_atlantis_url resource
aws_ssm_parameter.atlantis_cognito_user_pool_arn resource
aws_ssm_parameter.atlantis_cognito_user_pool_client_id resource
aws_ssm_parameter.atlantis_cognito_user_pool_domain resource
aws_ssm_parameter.atlantis_gh_team_whitelist resource
aws_ssm_parameter.atlantis_gh_token resource
aws_ssm_parameter.atlantis_gh_user resource
aws_ssm_parameter.atlantis_gh_webhook_secret resource
aws_ssm_parameter.atlantis_iam_role_arn resource
aws_ssm_parameter.atlantis_log_level resource
aws_ssm_parameter.atlantis_oidc_client_id resource
aws_ssm_parameter.atlantis_oidc_client_secret resource
aws_ssm_parameter.atlantis_port resource
aws_ssm_parameter.atlantis_repo_config resource
aws_ssm_parameter.atlantis_repo_whitelist resource
aws_ssm_parameter.atlantis_wake_word resource
aws_ssm_parameter.github_webhooks_token resource
random_string.atlantis_gh_webhook_secret resource
aws_kms_key.chamber_kms_key data source
aws_ssm_parameter.atlantis_cognito_user_pool_arn data source
aws_ssm_parameter.atlantis_cognito_user_pool_client_id data source
aws_ssm_parameter.atlantis_cognito_user_pool_domain data source
aws_ssm_parameter.atlantis_gh_token data source
aws_ssm_parameter.atlantis_oidc_client_id data source
aws_ssm_parameter.atlantis_oidc_client_secret data source
aws_ssm_parameter.github_webhooks_token data source

Inputs

Name Description Type Default Required
additional_tag_map Additional tags for appending to tags_as_list_of_maps. Not added to tags. map(string) {} no
alb_arn_suffix The ARN suffix of the ALB string n/a yes
alb_dns_name DNS name of ALB string n/a yes
alb_ingress_authenticated_hosts Authenticated hosts to match in Hosts header (a maximum of 1 can be defined) list(string) [] no
alb_ingress_authenticated_listener_arns A list of authenticated ALB listener ARNs to attach ALB listener rules to list(string) [] no
alb_ingress_authenticated_listener_arns_count The number of authenticated ARNs in alb_ingress_authenticated_listener_arns. This is necessary to work around a limitation in Terraform where counts cannot be computed number 0 no
alb_ingress_authenticated_paths Authenticated path pattern to match (a maximum of 1 can be defined) list(string)
[
"/*"
]
no
alb_ingress_listener_authenticated_priority The priority for the rules with authentication, between 1 and 50000 (1 being highest priority). Must be different from alb_ingress_listener_unauthenticated_priority since a listener can't have multiple rules with the same priority number 100 no
alb_ingress_listener_unauthenticated_priority The priority for the rules without authentication, between 1 and 50000 (1 being highest priority). Must be different from alb_ingress_listener_authenticated_priority since a listener can't have multiple rules with the same priority number 50 no
alb_ingress_unauthenticated_hosts Unauthenticated hosts to match in Hosts header (a maximum of 1 can be defined) list(string) [] no
alb_ingress_unauthenticated_listener_arns A list of unauthenticated ALB listener ARNs to attach ALB listener rules to list(string) [] no
alb_ingress_unauthenticated_listener_arns_count The number of unauthenticated ARNs in alb_ingress_unauthenticated_listener_arns. This is necessary to work around a limitation in Terraform where counts cannot be computed number 0 no
alb_ingress_unauthenticated_paths Unauthenticated path pattern to match (a maximum of 1 can be defined) list(string)
[
"/events"
]
no
alb_security_group Security group of the ALB string n/a yes
alb_target_group_alarms_alarm_actions A list of ARNs (i.e. SNS Topic ARN) to execute when ALB Target Group alarms transition into an ALARM state from any other state. list(string) [] no
alb_target_group_alarms_enabled A boolean to enable/disable CloudWatch Alarms for ALB Target metrics bool false no
alb_target_group_alarms_insufficient_data_actions A list of ARNs (i.e. SNS Topic ARN) to execute when ALB Target Group alarms transition into an INSUFFICIENT_DATA state from any other state. list(string) [] no
alb_target_group_alarms_ok_actions A list of ARNs (i.e. SNS Topic ARN) to execute when ALB Target Group alarms transition into an OK state from any other state. list(string) [] no
alb_zone_id The ID of the zone in which ALB is provisioned string n/a yes
atlantis_gh_team_whitelist Atlantis GitHub team whitelist string "" no
atlantis_gh_user Atlantis GitHub user string n/a yes
atlantis_gh_webhook_secret Atlantis GitHub webhook secret string "" no
atlantis_log_level Atlantis log level string "info" no
atlantis_port Atlantis container port number 4141 no
atlantis_repo_config Path to atlantis server-side repo config file (https://www.runatlantis.io/docs/server-side-repo-config.html) string "atlantis-repo-config.yaml" no
atlantis_repo_whitelist Whitelist of repositories Atlantis will accept webhooks from list(string) [] no
atlantis_url_format Template for the Atlantis URL which is populated with the hostname string "https://%s" no
atlantis_wake_word Wake world for atlantis string "atlantis" no
atlantis_webhook_format Template for the Atlantis webhook URL which is populated with the hostname string "https://%s/events" no
attributes Additional attributes (e.g. 1) list(string) [] no
authentication_cognito_user_pool_arn Cognito User Pool ARN string "" no
authentication_cognito_user_pool_arn_ssm_name SSM param name to lookup authentication_cognito_user_pool_arn if not provided string "" no
authentication_cognito_user_pool_client_id Cognito User Pool Client ID string "" no
authentication_cognito_user_pool_client_id_ssm_name SSM param name to lookup authentication_cognito_user_pool_client_id if not provided string "" no
authentication_cognito_user_pool_domain Cognito User Pool Domain. The User Pool Domain should be set to the domain prefix (xxx) instead of full domain (https://xxx.auth.us-west-2.amazoncognito.com) string "" no
authentication_cognito_user_pool_domain_ssm_name SSM param name to lookup authentication_cognito_user_pool_domain if not provided string "" no
authentication_oidc_authorization_endpoint OIDC Authorization Endpoint string "" no
authentication_oidc_client_id OIDC Client ID string "" no
authentication_oidc_client_id_ssm_name SSM param name to lookup authentication_oidc_client_id if not provided string "" no
authentication_oidc_client_secret OIDC Client Secret string "" no
authentication_oidc_client_secret_ssm_name SSM param name to lookup authentication_oidc_client_secret if not provided string "" no
authentication_oidc_issuer OIDC Issuer string "" no
authentication_oidc_token_endpoint OIDC Token Endpoint string "" no
authentication_oidc_user_info_endpoint OIDC User Info Endpoint string "" no
authentication_type Authentication type. Supported values are COGNITO and OIDC string "" no
autoscaling_enabled A boolean to enable/disable Autoscaling policy for ECS Service bool false no
autoscaling_max_capacity Atlantis maximum tasks to run number 1 no
autoscaling_min_capacity Atlantis minimum tasks to run number 1 no
branch Atlantis branch of the GitHub repository, e.g. master string "master" no
build_timeout How long in minutes, from 5 to 480 (8 hours), for AWS CodeBuild to wait until timing out any related build that does not get marked as completed. number 10 no
chamber_format Format to store parameters in SSM, for consumption with chamber string "/%s/%s" no
chamber_service SSM parameter service name for use with chamber. This is used in chamber_format where /$chamber_service/$parameter would be the default. string "atlantis" no
codepipeline_enabled A boolean to enable/disable AWS Codepipeline and ECR bool false no
codepipeline_s3_bucket_force_destroy A boolean that indicates all objects should be deleted from the CodePipeline artifact store S3 bucket so that the bucket can be destroyed without error bool false no
container_cpu Atlantis CPUs per task number 256 no
container_memory Atlantis memory per task number 512 no
container_repo_credentials Container repository credentials; required when using a private repo. This map currently supports a single key; "credentialsParameter", which should be the ARN of a Secrets Manager's secret holding the credentials map(string) null no
context Single object for setting entire context at once.
See description of individual variables for details.
Leave string and numeric variables as null to use default value.
Individual variable settings (non-null) override settings in context object,
except for attributes, tags, and additional_tag_map, which are merged.
any
{
"additional_tag_map": {},
"attributes": [],
"delimiter": null,
"enabled": true,
"environment": null,
"id_length_limit": null,
"label_key_case": null,
"label_order": [],
"label_value_case": null,
"name": null,
"namespace": null,
"regex_replace_chars": null,
"stage": null,
"tags": {}
}
no
default_backend_image ECS default (bootstrap) image string "cloudposse/default-backend:0.1.2" no
delimiter Delimiter to be used between namespace, environment, stage, name and attributes.
Defaults to - (hyphen). Set to "" to use no delimiter at all.
string null no
desired_count Atlantis desired number of tasks number 1 no
ecs_alarms_cpu_utilization_high_alarm_actions A list of ARNs (i.e. SNS Topic ARN) to notify on CPU Utilization High Alarm action list(string) [] no
ecs_alarms_cpu_utilization_high_ok_actions A list of ARNs (i.e. SNS Topic ARN) to notify on CPU Utilization High OK action list(string) [] no
ecs_alarms_cpu_utilization_low_alarm_actions A list of ARNs (i.e. SNS Topic ARN) to notify on CPU Utilization Low Alarm action list(string) [] no
ecs_alarms_cpu_utilization_low_ok_actions A list of ARNs (i.e. SNS Topic ARN) to notify on CPU Utilization Low OK action list(string) [] no
ecs_alarms_enabled A boolean to enable/disable CloudWatch Alarms for ECS Service metrics bool false no
ecs_alarms_memory_utilization_high_alarm_actions A list of ARNs (i.e. SNS Topic ARN) to notify on Memory Utilization High Alarm action list(string) [] no
ecs_alarms_memory_utilization_high_ok_actions A list of ARNs (i.e. SNS Topic ARN) to notify on Memory Utilization High OK action list(string) [] no
ecs_alarms_memory_utilization_low_alarm_actions A list of ARNs (i.e. SNS Topic ARN) to notify on Memory Utilization Low Alarm action list(string) [] no
ecs_alarms_memory_utilization_low_ok_actions A list of ARNs (i.e. SNS Topic ARN) to notify on Memory Utilization Low OK action list(string) [] no
ecs_cluster_arn ARN of the ECS cluster to deploy Atlantis string n/a yes
ecs_cluster_name Name of the ECS cluster to deploy Atlantis string n/a yes
enabled Set to false to prevent the module from creating any resources bool null no
environment Environment, e.g. 'uw2', 'us-west-2', OR 'prod', 'staging', 'dev', 'UAT' string null no
github_oauth_token GitHub OAuth token. If not provided the token is looked up from SSM string "" no
github_oauth_token_ssm_name SSM param name to lookup github_oauth_token if not provided string "" no
github_webhooks_token GitHub OAuth Token with permissions to create webhooks. If not provided the token is looked up from SSM string "" no
github_webhooks_token_ssm_name SSM param name to lookup github_webhooks_token if not provided string "" no
healthcheck_path Healthcheck path string "/healthz" no
hostname Atlantis URL string "" no
id_length_limit Limit id to this many characters (minimum 6).
Set to 0 for unlimited length.
Set to null for default, which is 0.
Does not affect id_full.
number null no
kms_key_id KMS key ID used to encrypt SSM SecureString parameters string "" no
label_key_case The letter case of label keys (tag names) (i.e. name, namespace, environment, stage, attributes) to use in tags.
Possible values: lower, title, upper.
Default value: title.
string null no
label_order The naming order of the id output and Name tag.
Defaults to ["namespace", "environment", "stage", "name", "attributes"].
You can omit any of the 5 elements, but at least one must be present.
list(string) null no
label_value_case The letter case of output label values (also used in tags and id).
Possible values: lower, title, upper and none (no transformation).
Default value: lower.
string null no
launch_type The ECS launch type (valid options: FARGATE or EC2) string "FARGATE" no
name Solution name, e.g. 'app' or 'jenkins' string null no
namespace Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' string null no
overwrite_ssm_parameter Whether to overwrite an existing SSM parameter bool true no
parent_zone_id The zone ID where the DNS record for the short_name will be written string "" no
policy_arn Permission to grant to atlantis server string "arn:aws:iam::aws:policy/AdministratorAccess" no
private_subnet_ids The private subnet IDs list(string) [] no
regex_replace_chars Regex to replace chars with empty string in namespace, environment, stage and name.
If not set, "/[^a-zA-Z0-9-]/" is used to remove all characters other than hyphens, letters and digits.
string null no
region AWS Region for S3 bucket string n/a yes
repo_name GitHub repository name of the atlantis to be built and deployed to ECS. string n/a yes
repo_owner GitHub organization containing the Atlantis repository string n/a yes
security_group_ids Additional Security Group IDs to allow into ECS Service. list(string) [] no
short_name Alantis short DNS name (e.g. atlantis) string "atlantis" no
ssh_private_key_name Atlantis SSH private key name string "atlantis_ssh_private_key" no
ssh_public_key_name Atlantis SSH public key name string "atlantis_ssh_public_key" no
stage Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' string null no
tags Additional tags (e.g. map('BusinessUnit','XYZ') map(string) {} no
use_alb_security_group A flag to enable/disable adding the ingress rule to the ALB security group bool true no
vpc_id VPC ID for the ECS Cluster string n/a yes
webhook_enabled Set to false to prevent the module from creating any webhook resources bool true no
webhook_events A list of events which should trigger the webhook. list(string)
[
"issue_comment",
"pull_request",
"pull_request_review",
"pull_request_review_comment",
"push"
]
no
webhook_secret_length GitHub webhook secret length number 32 no

Outputs

Name Description
alb_ingress_target_group_arn ALB Target Group ARN
alb_ingress_target_group_arn_suffix ALB Target Group ARN suffix
alb_ingress_target_group_name ALB Target Group name
atlantis_ssh_public_key Atlantis SSH Public Key
atlantis_url The URL endpoint for the atlantis server
atlantis_webhook_url atlantis webhook URL
codebuild_badge_url The URL of the build badge when badge_enabled is enabled
codebuild_cache_bucket_arn CodeBuild cache S3 bucket ARN
codebuild_cache_bucket_name CodeBuild cache S3 bucket name
codebuild_project_id CodeBuild project ID
codebuild_project_name CodeBuild project name
codebuild_role_arn CodeBuild IAM Role ARN
codebuild_role_id CodeBuild IAM Role ID
codepipeline_arn CodePipeline ARN
codepipeline_id CodePipeline ID
codepipeline_webhook_id The CodePipeline webhook's ID
codepipeline_webhook_url The CodePipeline webhook's URL. POST events to this endpoint to trigger the target
container_definition_json JSON encoded list of container definitions for use with other terraform resources such as aws_ecs_task_definition
container_definition_json_map JSON encoded container definitions for use with other terraform resources such as aws_ecs_task_definition
ecr_registry_id Registry ID
ecr_repository_name Repository name
ecr_repository_url Repository URL
ecs_alarms_cpu_utilization_high_cloudwatch_metric_alarm_arn ECS CPU utilization high CloudWatch metric alarm ARN
ecs_alarms_cpu_utilization_high_cloudwatch_metric_alarm_id ECS CPU utilization high CloudWatch metric alarm ID
ecs_alarms_cpu_utilization_low_cloudwatch_metric_alarm_arn ECS CPU utilization low CloudWatch metric alarm ARN
ecs_alarms_cpu_utilization_low_cloudwatch_metric_alarm_id ECS CPU utilization low CloudWatch metric alarm ID
ecs_alarms_memory_utilization_high_cloudwatch_metric_alarm_arn ECS Memory utilization high CloudWatch metric alarm ARN
ecs_alarms_memory_utilization_high_cloudwatch_metric_alarm_id ECS Memory utilization high CloudWatch metric alarm ID
ecs_alarms_memory_utilization_low_cloudwatch_metric_alarm_arn ECS Memory utilization low CloudWatch metric alarm ARN
ecs_alarms_memory_utilization_low_cloudwatch_metric_alarm_id ECS Memory utilization low CloudWatch metric alarm ID
ecs_cloudwatch_autoscaling_scale_down_policy_arn ARN of the scale down policy
ecs_cloudwatch_autoscaling_scale_up_policy_arn ARN of the scale up policy
ecs_exec_role_policy_id The ECS service role policy ID, in the form of role_name:role_policy_name
ecs_exec_role_policy_name ECS service role name
ecs_service_name ECS Service name
ecs_service_role_arn ECS Service role ARN
ecs_service_security_group_id Security Group ID of the ECS task
ecs_task_definition_family ECS task definition family
ecs_task_definition_revision ECS task definition revision
ecs_task_exec_role_arn ECS Task exec role ARN
ecs_task_exec_role_name ECS Task role name
ecs_task_role_arn ECS Task role ARN
ecs_task_role_id ECS Task role id
ecs_task_role_name ECS Task role name
httpcode_elb_5xx_count_cloudwatch_metric_alarm_arn ALB 5xx count CloudWatch metric alarm ARN
httpcode_elb_5xx_count_cloudwatch_metric_alarm_id ALB 5xx count CloudWatch metric alarm ID
httpcode_target_3xx_count_cloudwatch_metric_alarm_arn ALB Target Group 3xx count CloudWatch metric alarm ARN
httpcode_target_3xx_count_cloudwatch_metric_alarm_id ALB Target Group 3xx count CloudWatch metric alarm ID
httpcode_target_4xx_count_cloudwatch_metric_alarm_arn ALB Target Group 4xx count CloudWatch metric alarm ARN
httpcode_target_4xx_count_cloudwatch_metric_alarm_id ALB Target Group 4xx count CloudWatch metric alarm ID
httpcode_target_5xx_count_cloudwatch_metric_alarm_arn ALB Target Group 5xx count CloudWatch metric alarm ARN
httpcode_target_5xx_count_cloudwatch_metric_alarm_id ALB Target Group 5xx count CloudWatch metric alarm ID
target_response_time_average_cloudwatch_metric_alarm_arn ALB Target Group response time average CloudWatch metric alarm ARN
target_response_time_average_cloudwatch_metric_alarm_id ALB Target Group response time average CloudWatch metric alarm ID

Share the Love

Like this project? Please give it a ★ on our GitHub! (it helps us a lot)

Are you using this project or any of our other projects? Consider leaving a testimonial. =)

Related Projects

Check out these related projects.

References

For additional context, refer to some of these links.

  • atlantis - Official home of the Atlantis project

Help

Got a question? We got answers.

File a GitHub issue, send us an email or join our Slack Community.

README Commercial Support

DevOps Accelerator for Startups

We are a DevOps Accelerator. We'll help you build your cloud infrastructure from the ground up so you can own it. Then we'll show you how to operate it and stick around for as long as you need us.

Learn More

Work directly with our team of DevOps experts via email, slack, and video conferencing.

We deliver 10x the value for a fraction of the cost of a full-time engineer. Our track record is not even funny. If you want things done right and you need it done FAST, then we're your best bet.

  • Reference Architecture. You'll get everything you need from the ground up built using 100% infrastructure as code.
  • Release Engineering. You'll have end-to-end CI/CD with unlimited staging environments.
  • Site Reliability Engineering. You'll have total visibility into your apps and microservices.
  • Security Baseline. You'll have built-in governance with accountability and audit logs for all changes.
  • GitOps. You'll be able to operate your infrastructure via Pull Requests.
  • Training. You'll receive hands-on training so your team can operate what we build.
  • Questions. You'll have a direct line of communication between our teams via a Shared Slack channel.
  • Troubleshooting. You'll get help to triage when things aren't working.
  • Code Reviews. You'll receive constructive feedback on Pull Requests.
  • Bug Fixes. We'll rapidly work with you to fix any bugs in our projects.

Slack Community

Join our Open Source Community on Slack. It's FREE for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build totally sweet infrastructure.

Discourse Forums

Participate in our Discourse Forums. Here you'll find answers to commonly asked questions. Most questions will be related to the enormous number of projects we support on our GitHub. Come here to collaborate on answers, find solutions, and get ideas about the products and services we value. It only takes a minute to get started! Just sign in with SSO using your GitHub account.

Newsletter

Sign up for our newsletter that covers everything on our technology radar. Receive updates on what we're up to on GitHub as well as awesome new projects we discover.

Office Hours

Join us every Wednesday via Zoom for our weekly "Lunch & Learn" sessions. It's FREE for everyone!

zoom

Contributing

Bug Reports & Feature Requests

Please use the issue tracker to report any bugs or file feature requests.

Developing

If you are interested in being a contributor and want to get involved in developing this project or help out with our other projects, we would love to hear from you! Shoot us an email.

In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.

  1. Fork the repo on GitHub
  2. Clone the project to your own machine
  3. Commit changes to your own branch
  4. Push your work back up to your fork
  5. Submit a Pull Request so that we can review your changes

NOTE: Be sure to merge the latest changes from "upstream" before making a pull request!

Copyright

Copyright © 2017-2021 Cloud Posse, LLC

License

License

See LICENSE for full details.

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

  https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.

Trademarks

All other trademarks referenced herein are the property of their respective owners.

About

This project is maintained and funded by Cloud Posse, LLC. Like it? Please let us know by leaving a testimonial!

Cloud Posse

We're a DevOps Professional Services company based in Los Angeles, CA. We ❤️ Open Source Software.

We offer paid support on all of our projects.

Check out our other projects, follow us on twitter, apply for a job, or hire us to help with your cloud strategy and implementation.

Contributors

Josh Myers
Josh Myers
Erik Osterman
Erik Osterman
Andriy Knysh
Andriy Knysh
Igor Rodionov
Igor Rodionov

README Footer Beacon

About

Terraform module for deploying Atlantis as an ECS Task

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HCL 76.0%
  • Go 20.4%
  • Makefile 3.6%