Create instances for dogtag-ca and dogtag-cadb
This commit is contained in:
parent
f015bbb4a9
commit
308b47d847
7 changed files with 92 additions and 7 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
.terraform*
|
||||
terraform.tfstate*
|
||||
|
|
73
dtca.tf
73
dtca.tf
|
@ -1,3 +1,6 @@
|
|||
|
||||
# Create network ports
|
||||
|
||||
resource "openstack_networking_port_v2" "dtcaport" {
|
||||
name = "${var.caname}-sunet-se-port"
|
||||
network_id = data.openstack_networking_network_v2.public.id
|
||||
|
@ -7,9 +10,9 @@ resource "openstack_networking_port_v2" "dtcaport" {
|
|||
data.openstack_networking_secgroup_v2.allegress.id
|
||||
]
|
||||
admin_state_up = "true"
|
||||
lifecycle {
|
||||
prevent_destroy = true
|
||||
}
|
||||
#lifecycle {
|
||||
# prevent_destroy = true
|
||||
#}
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,7 +25,67 @@ resource "openstack_networking_port_v2" "dtcadbport" {
|
|||
data.openstack_networking_secgroup_v2.allegress.id
|
||||
]
|
||||
admin_state_up = "true"
|
||||
lifecycle {
|
||||
prevent_destroy = true
|
||||
#lifecycle {
|
||||
# prevent_destroy = true
|
||||
#}
|
||||
}
|
||||
|
||||
# Create volumes
|
||||
|
||||
resource "openstack_blockstorage_volume_v3" "cavolumeboot" {
|
||||
name = "${var.caname}-sunet-se-vol"
|
||||
description = "OS volume for ${var.caname}"
|
||||
size = 100
|
||||
image_id = data.openstack_images_image_v2.caimage.id
|
||||
enable_online_resize = true # Allow us to resize volume while attached.
|
||||
}
|
||||
|
||||
resource "openstack_blockstorage_volume_v3" "cadbvolumeboot" {
|
||||
name = "${var.cadbname}-sunet-se-vol"
|
||||
description = "OS volume for ${var.cadbname}"
|
||||
size = 100
|
||||
image_id = data.openstack_images_image_v2.caimage.id
|
||||
enable_online_resize = true # Allow us to resize volume while attached.
|
||||
}
|
||||
|
||||
# Create ca instance
|
||||
resource "openstack_compute_instance_v2" "dtca" {
|
||||
name = "${var.caname}.sunet.se"
|
||||
flavor_id = data.openstack_compute_flavor_v2.b2c2r4.id
|
||||
key_pair = data.openstack_compute_keypair_v2.manderssonpub.id
|
||||
security_groups = [
|
||||
data.openstack_networking_secgroup_v2.sshfromjumphosts.name,
|
||||
data.openstack_networking_secgroup_v2.allegress.name
|
||||
]
|
||||
|
||||
network {
|
||||
port = resource.openstack_networking_port_v2.dtcaport.id
|
||||
}
|
||||
|
||||
block_device {
|
||||
uuid = resource.openstack_blockstorage_volume_v3.cavolumeboot.id
|
||||
source_type = "volume"
|
||||
destination_type = "volume"
|
||||
}
|
||||
}
|
||||
|
||||
# Create cadb instance
|
||||
resource "openstack_compute_instance_v2" "dtcadb" {
|
||||
name = "${var.cadbname}.sunet.se"
|
||||
flavor_id = data.openstack_compute_flavor_v2.b2c2r4.id
|
||||
key_pair = data.openstack_compute_keypair_v2.manderssonpub.id
|
||||
security_groups = [
|
||||
data.openstack_networking_secgroup_v2.sshfromjumphosts.name,
|
||||
data.openstack_networking_secgroup_v2.allegress.name
|
||||
]
|
||||
|
||||
network {
|
||||
port = resource.openstack_networking_port_v2.dtcadbport.id
|
||||
}
|
||||
|
||||
block_device {
|
||||
uuid = resource.openstack_blockstorage_volume_v3.cadbvolumeboot.id
|
||||
source_type = "volume"
|
||||
destination_type = "volume"
|
||||
}
|
||||
}
|
||||
|
|
4
flavors.tf
Normal file
4
flavors.tf
Normal file
|
@ -0,0 +1,4 @@
|
|||
data "openstack_compute_flavor_v2" "b2c2r4" {
|
||||
name = "b2.c2r4"
|
||||
}
|
||||
|
4
images.tf
Normal file
4
images.tf
Normal file
|
@ -0,0 +1,4 @@
|
|||
data "openstack_images_image_v2" "caimage" {
|
||||
name = "${var.imagename}"
|
||||
most_recent = true
|
||||
}
|
3
key.tf
Normal file
3
key.tf
Normal file
|
@ -0,0 +1,3 @@
|
|||
data "openstack_compute_keypair_v2" "manderssonpub" {
|
||||
name = "${var.keyname}"
|
||||
}
|
|
@ -1,2 +1,4 @@
|
|||
caname = "dtca-test"
|
||||
cadbname = "dtcadb-test"
|
||||
caname = "dtca-test"
|
||||
cadbname = "dtcadb-test"
|
||||
keyname = "mandersson-pub"
|
||||
imagename = "almalinux-9"
|
||||
|
|
8
vars.tf
8
vars.tf
|
@ -5,3 +5,11 @@ variable "caname" {
|
|||
variable "cadbname" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "keyname" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "imagename" {
|
||||
type = string
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue