Skip to content

Commit

Permalink
fix: do not create secret version when secret_data is null (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
q2w authored Dec 29, 2024
1 parent 94b5d30 commit 6294316
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions modules/simple-secret/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ resource "google_secret_manager_secret" "secret" {
}

resource "google_secret_manager_secret_version" "version" {
count = var.secret_data != null ? 1 : 0
secret = google_secret_manager_secret.secret.id
secret_data = var.secret_data
}
2 changes: 1 addition & 1 deletion modules/simple-secret/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
version: 0.5.1
actuationTool:
flavor: Terraform
version: ">= 0.13"
version: ">= 1.3"
description: {}
content:
examples:
Expand Down
2 changes: 1 addition & 1 deletion modules/simple-secret/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ output "name" {

output "version" {
description = "The version of the created secret"
value = google_secret_manager_secret_version.version.name
value = try(google_secret_manager_secret_version.version[0].name, "")
}

output "project_id" {
Expand Down

0 comments on commit 6294316

Please sign in to comment.