From 9661b936e43450271c6868333862ed209309b5be Mon Sep 17 00:00:00 2001 From: wtripp180901 Date: Mon, 13 Jan 2025 11:42:43 +0000 Subject: [PATCH 1/2] added configurable global tags to compute instances --- compute_instances.tf | 7 +++++++ variables.tf | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/compute_instances.tf b/compute_instances.tf index 29e5627..3db4d5e 100644 --- a/compute_instances.tf +++ b/compute_instances.tf @@ -47,6 +47,7 @@ resource "openstack_compute_instance_v2" "ansible_control" { user_data ] } + tags = var.compute_tags } resource "openstack_compute_instance_v2" "seed" { @@ -74,6 +75,7 @@ resource "openstack_compute_instance_v2" "seed" { timeouts { create = "90m" } + tags = var.compute_tags } resource "openstack_compute_instance_v2" "compute" { @@ -102,6 +104,7 @@ resource "openstack_compute_instance_v2" "compute" { timeouts { create = "90m" } + tags = var.compute_tags } resource "openstack_compute_instance_v2" "controller" { name = format("%s-controller-%02d", var.prefix, count.index + 1) @@ -129,6 +132,8 @@ resource "openstack_compute_instance_v2" "controller" { timeouts { create = "90m" } + + tags = var.compute_tags } resource "openstack_compute_instance_v2" "storage" { @@ -157,6 +162,7 @@ resource "openstack_compute_instance_v2" "storage" { timeouts { create = "90m" } + tags = var.compute_tags } resource "openstack_compute_instance_v2" "wazuh_manager" { @@ -182,4 +188,5 @@ resource "openstack_compute_instance_v2" "wazuh_manager" { timeouts { create = "90m" } + tags = var.compute_tags } diff --git a/variables.tf b/variables.tf index 34999c8..a0cc8bd 100644 --- a/variables.tf +++ b/variables.tf @@ -135,3 +135,9 @@ variable "volume_type" { type = string default = "" } + +variable "compute_tags" { + description = "Set of tags to be applied to all compute instances" + type = list(string) + default = [] +} From 95caf17d33404fc417883f932c3bf9581355b838 Mon Sep 17 00:00:00 2001 From: wtripp180901 Date: Mon, 13 Jan 2025 14:22:45 +0000 Subject: [PATCH 2/2] updated vriable name --- compute_instances.tf | 12 ++++++------ variables.tf | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/compute_instances.tf b/compute_instances.tf index 3db4d5e..51f8d11 100644 --- a/compute_instances.tf +++ b/compute_instances.tf @@ -47,7 +47,7 @@ resource "openstack_compute_instance_v2" "ansible_control" { user_data ] } - tags = var.compute_tags + tags = var.instance_tags } resource "openstack_compute_instance_v2" "seed" { @@ -75,7 +75,7 @@ resource "openstack_compute_instance_v2" "seed" { timeouts { create = "90m" } - tags = var.compute_tags + tags = var.instance_tags } resource "openstack_compute_instance_v2" "compute" { @@ -104,7 +104,7 @@ resource "openstack_compute_instance_v2" "compute" { timeouts { create = "90m" } - tags = var.compute_tags + tags = var.instance_tags } resource "openstack_compute_instance_v2" "controller" { name = format("%s-controller-%02d", var.prefix, count.index + 1) @@ -133,7 +133,7 @@ resource "openstack_compute_instance_v2" "controller" { create = "90m" } - tags = var.compute_tags + tags = var.instance_tags } resource "openstack_compute_instance_v2" "storage" { @@ -162,7 +162,7 @@ resource "openstack_compute_instance_v2" "storage" { timeouts { create = "90m" } - tags = var.compute_tags + tags = var.instance_tags } resource "openstack_compute_instance_v2" "wazuh_manager" { @@ -188,5 +188,5 @@ resource "openstack_compute_instance_v2" "wazuh_manager" { timeouts { create = "90m" } - tags = var.compute_tags + tags = var.instance_tags } diff --git a/variables.tf b/variables.tf index a0cc8bd..4e52fdb 100644 --- a/variables.tf +++ b/variables.tf @@ -136,8 +136,8 @@ variable "volume_type" { default = "" } -variable "compute_tags" { - description = "Set of tags to be applied to all compute instances" +variable "instance_tags" { + description = "Set of tags to be applied to all instances" type = list(string) default = [] }