Skip to content

Commit c4de355

Browse files
authored
BREAKING CHANGE: update internal modules to latest, replace github_organization with github_owner, bump Terraform version to >=0.13.1 (#218)
1 parent c20b132 commit c4de355

30 files changed

+146
-158
lines changed

.github/workflows/pre-commit.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
- name: Install pre-commit dependencies
9292
run: |
9393
pip install pre-commit
94-
curl -Lo ./terraform-docs.tar.gz https://github.com/terraform-docs/terraform-docs/releases/download/v0.13.0/terraform-docs-v0.13.0-$(uname)-amd64.tar.gz && tar -xzf terraform-docs.tar.gz && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/
94+
curl -Lo ./terraform-docs.tar.gz https://github.com/terraform-docs/terraform-docs/releases/download/v0.13.0/terraform-docs-v0.13.0-$(uname)-amd64.tar.gz && tar -xzf terraform-docs.tar.gz terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/
9595
curl -L "$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E "https://.+?_linux_amd64.zip")" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/
9696
- name: Execute pre-commit
9797
# Run all pre-commit checks on max version supported

README.md

+14-13
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ $ cd terraform-aws-atlantis
4646

4747
5. Run `terraform output atlantis_url` to get URL where Atlantis is publicly reachable. (Note: It may take a minute or two to get it reachable for the first time)
4848

49-
6. Github webhook is automatically created if `github_token`, `github_organization` and `github_repo_names` were specified. Read [Add GitHub Webhook](https://github.com/runatlantis/atlantis#add-github-webhook) in the official Atlantis documentation or check [example "GitHub repository webhook for Atlantis"](https://github.com/terraform-aws-modules/terraform-aws-atlantis/tree/master/examples/github-repository-webhook) to add more webhooks.
49+
6. Github webhook is automatically created if `github_token`, `github_owner` and `github_repo_names` were specified. Read [Add GitHub Webhook](https://github.com/runatlantis/atlantis#add-github-webhook) in the official Atlantis documentation or check [example "GitHub repository webhook for Atlantis"](https://github.com/terraform-aws-modules/terraform-aws-atlantis/tree/master/examples/github-repository-webhook) to add more webhooks.
5050

5151
### Run Atlantis as a Terraform module
5252

@@ -55,7 +55,7 @@ This way allows integration with your existing Terraform configurations.
5555
```hcl
5656
module "atlantis" {
5757
source = "terraform-aws-modules/atlantis/aws"
58-
version = "~> 2.0"
58+
version = "~> 3.0"
5959
6060
name = "atlantis"
6161
@@ -209,7 +209,7 @@ allow_github_webhooks = true
209209

210210
| Name | Version |
211211
|------|---------|
212-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12.26 |
212+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
213213
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.68 |
214214
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.0 |
215215

@@ -224,15 +224,15 @@ allow_github_webhooks = true
224224

225225
| Name | Source | Version |
226226
|------|--------|---------|
227-
| <a name="module_acm"></a> [acm](#module\_acm) | terraform-aws-modules/acm/aws | v2.12.0 |
228-
| <a name="module_alb"></a> [alb](#module\_alb) | terraform-aws-modules/alb/aws | v5.10.0 |
229-
| <a name="module_alb_http_sg"></a> [alb\_http\_sg](#module\_alb\_http\_sg) | terraform-aws-modules/security-group/aws//modules/http-80 | v3.17.0 |
230-
| <a name="module_alb_https_sg"></a> [alb\_https\_sg](#module\_alb\_https\_sg) | terraform-aws-modules/security-group/aws//modules/https-443 | v3.17.0 |
231-
| <a name="module_atlantis_sg"></a> [atlantis\_sg](#module\_atlantis\_sg) | terraform-aws-modules/security-group/aws | v3.17.0 |
232-
| <a name="module_container_definition_bitbucket"></a> [container\_definition\_bitbucket](#module\_container\_definition\_bitbucket) | cloudposse/ecs-container-definition/aws | v0.45.2 |
233-
| <a name="module_container_definition_github_gitlab"></a> [container\_definition\_github\_gitlab](#module\_container\_definition\_github\_gitlab) | cloudposse/ecs-container-definition/aws | v0.45.2 |
234-
| <a name="module_ecs"></a> [ecs](#module\_ecs) | terraform-aws-modules/ecs/aws | v2.5.0 |
235-
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | v2.64.0 |
227+
| <a name="module_acm"></a> [acm](#module\_acm) | terraform-aws-modules/acm/aws | v3.2.0 |
228+
| <a name="module_alb"></a> [alb](#module\_alb) | terraform-aws-modules/alb/aws | v6.5.0 |
229+
| <a name="module_alb_http_sg"></a> [alb\_http\_sg](#module\_alb\_http\_sg) | terraform-aws-modules/security-group/aws//modules/http-80 | v4.3.0 |
230+
| <a name="module_alb_https_sg"></a> [alb\_https\_sg](#module\_alb\_https\_sg) | terraform-aws-modules/security-group/aws//modules/https-443 | v4.3.0 |
231+
| <a name="module_atlantis_sg"></a> [atlantis\_sg](#module\_atlantis\_sg) | terraform-aws-modules/security-group/aws | v4.3.0 |
232+
| <a name="module_container_definition_bitbucket"></a> [container\_definition\_bitbucket](#module\_container\_definition\_bitbucket) | cloudposse/ecs-container-definition/aws | v0.58.1 |
233+
| <a name="module_container_definition_github_gitlab"></a> [container\_definition\_github\_gitlab](#module\_container\_definition\_github\_gitlab) | cloudposse/ecs-container-definition/aws | v0.58.1 |
234+
| <a name="module_ecs"></a> [ecs](#module\_ecs) | terraform-aws-modules/ecs/aws | v3.3.0 |
235+
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | v3.6.0 |
236236

237237
## Resources
238238

@@ -255,6 +255,7 @@ allow_github_webhooks = true
255255
| [aws_iam_policy_document.ecs_task_access_secrets](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
256256
| [aws_iam_policy_document.ecs_task_access_secrets_with_kms](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
257257
| [aws_iam_policy_document.ecs_tasks](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
258+
| [aws_partition.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/partition) | data source |
258259
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
259260
| [aws_route53_zone.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_zone) | data source |
260261

@@ -335,7 +336,7 @@ allow_github_webhooks = true
335336
| <a name="input_mount_points"></a> [mount\_points](#input\_mount\_points) | Container mount points. This is a list of maps, where each map should contain a `containerPath` and `sourceVolume`. The `readOnly` key is optional. | `list(any)` | `[]` | no |
336337
| <a name="input_name"></a> [name](#input\_name) | Name to use on all resources created (VPC, ALB, etc) | `string` | `"atlantis"` | no |
337338
| <a name="input_permissions_boundary"></a> [permissions\_boundary](#input\_permissions\_boundary) | If provided, all IAM roles will be created with this permissions boundary attached. | `string` | `null` | no |
338-
| <a name="input_policies_arn"></a> [policies\_arn](#input\_policies\_arn) | A list of the ARN of the policies you want to apply | `list(string)` | <pre>[<br> "arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy"<br>]</pre> | no |
339+
| <a name="input_policies_arn"></a> [policies\_arn](#input\_policies\_arn) | A list of the ARN of the policies you want to apply | `list(string)` | `null` | no |
339340
| <a name="input_private_subnet_ids"></a> [private\_subnet\_ids](#input\_private\_subnet\_ids) | A list of IDs of existing private subnets inside the VPC | `list(string)` | `[]` | no |
340341
| <a name="input_private_subnets"></a> [private\_subnets](#input\_private\_subnets) | A list of private subnets inside the VPC | `list(string)` | `[]` | no |
341342
| <a name="input_propagate_tags"></a> [propagate\_tags](#input\_propagate\_tags) | Specifies whether to propagate the tags from the task definition or the service to the tasks. The valid values are SERVICE and TASK\_DEFINITION | `string` | `null` | no |

examples/github-complete/README.md

+5-8
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ GitHub's personal access token can be generated at https://github.com/settings/t
88

99
## Usage
1010

11-
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_organization=xxx`, etc.). Once ready, execute:
11+
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:
1212

1313
```bash
1414
$ terraform init
@@ -29,9 +29,9 @@ Go to https://eu-west-1.console.aws.amazon.com/ecs/home?region=eu-west-1#/settin
2929

3030
| Name | Version |
3131
|------|---------|
32-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12.26 |
32+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
3333
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.68 |
34-
| <a name="requirement_github"></a> [github](#requirement\_github) | >= 2.4.1 |
34+
| <a name="requirement_github"></a> [github](#requirement\_github) | >= 4.8 |
3535

3636
## Providers
3737

@@ -44,7 +44,7 @@ Go to https://eu-west-1.console.aws.amazon.com/ecs/home?region=eu-west-1#/settin
4444
| Name | Source | Version |
4545
|------|--------|---------|
4646
| <a name="module_atlantis"></a> [atlantis](#module\_atlantis) | ../../ | |
47-
| <a name="module_atlantis_access_log_bucket"></a> [atlantis\_access\_log\_bucket](#module\_atlantis\_access\_log\_bucket) | terraform-aws-modules/s3-bucket/aws | >= 1.9 |
47+
| <a name="module_atlantis_access_log_bucket"></a> [atlantis\_access\_log\_bucket](#module\_atlantis\_access\_log\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 2 |
4848
| <a name="module_github_repository_webhook"></a> [github\_repository\_webhook](#module\_github\_repository\_webhook) | ../../modules/github-repository-webhook | |
4949

5050
## Resources
@@ -63,12 +63,9 @@ Go to https://eu-west-1.console.aws.amazon.com/ecs/home?region=eu-west-1#/settin
6363
| <a name="input_alb_ingress_cidr_blocks"></a> [alb\_ingress\_cidr\_blocks](#input\_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 |
6464
| <a name="input_allowed_repo_names"></a> [allowed\_repo\_names](#input\_allowed\_repo\_names) | Repositories that Atlantis will listen for events from and a webhook will be installed | `list(string)` | n/a | yes |
6565
| <a name="input_domain"></a> [domain](#input\_domain) | Route53 domain name to use for ACM certificate. Route53 zone for this domain should be created in advance | `string` | n/a | yes |
66-
| <a name="input_github_organization"></a> [github\_organization](#input\_github\_organization) | Github organization | `string` | n/a | yes |
66+
| <a name="input_github_owner"></a> [github\_owner](#input\_github\_owner) | Github owner | `string` | n/a | yes |
6767
| <a name="input_github_token"></a> [github\_token](#input\_github\_token) | Github token | `string` | n/a | yes |
6868
| <a name="input_github_user"></a> [github\_user](#input\_github\_user) | Github user for Atlantis to utilize when performing Github activities | `string` | n/a | yes |
69-
| <a name="input_region"></a> [region](#input\_region) | AWS region where resources will be created | `string` | `"us-east-1"` | no |
70-
| <a name="input_trusted_entities"></a> [trusted\_entities](#input\_trusted\_entities) | A list of users or roles, that can assume the task role | `list(string)` | `[]` | no |
71-
| <a name="input_trusted_principals"></a> [trusted\_principals](#input\_trusted\_principals) | A list of principals, in addition to ecs-tasks.amazonaws.com, that can assume the task role | `list(string)` | n/a | yes |
7269

7370
## Outputs
7471

examples/github-complete/main.tf

+17-15
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
provider "aws" {
2-
region = var.region
2+
region = local.region
33
}
44

55
locals {
6+
name = "github-complete"
7+
region = "eu-west-1"
8+
69
tags = {
710
Owner = "user"
811
Environment = "dev"
912
}
1013
}
1114

12-
##############################################################
13-
# Data sources for existing resources
14-
##############################################################
15+
################################################################################
16+
# Supporting Resources
17+
################################################################################
1518

1619
data "aws_caller_identity" "current" {}
1720

@@ -26,11 +29,11 @@ data "aws_elb_service_account" "current" {}
2629
module "atlantis" {
2730
source = "../../"
2831

29-
name = "atlantiscomplete"
32+
name = local.name
3033

3134
# VPC
3235
cidr = "10.20.0.0/16"
33-
azs = ["${var.region}a", "${var.region}b", "${var.region}c"]
36+
azs = ["${local.region}a", "${local.region}b", "${local.region}c"]
3437
private_subnets = ["10.20.1.0/24", "10.20.2.0/24", "10.20.3.0/24"]
3538
public_subnets = ["10.20.101.0/24", "10.20.102.0/24", "10.20.103.0/24"]
3639

@@ -62,17 +65,16 @@ module "atlantis" {
6265
hardLimit = 16384
6366
}]
6467

65-
# Security
66-
trusted_principals = var.trusted_principals
67-
trusted_entities = var.trusted_entities
68-
6968
# DNS
7069
route53_zone_name = var.domain
7170

71+
# Trusted roles
72+
trusted_principals = ["ssm.amazonaws.com"]
73+
7274
# Atlantis
7375
atlantis_github_user = var.github_user
7476
atlantis_github_user_token = var.github_token
75-
atlantis_repo_allowlist = ["github.com/${var.github_organization}/*"]
77+
atlantis_repo_allowlist = ["github.com/${var.github_owner}/*"]
7678
atlantis_allowed_repo_names = var.allowed_repo_names
7779

7880
# ALB access
@@ -97,8 +99,8 @@ module "atlantis" {
9799
module "github_repository_webhook" {
98100
source = "../../modules/github-repository-webhook"
99101

100-
github_organization = var.github_organization
101-
github_token = var.github_token
102+
github_owner = var.github_owner
103+
github_token = var.github_token
102104

103105
atlantis_allowed_repo_names = module.atlantis.atlantis_allowed_repo_names
104106

@@ -111,9 +113,9 @@ module "github_repository_webhook" {
111113
################################################################################
112114
module "atlantis_access_log_bucket" {
113115
source = "terraform-aws-modules/s3-bucket/aws"
114-
version = ">= 1.9"
116+
version = "~> 2"
115117

116-
bucket = "${data.aws_caller_identity.current.account_id}-atlantis-access-logs-${data.aws_region.current.name}"
118+
bucket = "atlantis-access-logs-${data.aws_caller_identity.current.account_id}-${data.aws_region.current.name}"
117119

118120
attach_policy = true
119121
policy = data.aws_iam_policy_document.atlantis_access_log_bucket_policy.json

examples/github-complete/outputs.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ output "ecs_task_definition" {
2222
# Webhooks
2323
output "github_webhook_urls" {
2424
description = "Github webhook URL"
25-
value = module.github_repository_webhook.this_repository_webhook_urls
25+
value = module.github_repository_webhook.repository_webhook_urls
2626
}
2727

2828
output "github_webhook_secret" {
2929
description = "Github webhook secret"
30-
value = module.github_repository_webhook.this_repository_webhook_secret
30+
value = module.github_repository_webhook.repository_webhook_secret
3131
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
region = "eu-west-1"
21
domain = "mydomain.com"
32
alb_ingress_cidr_blocks = ["x.x.x.x/32"]
4-
github_organization = "myorg"
3+
github_owner = "myorg"
54
github_user = "atlantis"
65
github_token = "mygithubpersonalaccesstokenforatlantis"
76
allowed_repo_names = ["repo1", "repo2"]
8-
trusted_principals = ["ssm.amazonaws.com"] # Convenient if you want to enable SSM access into Atlantis for troubleshooting etc

examples/github-complete/variables.tf

+2-19
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
variable "region" {
2-
description = "AWS region where resources will be created"
3-
type = string
4-
default = "us-east-1"
5-
}
6-
71
variable "domain" {
82
description = "Route53 domain name to use for ACM certificate. Route53 zone for this domain should be created in advance"
93
type = string
@@ -19,8 +13,8 @@ variable "github_token" {
1913
type = string
2014
}
2115

22-
variable "github_organization" {
23-
description = "Github organization"
16+
variable "github_owner" {
17+
description = "Github owner"
2418
type = string
2519
}
2620

@@ -33,14 +27,3 @@ variable "allowed_repo_names" {
3327
description = "Repositories that Atlantis will listen for events from and a webhook will be installed"
3428
type = list(string)
3529
}
36-
37-
variable "trusted_principals" {
38-
description = "A list of principals, in addition to ecs-tasks.amazonaws.com, that can assume the task role"
39-
type = list(string)
40-
}
41-
42-
variable "trusted_entities" {
43-
description = "A list of users or roles, that can assume the task role"
44-
type = list(string)
45-
default = []
46-
}

examples/github-complete/versions.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
terraform {
2-
required_version = ">= 0.12.26"
2+
required_version = ">= 0.13.1"
33

44
required_providers {
55
aws = {
@@ -9,7 +9,7 @@ terraform {
99

1010
github = {
1111
source = "integrations/github"
12-
version = ">= 2.4.1"
12+
version = ">= 4.8"
1313
}
1414
}
1515
}

examples/github-repository-webhook/README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# GitHub repository webhook for Atlantis
22

3-
Configuration in this directory creates GitHub repository webhooks configured to Atlantis URL. This example uses value of webhook secret which got generated when Atlantis setup by referring to `terraform.tfstate`, so this example has to run after Atlantis.
3+
Configuration in this directory creates GitHub repository webhooks configured to Atlantis URL. This example uses value of webhook secret which got generated when Atlantis setup by referring to `terraform.tfstate`, so this example has to run after Atlantis.
44

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

77
## Usage
88

9-
To run this code you need to copy `terraform.tfvars.sample` into `terraform.tfvars` and put your GitHub token and Github organization there or specify them using environment variables (`TF_VAR_github_token` and `TF_VAR_github_organization`). Once ready, execute:
9+
To run this code you need to copy `terraform.tfvars.sample` into `terraform.tfvars` and put your GitHub token and Github owner there or specify them using environment variables (`TF_VAR_github_token` and `TF_VAR_github_owner`). Once ready, execute:
1010

1111
```bash
1212
$ terraform init
@@ -21,9 +21,9 @@ Note that this example may create resources which cost money. Run `terraform des
2121

2222
| Name | Version |
2323
|------|---------|
24-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12.26 |
24+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
2525
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.68 |
26-
| <a name="requirement_github"></a> [github](#requirement\_github) | >= 2.4.1 |
26+
| <a name="requirement_github"></a> [github](#requirement\_github) | >= 4.8 |
2727

2828
## Providers
2929

@@ -47,7 +47,7 @@ Note that this example may create resources which cost money. Run `terraform des
4747

4848
| Name | Description | Type | Default | Required |
4949
|------|-------------|------|---------|:--------:|
50-
| <a name="input_github_organization"></a> [github\_organization](#input\_github\_organization) | Github organization | `string` | n/a | yes |
50+
| <a name="input_github_owner"></a> [github\_owner](#input\_github\_owner) | Github owner | `string` | n/a | yes |
5151
| <a name="input_github_token"></a> [github\_token](#input\_github\_token) | Github token | `string` | n/a | yes |
5252

5353
## Outputs

0 commit comments

Comments
 (0)