From e54d63390cf44a17192c8f8e33afec7f9ad736ff Mon Sep 17 00:00:00 2001 From: Arif Ali Date: Mon, 10 Jul 2023 23:13:55 +0100 Subject: [PATCH] Add variables in a more dynamic way Some reformatting on some of the files --- openstack/00-init.tf | 11 ++++++--- openstack/arif-home.tfvars | 2 ++ openstack/init/terraform.tfvars | 1 + openstack/multi-instances/terraform.tfvars | 1 + .../stsstack_init/01-default-networks.tf | 24 +++++++++++-------- openstack/stsstack_init/terraform.tfvars | 1 + 6 files changed, 27 insertions(+), 13 deletions(-) create mode 100644 openstack/arif-home.tfvars create mode 120000 openstack/init/terraform.tfvars create mode 120000 openstack/multi-instances/terraform.tfvars create mode 120000 openstack/stsstack_init/terraform.tfvars diff --git a/openstack/00-init.tf b/openstack/00-init.tf index 6377790..3e82c65 100644 --- a/openstack/00-init.tf +++ b/openstack/00-init.tf @@ -9,10 +9,15 @@ terraform { } provider "openstack" { - cloud = "arif-home" + cloud = var.cloud } variable "domain_id" { - type = string - default = "3fd5a53e08e243b49ac3b171d57b4e4a" + type = string + default = "" +} + +variable "cloud" { + type = string + default = "" } diff --git a/openstack/arif-home.tfvars b/openstack/arif-home.tfvars new file mode 100644 index 0000000..d64fd24 --- /dev/null +++ b/openstack/arif-home.tfvars @@ -0,0 +1,2 @@ +cloud = "arif-home" +domain_id = "3fd5a53e08e243b49ac3b171d57b4e4a" diff --git a/openstack/init/terraform.tfvars b/openstack/init/terraform.tfvars new file mode 120000 index 0000000..c196d0f --- /dev/null +++ b/openstack/init/terraform.tfvars @@ -0,0 +1 @@ +../arif-home.tfvars \ No newline at end of file diff --git a/openstack/multi-instances/terraform.tfvars b/openstack/multi-instances/terraform.tfvars new file mode 120000 index 0000000..c196d0f --- /dev/null +++ b/openstack/multi-instances/terraform.tfvars @@ -0,0 +1 @@ +../arif-home.tfvars \ No newline at end of file diff --git a/openstack/stsstack_init/01-default-networks.tf b/openstack/stsstack_init/01-default-networks.tf index 603dfed..80c6b69 100644 --- a/openstack/stsstack_init/01-default-networks.tf +++ b/openstack/stsstack_init/01-default-networks.tf @@ -1,29 +1,33 @@ resource "openstack_networking_network_v2" "ext_net" { name = "ext_net" - admin_state_up = "true" + admin_state_up = true shared = true external = true segments { physical_network = "physnet1" - network_type = "flat" + network_type = "flat" } } resource "openstack_networking_subnet_v2" "ext_net_subnet" { - name = "ext_net_subnet" - network_id = openstack_networking_network_v2.ext_net.id - cidr = "192.168.1.0/24" - gateway_ip = "192.168.1.254" + name = "ext_net_subnet" + network_id = openstack_networking_network_v2.ext_net.id + cidr = "192.168.1.0/24" + gateway_ip = "192.168.1.254" enable_dhcp = false - ip_version = 4 - dns_nameservers = ["192.168.1.9","192.168.1.13"] + ip_version = 4 + + dns_nameservers = [ + "192.168.1.9", + "192.168.1.13" + ] allocation_pool { start = "192.168.1.42" - end = "192.168.1.79" + end = "192.168.1.79" } } @@ -46,7 +50,7 @@ resource "openstack_networking_subnet_v2" "private_subnet" { allocation_pool { start = "192.168.21.2" - end = "192.168.21.254" + end = "192.168.21.254" } } diff --git a/openstack/stsstack_init/terraform.tfvars b/openstack/stsstack_init/terraform.tfvars new file mode 120000 index 0000000..c196d0f --- /dev/null +++ b/openstack/stsstack_init/terraform.tfvars @@ -0,0 +1 @@ +../arif-home.tfvars \ No newline at end of file