Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
12 changes: 12 additions & 0 deletions secrets.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# ---------------------------------------------------------------------------------------------------------------------
# Action Variables
# ---------------------------------------------------------------------------------------------------------------------
resource "github_actions_variable" "repository_variable" {
for_each = var.plaintext_variables

repository = github_repository.repository.name
variable_name = each.key
value = try(each.value, null)
}


# ---------------------------------------------------------------------------------------------------------------------
# Action Secrets
# ---------------------------------------------------------------------------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions test/unit-complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ module "repository" {
github_team.team.id
]

plaintext_variables = {
(var.variable_name) = var.variable_text
}

plaintext_secrets = {
(var.secret_name) = var.secret_text
}
Expand Down
12 changes: 12 additions & 0 deletions test/unit-complete/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,18 @@ variable "secret_text" {
default = "42"
}

variable "variable_name" {
description = "The name of the variable."
type = string
default = "MY_VAR"
}

variable "variable_text" {
description = "The value of the variable."
type = string
default = "42"
}

variable "encrypted_secret_name" {
description = "The name of the secret."
type = string
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,18 @@ variable "webhooks" {
# }]
}

variable "plaintext_variables" {
description = "(Optional) Configuring actions variables. For details please check: https://www.terraform.io/docs/providers/github/r/actions_variable"
type = map(string)

# Example:
# plaintext_variable = {
# "MY_VAR" = "42"
# }

default = {}
}

variable "plaintext_secrets" {
description = "(Optional) Configuring actions secrets. For details please check: https://www.terraform.io/docs/providers/github/r/actions_secret"
type = map(string)
Expand Down