Skip to content

Commit

Permalink
adding config + pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorOKane-Kainos committed Jul 4, 2024
1 parent 317125a commit a622162
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 37 deletions.
54 changes: 27 additions & 27 deletions components/locals.tf
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
# locals {
# // List of included repositories, taken directly from the 'repositories' variable
# included_repositories = var.repositories

# // Create combinations of repositories and branches by flattening a nested loop
# repo_branch_combinations = flatten([
# // Iterate over each repository in the included_repositories list
# for repo in local.included_repositories : [
# // For each repository, iterate over each branch in the 'branches' variable
# for branch in var.branches : {
# // Create a map with the repository and branch names
# repo = repo
# branch = branch
# }
# ]
# ])
# }

locals {
# Read the repositories list from the JSON file
repositories_list = jsondecode(file("${path.module}/../test-repos.json"))

# Filter out excluded repositories
included_repositories = [
for repo in local.repositories_list : repo
if !contains(var.excluded_repositories, repo)
]
// List of included repositories, taken directly from the 'repositories' variable
included_repositories = var.repositories

# Create a combination of repositories and branches
// Create combinations of repositories and branches by flattening a nested loop
repo_branch_combinations = flatten([
// Iterate over each repository in the included_repositories list
for repo in local.included_repositories : [
// For each repository, iterate over each branch in the 'branches' variable
for branch in var.branches : {
// Create a map with the repository and branch names
repo = repo
branch = branch
}
]
])
}

# locals {
# # Read the repositories list from the JSON file
# repositories_list = jsondecode(file("${path.module}/../test-repos.json"))

# # Filter out excluded repositories
# included_repositories = [
# for repo in local.repositories_list : repo
# if !contains(var.excluded_repositories, repo)
# ]

# # Create a combination of repositories and branches
# repo_branch_combinations = flatten([
# for repo in local.included_repositories : [
# for branch in var.branches : {
# repo = repo
# branch = branch
# }
# ]
# ])
# }




Expand Down
10 changes: 9 additions & 1 deletion components/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,12 @@ output "common_tags" {
Product = var.product
BuiltFrom = var.builtFrom
}
}
}

output "included_repositories" {
value = local.included_repositories
}

output "repo_branch_combinations" {
value = local.repo_branch_combinations
}
20 changes: 11 additions & 9 deletions components/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
# sensitive = true
# }

# variable "repositories" {
# description = "List of repositories to apply branch protection rules"
# type = list(string)
# default = [
# "rule-set-test-repo",
# "rule-set-test-repo1",
# "rule-set-test-repo2"
# ]
# }
variable "repositories" {
description = "List of repositories to apply branch protection rules"
type = list(string)
default = [
"rule-set-test-repo",
"rule-set-test-repo1",
"rule-set-test-repo2",
"rule-set-test-repo3",
"rule-set-test-repo4"
]
}

variable "branches" {
description = "List of branches to apply protection rules"
Expand Down

0 comments on commit a622162

Please sign in to comment.