Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamically add POC topic based on POC variable #145

Merged
merged 6 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ No modules.
| <a name="input_has_discussions"></a> [has\_discussions](#input\_has\_discussions) | Enable repository discussions | `bool` | `false` | no |
| <a name="input_homepage_url"></a> [homepage\_url](#input\_homepage\_url) | Repository homepage URL | `string` | `""` | no |
| <a name="input_name"></a> [name](#input\_name) | Repository name | `string` | n/a | yes |
| <a name="input_poc"></a> [poc](#input\_poc) | Is this repository a Proof of Concept? | `bool` | n/a | yes |
| <a name="input_required_checks"></a> [required\_checks](#input\_required\_checks) | List of required checks | `list(string)` | `[]` | no |
| <a name="input_secrets"></a> [secrets](#input\_secrets) | key:value map for GitHub actions secrets | `map(any)` | `{}` | no |
| <a name="input_team_access"></a> [team\_access](#input\_team\_access) | Team access types for created repository | <pre>object({<br> admin = optional(list(string))<br> maintain = optional(list(string))<br> push = optional(list(string))<br> pull = optional(list(string))<br> })</pre> | <pre>{<br> "admin": [],<br> "maintain": [],<br> "pull": [],<br> "push": []<br>}</pre> | no |
Expand Down
6 changes: 5 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
@@ -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"])
Expand All @@ -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" {
Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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?"
levgorbunov1 marked this conversation as resolved.
Show resolved Hide resolved
}