Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ module "atlantis" {

custom_environment_variables = [
{
"name" : "ATLANTIS_REPO_CONFIG_JSON",
"value" : jsonencode(yamldecode(file("${path.module}/server-atlantis.yaml"))),
name : "ATLANTIS_REPO_CONFIG_JSON",
value : jsonencode(yamldecode(file("${path.module}/server-atlantis.yaml"))),
},
]

Expand Down Expand Up @@ -297,7 +297,6 @@ allow_github_webhooks = true
| <a name="input_allow_unauthenticated_access"></a> [allow\_unauthenticated\_access](#input\_allow\_unauthenticated\_access) | Whether to create ALB listener rule to allow unauthenticated access for certain CIDR blocks (eg. allow GitHub webhooks to bypass OIDC authentication) | `bool` | `false` | no |
| <a name="input_allow_unauthenticated_access_priority"></a> [allow\_unauthenticated\_access\_priority](#input\_allow\_unauthenticated\_access\_priority) | ALB listener rule priority for allow unauthenticated access rule | `number` | `10` | no |
| <a name="input_allow_unauthenticated_webhook_access_priority"></a> [allow\_unauthenticated\_webhook\_access\_priority](#input\_allow\_unauthenticated\_webhook\_access\_priority) | ALB listener rule priority for allow unauthenticated webhook access rule | `number` | `15` | no |
| <a name="input_atlantis_allowed_repo_names"></a> [atlantis\_allowed\_repo\_names](#input\_atlantis\_allowed\_repo\_names) | Git repositories where webhook should be created | `list(string)` | `[]` | no |
| <a name="input_atlantis_bitbucket_base_url"></a> [atlantis\_bitbucket\_base\_url](#input\_atlantis\_bitbucket\_base\_url) | Base URL of Bitbucket Server, use for Bitbucket on prem (Stash) | `string` | `""` | no |
| <a name="input_atlantis_bitbucket_user"></a> [atlantis\_bitbucket\_user](#input\_atlantis\_bitbucket\_user) | Bitbucket username that is running the Atlantis command | `string` | `""` | no |
| <a name="input_atlantis_bitbucket_user_token"></a> [atlantis\_bitbucket\_user\_token](#input\_atlantis\_bitbucket\_user\_token) | Bitbucket token of the user that is running the Atlantis command | `string` | `""` | no |
Expand Down Expand Up @@ -399,7 +398,7 @@ allow_github_webhooks = true
| <a name="output_alb_https_listeners_id"></a> [alb\_https\_listeners\_id](#output\_alb\_https\_listeners\_id) | Ids of alb https listeners |
| <a name="output_alb_security_group_id"></a> [alb\_security\_group\_id](#output\_alb\_security\_group\_id) | Security group of alb |
| <a name="output_alb_zone_id"></a> [alb\_zone\_id](#output\_alb\_zone\_id) | Zone ID of alb |
| <a name="output_atlantis_allowed_repo_names"></a> [atlantis\_allowed\_repo\_names](#output\_atlantis\_allowed\_repo\_names) | Git repositories where webhook should be created |
| <a name="output_atlantis_repo_allowlist"></a> [atlantis\_repo\_allowlist](#output\_atlantis\_repo\_allowlist) | Git repositories where webhook should be created |
| <a name="output_atlantis_url"></a> [atlantis\_url](#output\_atlantis\_url) | URL of Atlantis |
| <a name="output_atlantis_url_events"></a> [atlantis\_url\_events](#output\_atlantis\_url\_events) | Webhook events URL of Atlantis |
| <a name="output_ecs_cluster_arn"></a> [ecs\_cluster\_arn](#output\_ecs\_cluster\_arn) | ECS cluster ARN |
Expand Down
3 changes: 1 addition & 2 deletions examples/github-complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ Go to https://eu-west-1.console.aws.amazon.com/ecs/home?region=eu-west-1#/settin
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <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 |
| <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 |
| <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 |
| <a name="input_github_owner"></a> [github\_owner](#input\_github\_owner) | Github owner | `string` | n/a | yes |
| <a name="input_github_token"></a> [github\_token](#input\_github\_token) | Github token | `string` | n/a | yes |
Expand All @@ -71,7 +70,7 @@ Go to https://eu-west-1.console.aws.amazon.com/ecs/home?region=eu-west-1#/settin

| Name | Description |
|------|-------------|
| <a name="output_atlantis_allowed_repo_names"></a> [atlantis\_allowed\_repo\_names](#output\_atlantis\_allowed\_repo\_names) | Git repositories where webhook should be created |
| <a name="output_atlantis_repo_allowlist"></a> [atlantis\_repo\_allowlist](#output\_atlantis\_repo\_allowlist) | Git repositories where webhook should be created |
| <a name="output_atlantis_url"></a> [atlantis\_url](#output\_atlantis\_url) | URL of Atlantis |
| <a name="output_ecs_task_definition"></a> [ecs\_task\_definition](#output\_ecs\_task\_definition) | Task definition for ECS service (used for external triggers) |
| <a name="output_github_webhook_secret"></a> [github\_webhook\_secret](#output\_github\_webhook\_secret) | Github webhook secret |
Expand Down
9 changes: 4 additions & 5 deletions examples/github-complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,9 @@ module "atlantis" {
trusted_principals = ["ssm.amazonaws.com"]

# Atlantis
atlantis_github_user = var.github_user
atlantis_github_user_token = var.github_token
atlantis_repo_allowlist = ["github.com/${var.github_owner}/*"]
atlantis_allowed_repo_names = var.allowed_repo_names
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this variable is also used in the webhook sub-module - we will need to somehow accommodate that as well with this change otherwise it breaks the webhooks. even though atlantis doesn't use this param anymore, we still need to repo names for the webhooks

 # module.github_repository_webhook.github_repository_webhook.this[0] must be replaced
-/+ resource "github_repository_webhook" "this" {
      + etag       = (known after apply)
      ~ id         = "xxxxxxxxx" -> (known after apply)
      ~ repository = "scritchity-scratch" -> "github.com/clowdhaus/*" # forces replacement
      ~ url        = "https://api.github.com/repos/clowdhaus/scritchity-scratch/hooks/xxxxxxxxx" -> (known after apply)
        # (2 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bryantbiggs thanks for your comment, but I think you are missing, that instead of atlantis_allowed_repo_names is removed, it is renamed to atlantis_repo_allowlist for consistency naming in submodules as well.

Please check this commit 3849654

Now both module and submodules are using the same naming and also the same list of repositories.

Is there any reason, that those two repository lists (white-list for atlantis + webhooked repositories) should be separated?

atlantis_github_user = var.github_user
atlantis_github_user_token = var.github_token
atlantis_repo_allowlist = ["github.com/${var.github_owner}/*"]

# ALB access
alb_ingress_cidr_blocks = var.alb_ingress_cidr_blocks
Expand All @@ -102,7 +101,7 @@ module "github_repository_webhook" {
github_owner = var.github_owner
github_token = var.github_token

atlantis_allowed_repo_names = module.atlantis.atlantis_allowed_repo_names
atlantis_repo_allowlist = module.atlantis.atlantis_repo_allowlist

webhook_url = module.atlantis.atlantis_url_events
webhook_secret = module.atlantis.webhook_secret
Expand Down
4 changes: 2 additions & 2 deletions examples/github-complete/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ output "atlantis_url" {
value = module.atlantis.atlantis_url
}

output "atlantis_allowed_repo_names" {
output "atlantis_repo_allowlist" {
description = "Git repositories where webhook should be created"
value = module.atlantis.atlantis_allowed_repo_names
value = module.atlantis.atlantis_repo_allowlist
}

output "task_role_arn" {
Expand Down
5 changes: 0 additions & 5 deletions examples/github-complete/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,3 @@ variable "github_user" {
description = "Github user for Atlantis to utilize when performing Github activities"
type = string
}

variable "allowed_repo_names" {
description = "Repositories that Atlantis will listen for events from and a webhook will be installed"
type = list(string)
}
2 changes: 1 addition & 1 deletion examples/github-repository-webhook/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module "github_repository_webhook" {
#
# This assumes that you are the owner of these repositories and they are available at:
# https://github.com/mygithubusername/awesome-repo and https://github.com/mygithubusername/another-awesome-repo
atlantis_allowed_repo_names = data.terraform_remote_state.atlantis.outputs.atlantis_allowed_repo_names
atlantis_repo_allowlist = data.terraform_remote_state.atlantis.outputs.atlantis_repo_allowlist

webhook_url = element(data.terraform_remote_state.atlantis.outputs.github_webhook_urls, 0)
webhook_secret = data.terraform_remote_state.atlantis.outputs.github_webhook_secret
Expand Down
6 changes: 3 additions & 3 deletions examples/gitlab-repository-webhook/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module "gitlab_repository_webhook" {
gitlab_base_url = var.gitlab_base_url

# Fetching these attributes from created already Atlantis Terraform state file
atlantis_allowed_repo_names = data.terraform_remote_state.atlantis.outputs.atlantis_allowed_repo_names
webhook_url = data.terraform_remote_state.atlantis.outputs.atlantis_url_events
webhook_secret = data.terraform_remote_state.atlantis.outputs.webhook_secret
atlantis_repo_allowlist = data.terraform_remote_state.atlantis.outputs.atlantis_repo_allowlist
webhook_url = data.terraform_remote_state.atlantis.outputs.atlantis_url_events
webhook_secret = data.terraform_remote_state.atlantis.outputs.webhook_secret
}
2 changes: 1 addition & 1 deletion modules/github-repository-webhook/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ No modules.

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_atlantis_allowed_repo_names"></a> [atlantis\_allowed\_repo\_names](#input\_atlantis\_allowed\_repo\_names) | List of names of repositories which belong to the owner specified in `github_owner` | `list(string)` | n/a | yes |
| <a name="input_atlantis_repo_allowlist"></a> [atlantis\_repo\_allowlist](#input\_atlantis\_repo\_allowlist) | List of names of repositories which belong to the owner specified in `github_owner` | `list(string)` | n/a | yes |
| <a name="input_create_github_repository_webhook"></a> [create\_github\_repository\_webhook](#input\_create\_github\_repository\_webhook) | Whether to create Github repository webhook for Atlantis | `bool` | `true` | no |
| <a name="input_github_base_url"></a> [github\_base\_url](#input\_github\_base\_url) | Github base URL to use when creating webhook (when using GitHub Enterprise) | `string` | `null` | no |
| <a name="input_github_owner"></a> [github\_owner](#input\_github\_owner) | Github owner to use when creating webhook | `string` | `""` | no |
Expand Down
4 changes: 2 additions & 2 deletions modules/github-repository-webhook/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ provider "github" {
}

resource "github_repository_webhook" "this" {
count = var.create_github_repository_webhook ? length(var.atlantis_allowed_repo_names) : 0
count = var.create_github_repository_webhook ? length(var.atlantis_repo_allowlist) : 0

repository = var.atlantis_allowed_repo_names[count.index]
repository = var.atlantis_repo_allowlist[count.index]

configuration {
url = var.webhook_url
Expand Down
2 changes: 1 addition & 1 deletion modules/github-repository-webhook/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ variable "github_owner" {
default = ""
}

variable "atlantis_allowed_repo_names" {
variable "atlantis_repo_allowlist" {
description = "List of names of repositories which belong to the owner specified in `github_owner`"
type = list(string)
}
Expand Down
2 changes: 1 addition & 1 deletion modules/gitlab-repository-webhook/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ No modules.

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_atlantis_allowed_repo_names"></a> [atlantis\_allowed\_repo\_names](#input\_atlantis\_allowed\_repo\_names) | List of names of repositories which belong to the `gitlab_base_url` specified | `list(string)` | n/a | yes |
| <a name="input_atlantis_repo_allowlist"></a> [atlantis\_repo\_allowlist](#input\_atlantis\_repo\_allowlist) | List of names of repositories which belong to the `gitlab_base_url` specified | `list(string)` | n/a | yes |
| <a name="input_create_gitlab_repository_webhook"></a> [create\_gitlab\_repository\_webhook](#input\_create\_gitlab\_repository\_webhook) | Whether to create Gitlab repository webhook for Atlantis | `bool` | `true` | no |
| <a name="input_gitlab_base_url"></a> [gitlab\_base\_url](#input\_gitlab\_base\_url) | Gitlab base\_url use | `string` | `""` | no |
| <a name="input_gitlab_token"></a> [gitlab\_token](#input\_gitlab\_token) | Gitlab token to use when creating webhook | `string` | `""` | no |
Expand Down
4 changes: 2 additions & 2 deletions modules/gitlab-repository-webhook/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ provider "gitlab" {
}

resource "gitlab_project_hook" "this" {
count = var.create_gitlab_repository_webhook ? length(var.atlantis_allowed_repo_names) : 0
count = var.create_gitlab_repository_webhook ? length(var.atlantis_repo_allowlist) : 0

project = var.atlantis_allowed_repo_names[count.index]
project = var.atlantis_repo_allowlist[count.index]
url = var.webhook_url
token = var.webhook_secret
enable_ssl_verification = false
Expand Down
2 changes: 1 addition & 1 deletion modules/gitlab-repository-webhook/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ variable "gitlab_token" {
default = ""
}

variable "atlantis_allowed_repo_names" {
variable "atlantis_repo_allowlist" {
description = "List of names of repositories which belong to the `gitlab_base_url` specified"
type = list(string)
}
Expand Down
4 changes: 2 additions & 2 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ output "atlantis_url_events" {
value = local.atlantis_url_events
}

output "atlantis_allowed_repo_names" {
output "atlantis_repo_allowlist" {
description = "Git repositories where webhook should be created"
value = var.atlantis_allowed_repo_names
value = var.atlantis_repo_allowlist
}

output "webhook_secret" {
Expand Down
1 change: 0 additions & 1 deletion terraform.tfvars.sample
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ route53_zone_name = "example.com"
ecs_service_assign_public_ip = true

# Atlantis
atlantis_allowed_repo_names = ["awesome-repo", "another-awesome-repo"]
atlantis_repo_allowlist = ["github.com/terraform-aws-modules/*"]

# Specify one of the following block.
Expand Down
6 changes: 0 additions & 6 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -517,12 +517,6 @@ variable "atlantis_repo_allowlist" {
type = list(string)
}

variable "atlantis_allowed_repo_names" {
description = "Git repositories where webhook should be created"
type = list(string)
default = []
}

variable "allow_repo_config" {
description = "When true allows the use of atlantis.yaml config files within the source repos."
type = string
Expand Down