Skip to content

Latest commit

 

History

History
80 lines (58 loc) · 4.82 KB

File metadata and controls

80 lines (58 loc) · 4.82 KB

Complete Atlantis example with GitHub Webhooks

Configuration in this directory creates the necessary infrastructure and resources for running Atlantis on Fargate plus GitHub repository webhooks configured to Atlantis URL.

An existing Route53 hosted zone and domain is required to deploy this example.

GitHub's personal access token can be generated at https://github.com/settings/tokens

Usage

To run this code you need to copy terraform.tfvars.sample into terraform.tfvars and update the values locally or specify them using environment variables (TF_VAR_github_token=xxx, TF_VAR_github_owner=xxx, etc.). Once ready, execute:

$ terraform init
$ terraform plan
$ terraform apply

Note - if you receive the following error when running apply:

Error: InvalidParameterException: The new ARN and resource ID format must be enabled to add tags to the service. Opt in to the new format and try again. "atlantiscomplete"

Go to https://eu-west-1.console.aws.amazon.com/ecs/home?region=eu-west-1#/settings (update for your region of use) and change Container instance, Service, and Task to Enabled.

⚠️ This example will create resources which cost money. Run terraform destroy when you don't need these resources. ⚠️

Requirements

Name Version
terraform >= 0.13.1
aws >= 3.69
github >= 4.8

Providers

Name Version
aws >= 3.69

Modules

Name Source Version
atlantis ../../ n/a
atlantis_access_log_bucket terraform-aws-modules/s3-bucket/aws ~> 3.0
github_repository_webhook ../../modules/github-repository-webhook n/a

Resources

Name Type
aws_caller_identity.current data source
aws_elb_service_account.current data source
aws_iam_policy_document.atlantis_access_log_bucket_policy data source
aws_region.current data source

Inputs

Name Description Type Default Required
alb_ingress_cidr_blocks List of IPv4 CIDR ranges to use on all ingress rules of the ALB - use your personal IP in the form of x.x.x.x/32 for restricted testing list(string) n/a yes
domain Route53 domain name to use for ACM certificate. Route53 zone for this domain should be created in advance string n/a yes
github_owner Github owner string n/a yes
github_repo_names List of Github repositories that should be monitored by Atlantis list(string) n/a yes
github_token Github token string n/a yes
github_user Github user for Atlantis to utilize when performing Github activities string n/a yes

Outputs

Name Description
atlantis_repo_allowlist Git repositories where webhook should be created
atlantis_url URL of Atlantis
ecs_task_definition Task definition for ECS service (used for external triggers)
github_webhook_secret Github webhook secret
github_webhook_urls Github webhook URL
task_role_arn The Atlantis ECS task role arn