From 91fe271d3548e879e62ee8168c54873a80ff81e4 Mon Sep 17 00:00:00 2001 From: levgorbunov1 Date: Wed, 23 Oct 2024 10:32:16 +0100 Subject: [PATCH 1/5] poc topic --- main.tf | 6 +++++- variables.tf | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index bca5fe7..b8229d9 100644 --- a/main.tf +++ b/main.tf @@ -1,6 +1,10 @@ # Repository basics #tfsec:ignore:github-repositories-private +locals { + complete_topics = var.poc == true ? concat(var.topics, ["poc"]) : var.topics +} + resource "github_repository" "default" { name = var.name description = join(" • ", [var.description, "This repository is defined and managed in Terraform"]) @@ -20,7 +24,7 @@ resource "github_repository" "default" { archived = false archive_on_destroy = var.archive_on_destroy vulnerability_alerts = true - topics = var.topics + topics = local.complete_topics security_and_analysis { dynamic "advanced_security" { diff --git a/variables.tf b/variables.tf index 0f8ca61..228a86c 100644 --- a/variables.tf +++ b/variables.tf @@ -88,3 +88,8 @@ variable "archive_on_destroy" { description = "Archive repository instead of deleting it on destroy" default = true } + +variable "poc" { + type = bool + description = "Is this repository a Proof of Concept?" +} \ No newline at end of file From 591bd37a37d96695d525fddfa856bc70a19d64f8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 23 Oct 2024 09:34:54 +0000 Subject: [PATCH 2/5] terraform-docs: automated action --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8db294b..49e47c9 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ No modules. | [has\_discussions](#input\_has\_discussions) | Enable repository discussions | `bool` | `false` | no | | [homepage\_url](#input\_homepage\_url) | Repository homepage URL | `string` | `""` | no | | [name](#input\_name) | Repository name | `string` | n/a | yes | +| [poc](#input\_poc) | Is this repository a Proof of Concept? | `bool` | n/a | yes | | [required\_checks](#input\_required\_checks) | List of required checks | `list(string)` | `[]` | no | | [secrets](#input\_secrets) | key:value map for GitHub actions secrets | `map(any)` | `{}` | no | | [team\_access](#input\_team\_access) | Team access types for created repository |
object({
admin = optional(list(string))
maintain = optional(list(string))
push = optional(list(string))
pull = optional(list(string))
})
|
{
"admin": [],
"maintain": [],
"pull": [],
"push": []
}
| no | From c3d21cb738672976c35a3222688475e27c5c3f58 Mon Sep 17 00:00:00 2001 From: levgorbunov1 Date: Wed, 23 Oct 2024 10:50:45 +0100 Subject: [PATCH 3/5] terraform fmt --- variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variables.tf b/variables.tf index 228a86c..c48f89b 100644 --- a/variables.tf +++ b/variables.tf @@ -90,6 +90,6 @@ variable "archive_on_destroy" { } variable "poc" { - type = bool + type = bool description = "Is this repository a Proof of Concept?" } \ No newline at end of file From 01daa592f8239cd24e69011981645acc3bf3d601 Mon Sep 17 00:00:00 2001 From: levgorbunov1 Date: Wed, 23 Oct 2024 10:53:15 +0100 Subject: [PATCH 4/5] add required var to test --- test/fixtures/github_repos/module_test_repo.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/test/fixtures/github_repos/module_test_repo.tf b/test/fixtures/github_repos/module_test_repo.tf index 6433f64..5625c08 100644 --- a/test/fixtures/github_repos/module_test_repo.tf +++ b/test/fixtures/github_repos/module_test_repo.tf @@ -5,6 +5,7 @@ module "module-test-repo" { description = "This repository was created by the terraform github repository unit test" homepage_url = "https://github.com/ministryofjustice/terraform-github-repository" has_discussions = true + poc = false topics = ["operations-engineering"] archive_on_destroy = false variables = { From faf2994209a96637f49729941ea5980daf5bad86 Mon Sep 17 00:00:00 2001 From: levgorbunov1 Date: Wed, 23 Oct 2024 10:56:37 +0100 Subject: [PATCH 5/5] whitespace --- test/fixtures/github_repos/module_test_repo.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fixtures/github_repos/module_test_repo.tf b/test/fixtures/github_repos/module_test_repo.tf index 5625c08..090f851 100644 --- a/test/fixtures/github_repos/module_test_repo.tf +++ b/test/fixtures/github_repos/module_test_repo.tf @@ -5,7 +5,7 @@ module "module-test-repo" { description = "This repository was created by the terraform github repository unit test" homepage_url = "https://github.com/ministryofjustice/terraform-github-repository" has_discussions = true - poc = false + poc = false topics = ["operations-engineering"] archive_on_destroy = false variables = {