Skip to content

Commit

Permalink
fix: create uuid as a resource to save value between runs (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
katariax authored Dec 30, 2022
1 parent 4fe14a6 commit 2f0fed3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/agent-policy/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module "gcloud-upsert" {
${base64encode(jsonencode(var.zones == null ? [] : var.zones))} \
${base64encode(jsonencode(var.instances == null ? [] : var.instances))}
EOT
create_cmd_triggers = { uuid = uuid() }
create_cmd_triggers = { uuid = random_uuid.uuid.result }
}

module "gcloud-destroy" {
Expand All @@ -45,3 +45,6 @@ module "gcloud-destroy" {
destroy_cmd_entrypoint = "${path.module}/scripts/delete-script.sh"
destroy_cmd_body = "${var.project_id} ${jsonencode(var.policy_id)}"
}

resource "random_uuid" "uuid" {
}
6 changes: 6 additions & 0 deletions modules/agent-policy/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@

terraform {
required_version = ">= 0.13"
required_providers {
random = {
source = "hashicorp/random"
version = ">= 3.4"
}
}
}

0 comments on commit 2f0fed3

Please sign in to comment.