From 455306e6603ff721fc77f18f8ba7eecc306f77d2 Mon Sep 17 00:00:00 2001 From: Arif Ali Date: Tue, 7 May 2024 17:12:07 +0100 Subject: [PATCH] use model variable, so easier manipulate --- juju/home-maas/00-init.tf | 10 ++++++++- juju/home-maas/00-variables.tf | 5 +++++ juju/home-maas/01-cloud.tf | 4 ++-- juju/home-maas/03-machines.tf | 2 +- juju/home-maas/04-keystone.tf | 18 ++++++++-------- juju/home-maas/04-mysql.tf | 8 +++---- juju/home-maas/04-rmq.tf | 8 +++---- juju/home-maas/05-ceilometer.tf | 14 ++++++------ juju/home-maas/05-ceph.tf | 28 ++++++++++++------------ juju/home-maas/05-cinder.tf | 30 +++++++++++++------------- juju/home-maas/05-glance.tf | 26 +++++++++++----------- juju/home-maas/05-gnocchi.tf | 28 ++++++++++++------------ juju/home-maas/05-heat.tf | 22 +++++++++---------- juju/home-maas/05-memcache.tf | 10 ++++----- juju/home-maas/05-nova.tf | 28 ++++++++++++------------ juju/home-maas/05-placement.tf | 22 +++++++++---------- juju/home-maas/06-nova-compute.tf | 28 ++++++++++++------------ juju/home-maas/07-controllers.tf | 6 +++--- juju/home-maas/08-neutron.tf | 26 +++++++++++----------- juju/home-maas/10-vault.tf | 36 +++++++++++++++---------------- juju/home-maas/terraform.tfvars | 2 ++ 21 files changed, 188 insertions(+), 173 deletions(-) mode change 120000 => 100644 juju/home-maas/00-init.tf diff --git a/juju/home-maas/00-init.tf b/juju/home-maas/00-init.tf deleted file mode 120000 index 50b2494..0000000 --- a/juju/home-maas/00-init.tf +++ /dev/null @@ -1 +0,0 @@ -../init.tf \ No newline at end of file diff --git a/juju/home-maas/00-init.tf b/juju/home-maas/00-init.tf new file mode 100644 index 0000000..e54deec --- /dev/null +++ b/juju/home-maas/00-init.tf @@ -0,0 +1,9 @@ +terraform { + required_providers { + juju = { + version = "~> 0.12.0" + #source = "juju/juju" + source = "terraform.local/juju/juju" + } + } +} diff --git a/juju/home-maas/00-variables.tf b/juju/home-maas/00-variables.tf index 32eb24a..9d797b2 100644 --- a/juju/home-maas/00-variables.tf +++ b/juju/home-maas/00-variables.tf @@ -5,6 +5,11 @@ variable "machines" { })) } +variable "model-name" { + type = string + default = "openstack" +} + variable openstack-origin { type = string default = "distro" diff --git a/juju/home-maas/01-cloud.tf b/juju/home-maas/01-cloud.tf index 2d72311..4c393e7 100644 --- a/juju/home-maas/01-cloud.tf +++ b/juju/home-maas/01-cloud.tf @@ -1,5 +1,5 @@ -resource "juju_model" "cpe-focal" { - name = "cpe-focal" +resource "juju_model" "openstack" { + name = var.model-name cloud { name = "home-maas" diff --git a/juju/home-maas/03-machines.tf b/juju/home-maas/03-machines.tf index fa312b5..19df533 100644 --- a/juju/home-maas/03-machines.tf +++ b/juju/home-maas/03-machines.tf @@ -3,7 +3,7 @@ resource "juju_machine" "all_machines" { for index, machine in var.machines: machine.machine_id => machine } - model = juju_model.cpe-focal.name + model = var.model-name name = each.value.machine_id constraints = each.value.constraints } diff --git a/juju/home-maas/04-keystone.tf b/juju/home-maas/04-keystone.tf index 26f1af6..b97bcf0 100644 --- a/juju/home-maas/04-keystone.tf +++ b/juju/home-maas/04-keystone.tf @@ -1,15 +1,15 @@ resource "juju_machine" "keystone-1" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["103"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "keystone-2" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["104"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "keystone-3" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["105"].machine_id]) constraints = "spaces=oam" } @@ -18,7 +18,7 @@ resource "juju_machine" "keystone-3" { resource "juju_application" "keystone" { name = "keystone" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "keystone" @@ -63,7 +63,7 @@ resource "juju_application" "keystone" { resource "juju_application" "keystone-mysql-router" { name = "keystone-mysql-router" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "mysql-router" @@ -90,7 +90,7 @@ resource "juju_application" "keystone-mysql-router" { resource "juju_application" "hacluster-keystone" { name = "hacluster-keystone" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "hacluster" @@ -103,7 +103,7 @@ resource "juju_application" "hacluster-keystone" { resource "juju_integration" "keystone-ha" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.keystone.name @@ -118,7 +118,7 @@ resource "juju_integration" "keystone-ha" { resource "juju_integration" "keystone-mysql" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.keystone.name @@ -133,7 +133,7 @@ resource "juju_integration" "keystone-mysql" { resource "juju_integration" "keystone-db" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.keystone-mysql-router.name diff --git a/juju/home-maas/04-mysql.tf b/juju/home-maas/04-mysql.tf index 5748425..6a4dd44 100644 --- a/juju/home-maas/04-mysql.tf +++ b/juju/home-maas/04-mysql.tf @@ -1,15 +1,15 @@ resource "juju_machine" "mysql-1" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["100"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "mysql-2" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["101"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "mysql-3" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["102"].machine_id]) constraints = "spaces=oam" } @@ -18,7 +18,7 @@ resource "juju_machine" "mysql-3" { resource "juju_application" "mysql-innodb-cluster" { name = "mysql-innodb-cluster" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "mysql-innodb-cluster" diff --git a/juju/home-maas/04-rmq.tf b/juju/home-maas/04-rmq.tf index 3745a65..1b34e42 100644 --- a/juju/home-maas/04-rmq.tf +++ b/juju/home-maas/04-rmq.tf @@ -1,15 +1,15 @@ resource "juju_machine" "rmq-1" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["103"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "rmq-2" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["104"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "rmq-3" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["105"].machine_id]) constraints = "spaces=oam" } @@ -18,7 +18,7 @@ resource "juju_machine" "rmq-3" { resource "juju_application" "rabbitmq-server" { name = "rabbitmq-server" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "rabbitmq-server" diff --git a/juju/home-maas/05-ceilometer.tf b/juju/home-maas/05-ceilometer.tf index 953bec9..8c9ea12 100644 --- a/juju/home-maas/05-ceilometer.tf +++ b/juju/home-maas/05-ceilometer.tf @@ -1,15 +1,15 @@ resource "juju_machine" "ceilometer-1" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["103"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "ceilometer-2" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["104"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "ceilometer-3" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["105"].machine_id]) constraints = "spaces=oam" } @@ -18,7 +18,7 @@ resource "juju_machine" "ceilometer-3" { resource "juju_application" "ceilometer" { name = "ceilometer" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "ceilometer" @@ -55,7 +55,7 @@ resource "juju_application" "ceilometer" { resource "juju_integration" "ceilometer-rmq" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.ceilometer.name @@ -70,7 +70,7 @@ resource "juju_integration" "ceilometer-rmq" { resource "juju_integration" "ceilometer-keystone" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.ceilometer.name @@ -85,7 +85,7 @@ resource "juju_integration" "ceilometer-keystone" { resource "juju_integration" "ceilometer-ceil-agent" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.ceilometer.name diff --git a/juju/home-maas/05-ceph.tf b/juju/home-maas/05-ceph.tf index 1b4ffe2..1d170cf 100644 --- a/juju/home-maas/05-ceph.tf +++ b/juju/home-maas/05-ceph.tf @@ -1,7 +1,7 @@ resource "juju_application" "ceph-osd" { name = "ceph-osd" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "ceph-osd" @@ -33,17 +33,17 @@ resource "juju_application" "ceph-osd" { } resource "juju_machine" "ceph-mon-1" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["100"].machine_id]) constraints = "spaces=oam,ceph-access,ceph-replica" } resource "juju_machine" "ceph-mon-2" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["101"].machine_id]) constraints = "spaces=oam,ceph-access,ceph-replica" } resource "juju_machine" "ceph-mon-3" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["102"].machine_id]) constraints = "spaces=oam,ceph-access,ceph-replica" } @@ -52,7 +52,7 @@ resource "juju_machine" "ceph-mon-3" { resource "juju_application" "ceph-mon" { name = "ceph-mon" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "ceph-mon" @@ -95,17 +95,17 @@ resource "juju_application" "ceph-mon" { } resource "juju_machine" "ceph-rgw-1" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["100"].machine_id]) constraints = "spaces=oam,ceph-access" } resource "juju_machine" "ceph-rgw-2" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["101"].machine_id]) constraints = "spaces=oam,ceph-access" } resource "juju_machine" "ceph-rgw-3" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["102"].machine_id]) constraints = "spaces=oam,ceph-access" } @@ -113,7 +113,7 @@ resource "juju_machine" "ceph-rgw-3" { resource "juju_application" "ceph-radosgw" { name = "ceph-radosgw" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "ceph-radosgw" @@ -158,7 +158,7 @@ resource "juju_application" "ceph-radosgw" { resource "juju_application" "hacluster-radosgw" { name = "hacluster-radosgw" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "hacluster" @@ -171,7 +171,7 @@ resource "juju_application" "hacluster-radosgw" { resource "juju_integration" "osd-mon" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.ceph-osd.name @@ -187,7 +187,7 @@ resource "juju_integration" "osd-mon" { resource "juju_integration" "rgw-mon" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.ceph-radosgw.name @@ -203,7 +203,7 @@ resource "juju_integration" "rgw-mon" { resource "juju_integration" "rgw-ha" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.ceph-radosgw.name @@ -218,7 +218,7 @@ resource "juju_integration" "rgw-ha" { resource "juju_integration" "rgw-keystone" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.ceph-radosgw.name diff --git a/juju/home-maas/05-cinder.tf b/juju/home-maas/05-cinder.tf index 863cf61..e4d0002 100644 --- a/juju/home-maas/05-cinder.tf +++ b/juju/home-maas/05-cinder.tf @@ -1,15 +1,15 @@ resource "juju_machine" "cinder-1" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["100"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "cinder-2" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["101"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "cinder-3" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["102"].machine_id]) constraints = "spaces=oam" } @@ -18,7 +18,7 @@ resource "juju_machine" "cinder-3" { resource "juju_application" "cinder" { name = "cinder" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "cinder" @@ -65,7 +65,7 @@ resource "juju_application" "cinder" { resource "juju_application" "cinder-ceph" { name = "cinder-ceph" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "cinder-ceph" @@ -83,7 +83,7 @@ resource "juju_application" "cinder-ceph" { resource "juju_application" "cinder-mysql-router" { name = "cinder-mysql-router" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "mysql-router" @@ -110,7 +110,7 @@ resource "juju_application" "cinder-mysql-router" { resource "juju_application" "hacluster-cinder" { name = "hacluster-cinder" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "hacluster" @@ -123,7 +123,7 @@ resource "juju_application" "hacluster-cinder" { resource "juju_integration" "cinder-ha" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.cinder.name @@ -138,7 +138,7 @@ resource "juju_integration" "cinder-ha" { resource "juju_integration" "cinder-mysql" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.cinder.name @@ -153,7 +153,7 @@ resource "juju_integration" "cinder-mysql" { resource "juju_integration" "cinder-db" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.cinder-mysql-router.name @@ -168,7 +168,7 @@ resource "juju_integration" "cinder-db" { resource "juju_integration" "cinder-rmq" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.cinder.name @@ -183,7 +183,7 @@ resource "juju_integration" "cinder-rmq" { resource "juju_integration" "cinder-keystone" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.cinder.name @@ -198,7 +198,7 @@ resource "juju_integration" "cinder-keystone" { resource "juju_integration" "cinder-ceph" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.cinder.name @@ -214,7 +214,7 @@ resource "juju_integration" "cinder-ceph" { resource "juju_integration" "cinder-ceph-mon" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.cinder-ceph.name @@ -229,7 +229,7 @@ resource "juju_integration" "cinder-ceph-mon" { resource "juju_integration" "cinder-ceph-cinder" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.cinder-ceph.name diff --git a/juju/home-maas/05-glance.tf b/juju/home-maas/05-glance.tf index 11cdc6d..1bc7268 100644 --- a/juju/home-maas/05-glance.tf +++ b/juju/home-maas/05-glance.tf @@ -1,15 +1,15 @@ resource "juju_machine" "glance-1" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["100"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "glance-2" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["101"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "glance-3" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["102"].machine_id]) constraints = "spaces=oam" } @@ -18,7 +18,7 @@ resource "juju_machine" "glance-3" { resource "juju_application" "glance" { name = "glance" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "glance" @@ -63,7 +63,7 @@ resource "juju_application" "glance" { resource "juju_application" "glance-mysql-router" { name = "glance-mysql-router" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "mysql-router" @@ -90,7 +90,7 @@ resource "juju_application" "glance-mysql-router" { resource "juju_application" "hacluster-glance" { name = "hacluster-glance" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "hacluster" @@ -103,7 +103,7 @@ resource "juju_application" "hacluster-glance" { resource "juju_integration" "glance-ha" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.glance.name @@ -118,7 +118,7 @@ resource "juju_integration" "glance-ha" { resource "juju_integration" "glance-mysql" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.glance.name @@ -133,7 +133,7 @@ resource "juju_integration" "glance-mysql" { resource "juju_integration" "glance-db" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.glance-mysql-router.name @@ -148,7 +148,7 @@ resource "juju_integration" "glance-db" { resource "juju_integration" "glance-rmq" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.glance.name @@ -163,7 +163,7 @@ resource "juju_integration" "glance-rmq" { resource "juju_integration" "glance-keystone" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.glance.name @@ -178,7 +178,7 @@ resource "juju_integration" "glance-keystone" { resource "juju_integration" "glance-ceph" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.glance.name @@ -193,7 +193,7 @@ resource "juju_integration" "glance-ceph" { resource "juju_integration" "glance-cinder" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.glance.name diff --git a/juju/home-maas/05-gnocchi.tf b/juju/home-maas/05-gnocchi.tf index 3d6fba0..dc4ee9d 100644 --- a/juju/home-maas/05-gnocchi.tf +++ b/juju/home-maas/05-gnocchi.tf @@ -1,15 +1,15 @@ resource "juju_machine" "gnocchi-1" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["103"].machine_id]) constraints = "spaces=oam,ceph-access" } resource "juju_machine" "gnocchi-2" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["104"].machine_id]) constraints = "spaces=oam,ceph-access" } resource "juju_machine" "gnocchi-3" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["105"].machine_id]) constraints = "spaces=oam,ceph-access" } @@ -18,7 +18,7 @@ resource "juju_machine" "gnocchi-3" { resource "juju_application" "gnocchi" { name = "gnocchi" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "gnocchi" @@ -67,7 +67,7 @@ resource "juju_application" "gnocchi" { resource "juju_application" "gnocchi-mysql-router" { name = "gnocchi-mysql-router" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "mysql-router" @@ -94,7 +94,7 @@ resource "juju_application" "gnocchi-mysql-router" { resource "juju_application" "hacluster-gnocchi" { name = "hacluster-gnocchi" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "hacluster" @@ -107,7 +107,7 @@ resource "juju_application" "hacluster-gnocchi" { resource "juju_integration" "gnocchi-ha" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.gnocchi.name @@ -122,7 +122,7 @@ resource "juju_integration" "gnocchi-ha" { resource "juju_integration" "gnocchi-mysql" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.gnocchi.name @@ -137,7 +137,7 @@ resource "juju_integration" "gnocchi-mysql" { resource "juju_integration" "gnocchi-db" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.gnocchi-mysql-router.name @@ -152,7 +152,7 @@ resource "juju_integration" "gnocchi-db" { resource "juju_integration" "gnocchi-rmq" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.gnocchi.name @@ -167,7 +167,7 @@ resource "juju_integration" "gnocchi-rmq" { resource "juju_integration" "gnocchi-keystone" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.gnocchi.name @@ -182,7 +182,7 @@ resource "juju_integration" "gnocchi-keystone" { resource "juju_integration" "gnocchi-ceph" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.gnocchi.name @@ -197,7 +197,7 @@ resource "juju_integration" "gnocchi-ceph" { resource "juju_integration" "gnocchi-memcache" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.gnocchi.name @@ -212,7 +212,7 @@ resource "juju_integration" "gnocchi-memcache" { resource "juju_integration" "gnocchi-ceilometer" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.gnocchi.name diff --git a/juju/home-maas/05-heat.tf b/juju/home-maas/05-heat.tf index 91d2aab..98a516a 100644 --- a/juju/home-maas/05-heat.tf +++ b/juju/home-maas/05-heat.tf @@ -1,15 +1,15 @@ resource "juju_machine" "heat-1" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["100"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "heat-2" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["101"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "heat-3" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["102"].machine_id]) constraints = "spaces=oam" } @@ -18,7 +18,7 @@ resource "juju_machine" "heat-3" { resource "juju_application" "heat" { name = "heat" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "heat" @@ -62,7 +62,7 @@ resource "juju_application" "heat" { resource "juju_application" "heat-mysql-router" { name = "heat-mysql-router" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "mysql-router" @@ -89,7 +89,7 @@ resource "juju_application" "heat-mysql-router" { resource "juju_application" "hacluster-heat" { name = "hacluster-heat" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "hacluster" @@ -102,7 +102,7 @@ resource "juju_application" "hacluster-heat" { resource "juju_integration" "heat-ha" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.heat.name @@ -117,7 +117,7 @@ resource "juju_integration" "heat-ha" { resource "juju_integration" "heat-mysql" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.heat.name @@ -132,7 +132,7 @@ resource "juju_integration" "heat-mysql" { resource "juju_integration" "heat-db" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.heat-mysql-router.name @@ -147,7 +147,7 @@ resource "juju_integration" "heat-db" { resource "juju_integration" "heat-rmq" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.heat.name @@ -162,7 +162,7 @@ resource "juju_integration" "heat-rmq" { resource "juju_integration" "heat-keystone" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.heat.name diff --git a/juju/home-maas/05-memcache.tf b/juju/home-maas/05-memcache.tf index 711b787..5c83d97 100644 --- a/juju/home-maas/05-memcache.tf +++ b/juju/home-maas/05-memcache.tf @@ -1,15 +1,15 @@ resource "juju_machine" "memcache-1" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["100"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "memcache-2" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["101"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "memcache-3" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["102"].machine_id]) constraints = "spaces=oam" } @@ -17,7 +17,7 @@ resource "juju_machine" "memcache-3" { resource "juju_application" "memcached" { name = "memcached" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "memcached" @@ -48,7 +48,7 @@ resource "juju_application" "memcached" { resource "juju_integration" "nova-cloud-controller-memcache" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.nova-cloud-controller.name diff --git a/juju/home-maas/05-nova.tf b/juju/home-maas/05-nova.tf index f6000c8..f73d704 100644 --- a/juju/home-maas/05-nova.tf +++ b/juju/home-maas/05-nova.tf @@ -1,15 +1,15 @@ resource "juju_machine" "ncc-1" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["103"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "ncc-2" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["104"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "ncc-3" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["105"].machine_id]) constraints = "spaces=oam" } @@ -18,7 +18,7 @@ resource "juju_machine" "ncc-3" { resource "juju_application" "nova-cloud-controller" { name = "nova-cloud-controller" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "nova-cloud-controller" @@ -70,7 +70,7 @@ resource "juju_application" "nova-cloud-controller" { resource "juju_application" "nova-cloud-controller-mysql-router" { name = "nova-cloud-controller-mysql-router" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "mysql-router" @@ -97,7 +97,7 @@ resource "juju_application" "nova-cloud-controller-mysql-router" { resource "juju_application" "hacluster-nova" { name = "hacluster-nova" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "hacluster" @@ -110,7 +110,7 @@ resource "juju_application" "hacluster-nova" { resource "juju_integration" "nova-cloud-controller-ha" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.nova-cloud-controller.name @@ -125,7 +125,7 @@ resource "juju_integration" "nova-cloud-controller-ha" { resource "juju_integration" "nova-cloud-controller-mysql" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.nova-cloud-controller.name @@ -140,7 +140,7 @@ resource "juju_integration" "nova-cloud-controller-mysql" { resource "juju_integration" "nova-cloud-controller-db" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.nova-cloud-controller-mysql-router.name @@ -155,7 +155,7 @@ resource "juju_integration" "nova-cloud-controller-db" { resource "juju_integration" "nova-cloud-controller-rmq" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.nova-cloud-controller.name @@ -170,7 +170,7 @@ resource "juju_integration" "nova-cloud-controller-rmq" { resource "juju_integration" "nova-cloud-controller-keystone" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.nova-cloud-controller.name @@ -185,7 +185,7 @@ resource "juju_integration" "nova-cloud-controller-keystone" { resource "juju_integration" "nova-cloud-controller-neutron" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.nova-cloud-controller.name @@ -200,7 +200,7 @@ resource "juju_integration" "nova-cloud-controller-neutron" { resource "juju_integration" "nova-cloud-controller-nova-compute" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.nova-cloud-controller.name @@ -214,7 +214,7 @@ resource "juju_integration" "nova-cloud-controller-nova-compute" { } resource "juju_integration" "nova-cloud-controller-glance" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.nova-cloud-controller.name diff --git a/juju/home-maas/05-placement.tf b/juju/home-maas/05-placement.tf index 0ba9fac..57b9233 100644 --- a/juju/home-maas/05-placement.tf +++ b/juju/home-maas/05-placement.tf @@ -1,15 +1,15 @@ resource "juju_machine" "placement-1" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["103"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "placement-2" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["104"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "placement-3" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["105"].machine_id]) constraints = "spaces=oam" } @@ -17,7 +17,7 @@ resource "juju_machine" "placement-3" { resource "juju_application" "placement" { name = "placement" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "placement" @@ -58,7 +58,7 @@ resource "juju_application" "placement" { resource "juju_application" "placement-mysql-router" { name = "placement-mysql-router" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "mysql-router" @@ -85,7 +85,7 @@ resource "juju_application" "placement-mysql-router" { resource "juju_application" "hacluster-placement" { name = "hacluster-placement" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "hacluster" @@ -100,7 +100,7 @@ resource "juju_application" "hacluster-placement" { resource "juju_integration" "placement-ha" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.placement.name @@ -115,7 +115,7 @@ resource "juju_integration" "placement-ha" { resource "juju_integration" "placement-mysql" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.placement.name @@ -130,7 +130,7 @@ resource "juju_integration" "placement-mysql" { resource "juju_integration" "placement-db" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.placement-mysql-router.name @@ -145,7 +145,7 @@ resource "juju_integration" "placement-db" { resource "juju_integration" "placement-keystone" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.placement.name @@ -160,7 +160,7 @@ resource "juju_integration" "placement-keystone" { resource "juju_integration" "placement-nova" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.placement.name diff --git a/juju/home-maas/06-nova-compute.tf b/juju/home-maas/06-nova-compute.tf index 95acbe7..34cd1f3 100644 --- a/juju/home-maas/06-nova-compute.tf +++ b/juju/home-maas/06-nova-compute.tf @@ -1,7 +1,7 @@ resource "juju_application" "nova-compute-kvm" { name = "nova-compute-kvm" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "nova-compute" @@ -61,7 +61,7 @@ resource "juju_application" "nova-compute-kvm" { resource "juju_application" "ceilometer-agent" { name = "ceilometer-agent" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "ceilometer-agent" @@ -78,7 +78,7 @@ resource "juju_application" "ceilometer-agent" { resource "juju_application" "neutron-openvswitch" { name = "neutron-openvswitch" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "neutron-openvswitch" @@ -107,7 +107,7 @@ resource "juju_application" "neutron-openvswitch" { resource "juju_application" "sysconfig-compute" { name = "sysconfig-compute" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "sysconfig" @@ -128,7 +128,7 @@ resource "juju_application" "sysconfig-compute" { resource "juju_integration" "compute-ceilometer" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.nova-compute-kvm.name @@ -143,7 +143,7 @@ resource "juju_integration" "compute-ceilometer" { resource "juju_integration" "compute-ovs" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.neutron-openvswitch.name @@ -158,7 +158,7 @@ resource "juju_integration" "compute-ovs" { resource "juju_integration" "compute-sysconfig" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.nova-compute-kvm.name @@ -173,7 +173,7 @@ resource "juju_integration" "compute-sysconfig" { resource "juju_integration" "compute-ceph-mon" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.nova-compute-kvm.name @@ -188,7 +188,7 @@ resource "juju_integration" "compute-ceph-mon" { resource "juju_integration" "neutron-api-ovs" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.neutron-openvswitch.name @@ -203,7 +203,7 @@ resource "juju_integration" "neutron-api-ovs" { resource "juju_integration" "nova-compute-rmq" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.nova-compute-kvm.name @@ -218,7 +218,7 @@ resource "juju_integration" "nova-compute-rmq" { resource "juju_integration" "neutron-ovs-rmq" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.neutron-openvswitch.name @@ -233,7 +233,7 @@ resource "juju_integration" "neutron-ovs-rmq" { resource "juju_integration" "ceilometer-agent-rmq" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.ceilometer-agent.name @@ -248,7 +248,7 @@ resource "juju_integration" "ceilometer-agent-rmq" { resource "juju_integration" "nova-compute-glance" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.nova-compute-kvm.name @@ -263,7 +263,7 @@ resource "juju_integration" "nova-compute-glance" { resource "juju_integration" "nova-compute-cinder-ceph" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.nova-compute-kvm.name diff --git a/juju/home-maas/07-controllers.tf b/juju/home-maas/07-controllers.tf index 586b93c..f718d5b 100644 --- a/juju/home-maas/07-controllers.tf +++ b/juju/home-maas/07-controllers.tf @@ -1,7 +1,7 @@ resource "juju_application" "controller-server" { name = "controller-server" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "ubuntu" @@ -25,7 +25,7 @@ resource "juju_application" "controller-server" { resource "juju_application" "sysconfig-control" { name = "sysconfig-control" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "sysconfig" @@ -45,7 +45,7 @@ resource "juju_application" "sysconfig-control" { resource "juju_integration" "control-sysconfig" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.sysconfig-control.name diff --git a/juju/home-maas/08-neutron.tf b/juju/home-maas/08-neutron.tf index 12003fd..3cb352d 100644 --- a/juju/home-maas/08-neutron.tf +++ b/juju/home-maas/08-neutron.tf @@ -1,7 +1,7 @@ resource "juju_application" "neutron-gateway" { name = "neutron-gateway" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "neutron-gateway" @@ -28,17 +28,17 @@ resource "juju_application" "neutron-gateway" { } resource "juju_machine" "neutron-api-1" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["100"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "neutron-api-2" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["101"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "neutron-api-3" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["102"].machine_id]) constraints = "spaces=oam" } @@ -46,7 +46,7 @@ resource "juju_machine" "neutron-api-3" { resource "juju_application" "neutron-api" { name = "neutron-api" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "neutron-api" @@ -104,7 +104,7 @@ resource "juju_application" "neutron-api" { resource "juju_application" "neutron-mysql-router" { name = "neutron-mysql-router" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "mysql-router" @@ -131,7 +131,7 @@ resource "juju_application" "neutron-mysql-router" { resource "juju_application" "hacluster-neutron" { name = "hacluster-neutron" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "hacluster" @@ -143,7 +143,7 @@ resource "juju_application" "hacluster-neutron" { resource "juju_integration" "neutron-ha" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.neutron-api.name @@ -158,7 +158,7 @@ resource "juju_integration" "neutron-ha" { resource "juju_integration" "neutron-mysql" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.neutron-api.name @@ -173,7 +173,7 @@ resource "juju_integration" "neutron-mysql" { resource "juju_integration" "neutron-db" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.neutron-mysql-router.name @@ -188,7 +188,7 @@ resource "juju_integration" "neutron-db" { resource "juju_integration" "neutron-keystone" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.neutron-api.name @@ -203,7 +203,7 @@ resource "juju_integration" "neutron-keystone" { resource "juju_integration" "neutron-api-rmq" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.neutron-api.name @@ -218,7 +218,7 @@ resource "juju_integration" "neutron-api-rmq" { resource "juju_integration" "neutron-gw-rmq" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.neutron-gateway.name diff --git a/juju/home-maas/10-vault.tf b/juju/home-maas/10-vault.tf index 812bc29..d52eaa8 100644 --- a/juju/home-maas/10-vault.tf +++ b/juju/home-maas/10-vault.tf @@ -1,15 +1,15 @@ resource "juju_machine" "vault-1" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["400"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "vault-2" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["401"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "vault-3" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["402"].machine_id]) constraints = "spaces=oam" } @@ -17,7 +17,7 @@ resource "juju_machine" "vault-3" { resource "juju_application" "vault" { name = "vault" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "vault" @@ -43,7 +43,7 @@ resource "juju_application" "vault" { resource "juju_application" "vault-mysql-router" { name = "vault-mysql-router" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "mysql-router" @@ -72,7 +72,7 @@ resource "juju_application" "vault-mysql-router" { resource "juju_application" "hacluster-vault" { name = "hacluster-vault" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "hacluster" @@ -85,17 +85,17 @@ resource "juju_application" "hacluster-vault" { resource "juju_machine" "etcd-1" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["400"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "etcd-2" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["401"].machine_id]) constraints = "spaces=oam" } resource "juju_machine" "etcd-3" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["402"].machine_id]) constraints = "spaces=oam" } @@ -103,7 +103,7 @@ resource "juju_machine" "etcd-3" { resource "juju_application" "etcd" { name = "etcd" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "etcd" @@ -136,7 +136,7 @@ resource "juju_application" "etcd" { } resource "juju_machine" "easyrsa" { - model = juju_model.cpe-focal.name + model = var.model-name placement = join(":",["lxd",juju_machine.all_machines["402"].machine_id]) constraints = "spaces=oam" } @@ -144,7 +144,7 @@ resource "juju_machine" "easyrsa" { resource "juju_application" "easyrsa" { name = "easyrsa" - model = juju_model.cpe-focal.name + model = var.model-name charm { name = "easyrsa" @@ -161,7 +161,7 @@ resource "juju_application" "easyrsa" { resource "juju_integration" "vault-etcd" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.vault.name @@ -176,7 +176,7 @@ resource "juju_integration" "vault-etcd" { resource "juju_integration" "etcd-easyrsa" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.etcd.name @@ -191,7 +191,7 @@ resource "juju_integration" "etcd-easyrsa" { resource "juju_integration" "vault-ha" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.vault.name @@ -206,7 +206,7 @@ resource "juju_integration" "vault-ha" { resource "juju_integration" "vault-mysql" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.vault.name @@ -221,7 +221,7 @@ resource "juju_integration" "vault-mysql" { resource "juju_integration" "vault-ceph" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.vault.name @@ -236,7 +236,7 @@ resource "juju_integration" "vault-ceph" { resource "juju_integration" "vault-db" { - model = juju_model.cpe-focal.name + model = var.model-name application { name = juju_application.vault-mysql-router.name diff --git a/juju/home-maas/terraform.tfvars b/juju/home-maas/terraform.tfvars index f5547c2..ec5a140 100644 --- a/juju/home-maas/terraform.tfvars +++ b/juju/home-maas/terraform.tfvars @@ -1,3 +1,5 @@ +model-name = "cpe-focal" + machines = [ {machine_id=100,constraints="tags=control,asrock01"}, {machine_id=101,constraints="tags=control,asrock02"},