Skip to content

Commit

Permalink
Support Atlantis deployments for sandobx repos that are on a personal…
Browse files Browse the repository at this point in the history
… account (#1507)

instead of an organization account
  • Loading branch information
avnes authored Aug 9, 2024
1 parent 5e338aa commit 65832f7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions _sub/compute/helm-atlantis/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,15 @@ resource "github_repository_webhook" "hook" {
}

resource "github_actions_organization_secret" "atlantis_username" {
count = var.enable_github_secrets ? 1 : 0
secret_name = "${upper(var.environment)}_ATLANTIS_USERNAME"
visibility = "selected"
plaintext_value = var.auth_username
selected_repository_ids = data.github_repository.repo.*.repo_id
}

resource "github_actions_organization_secret" "atlantis_password" {
count = var.enable_github_secrets ? 1 : 0
secret_name = "${upper(var.environment)}_ATLANTIS_PASSWORD"
visibility = "selected"
plaintext_value = random_password.password.result
Expand Down
8 changes: 7 additions & 1 deletion _sub/compute/helm-atlantis/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,10 @@ variable "add_secret_volumes" {
type = bool
default = false
description = "Add secret volumes to the Atlantis deployment. Requires a secret deployed named 'kubeconfigs'"
}
}

variable "enable_github_secrets" {
type = bool
default = true
description = "Enable Github secrets for Atlantis"
}
1 change: 1 addition & 0 deletions compute/k8s-services/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ module "atlantis" {
webhook_events = var.atlantis_webhook_events
environment = var.atlantis_environment
add_secret_volumes = var.atlantis_add_secret_volumes
enable_github_secrets = var.atlantis_enable_github_secrets

environment_variables = local.atlantis_env_vars

Expand Down
6 changes: 6 additions & 0 deletions compute/k8s-services/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,12 @@ variable "atlantis_environment" {
default = ""
}

variable "atlantis_enable_github_secrets" {
type = bool
default = true
description = "Enable Github secrets for Atlantis"
}

# --------------------------------------------------
# Atlantis variables
# --------------------------------------------------
Expand Down

0 comments on commit 65832f7

Please sign in to comment.