Further updates

* Add user-data for instance
* Add heat specific rules
* Start of MAAS bits
This commit is contained in:
Arif Ali 2023-09-13 11:33:30 +01:00
parent 8c7106eac4
commit 6fb9ff2880
Signed by: arif
GPG Key ID: 369608FBA1353A70
7 changed files with 46 additions and 0 deletions

14
init.tf Normal file
View File

@ -0,0 +1,14 @@
terraform {
required_providers {
maas = {
source = "maas/maas"
version = "~>1.0"
}
}
}
provider "maas" {
api_version = "2.0"
api_key = "cP5gj8RyemEhBLvyKG:AmRXEzR8MPAbRPWGBH:7T9LPemF3gAPe3qwr47rXAkLWZysjeRB"
api_url = "http://10.0.1.253:5240/MAAS"
}

View File

@ -21,3 +21,8 @@ variable "cloud" {
type = string
default = ""
}
variable "heat_domain_id" {
type = string
default = ""
}

View File

@ -1,2 +1,3 @@
cloud = "arif-home"
domain_id = "3fd5a53e08e243b49ac3b171d57b4e4a"
heat_domain_id = "cf34d55eaf294678971be7ad732be0d2"

View File

@ -24,6 +24,8 @@ resource "openstack_compute_instance_v2" "test_server_01" {
network {
name = "private"
}
user_data = file("user-data.yaml")
}
resource "openstack_networking_floatingip_v2" "fip" {

View File

@ -0,0 +1,4 @@
#cloud-config
password: ubuntu
chpasswd: {expire: False}
ssh_pwauth: True

View File

@ -1,3 +1,7 @@
data "openstack_identity_role_v3" "admin"{
name = "admin"
}
data "openstack_identity_role_v3" "Member" {
name = "Member"
}

View File

@ -0,0 +1,16 @@
resource "openstack_identity_user_v3" "heat_domain_admin" {
domain_id = var.heat_domain_id
name = "heat_domain_admin"
password = "Ht8NdKTGdpJjRsS4V33tsVW4mSztgZMs" # leader-get heat-domain-admin-passwd
}
resource "openstack_identity_role_assignment_v3" "heat_admin_role_assignment" {
domain_id = var.heat_domain_id
user_id = openstack_identity_user_v3.heat_domain_admin.id
role_id = data.openstack_identity_role_v3.admin.id
}
resource "openstack_identity_role_v3" "heat_stack_user" {
name = "heat_stack_user"
}