Skip to content

remche/terraform-openstack-learninglab

Repository files navigation

terraform-openstack-learninglab

Terraform Registry

Build your learning lab on OpenStack

This module will spawn instances, create users and optionnaly set up a OCFS2 drive.

⚠️ Shared drive details

Requirements

  • A ceph volume type supporting multiattach
  • An OS image featuring OCFS2 services and kernel modules

Usage

To avoid any data loss, the Cinder volume lifecyle is set to prevent_destroy. It means that you won't be able to apply a plan that results in a volume destruction. To tear down the infrastructure, remove the volume from state first :

terraform state rm openstack_blockstorage_volume_v3.ocfs2[0]
terraform destroy

Orphaned volume can be later manually destroyed or reused in future infrastructure via volume_id variable.

Requirements

Name Version
terraform >= 0.13

Providers

Name Version
openstack n/a
random n/a
template n/a

Modules

No modules.

Resources

Name Type
openstack_blockstorage_volume_v3.ocfs2 resource
openstack_compute_floatingip_associate_v2.associate_floating_ip resource
openstack_compute_instance_v2.instance resource
openstack_compute_volume_attach_v2.ocfs2_attach resource
openstack_networking_floatingip_v2.floating_ip resource
openstack_networking_network_v2.tp_net resource
openstack_networking_router_interface_v2.router_interface resource
openstack_networking_router_v2.router resource
openstack_networking_subnet_v2.tp_subnet resource
random_password.password resource
openstack_networking_network_v2.dmz_net data source
template_cloudinit_config.config data source

Inputs

Name Description Type Default Required
dns_domain DNS domain string n/a yes
dns_nameservers DNS nameservers list(string) n/a yes
flavor Instance template string n/a yes
floating_ip_network Public network to use string n/a yes
hostname_prefix Prefix for instances string n/a yes
image_id Instance id string "" no
image_name Instance image name string "" no
instance_count Number of instance to spawn number n/a yes
key_pair Instance keypair string n/a yes
password_length User passwords length number 16 no
same_password Use same password for all users bool false no
shared_volume Use a OCFS shared volume bool false no
subnet_cidr Neutron subnet CIDR string "192.168.1.0/24" no
user_count Number of user to create number n/a yes
user_prefix Prefix for users string n/a yes
volume_device OCFS shared volume device path string "/dev/vdb" no
volume_id ID of an existing volume. Will create one if it does not exist string "" no
volume_mount_point OCFS shared volume mount point string "/mnt" no
volume_size OCFS shared volume size number 3 no
volume_type Cinder volume type (must support multiattach) string "" no

Outputs

Name Description
instances List of instances
users List of users/passwords