Skip to content

Commit

Permalink
Refactor module configurations to enable dynamic management of extra …
Browse files Browse the repository at this point in the history
…files and update enable_all_modules variable for improved flexibility
  • Loading branch information
arnol377 committed Apr 14, 2025
1 parent 7e9ae4e commit 7d6c616
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
2 changes: 1 addition & 1 deletion locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ locals {
environment = var.environment
region = var.region
cluster_dir = "platform-cluster"
enable_all_modules = false
enable_all_modules = var.enable_all_modules
account = {
account_name = var.cluster_config.account_name
aws_account_id = var.cluster_config.aws_account_id
Expand Down
16 changes: 10 additions & 6 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ module "github_repo" {
github_has_wiki = true
github_has_projects = true

managed_extra_files = local.managed_extra_files
managed_extra_files = concat(
local.managed_extra_files,
var.managed_extra_files
)
extra_files = var.extra_files
}

resource "null_resource" "trigger_workflow" {
Expand All @@ -25,11 +29,11 @@ resource "null_resource" "trigger_workflow" {
provisioner "local-exec" {
command = "python3 scripts/trigger_workflow.py ${module.github_repo.full_name} cluster-plan '{\"environment\":\"${var.environment}\",\"region\":\"${var.region}\",\"cluster_dir\":\"${var.cluster_config.cluster_name}\",\"auto_approve\":true}'"

environment = {
GITHUB_TOKEN = var.github_token
GITHUB_OWNER = var.organization
GITHUB_SERVER_URL = var.github_server_url
}
# environment = {
# GITHUB_TOKEN = var.github_token
# GITHUB_OWNER = var.organization
# GITHUB_SERVER_URL = var.github_server_url
# }
}

depends_on = [module.github_repo]
Expand Down
24 changes: 24 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,28 @@ variable "github_server_url" {
description = "GitHub Enterprise server URL (e.g., https://github.e.it.census.gov)"
type = string
default = "https://api.github.com"
}

variable enable_all_modules {
description = "Enable all modules"
type = bool
default = false
}

variable "managed_extra_files" {
description = "List of extra files to manage in the repository"
type = list(object({
path = string
content = string
}))
default = []
}

variable "extra_files" {
description = "List of extra files to add to the repository"
type = list(object({
path = string
content = string
}))
default = []
}

0 comments on commit 7d6c616

Please sign in to comment.