Skip to content

atlet99/terraform-openstack-instance-module

Repository files navigation

Terraform Openstack Instances

This project aims to create a module to deploy instance(s) on openstack provider.

GitHub tag (latest by date)

Note: This module requires Terraform version 1.5.0 or higher and OpenStack provider version 3.2.0 or higher.

Terraform Registry

module "instance-module" {
  source  = "atlet99/instance-module/openstack"
  version = "1.0.3"
  # insert the 4 required variables here
}

Usage examples

module "test_instance_simple" {
	source  = "atlet99/instance-module/openstack"
	version = "1.0.3"
 
	name = "instance"
	flavor_name = "m1.xs" 
	image_id = "<image_id>"
	key_pair_name = "my_key_pair"
	public_ip_network = "floating"

	ports = [
		{
			name = "db_port",
			network_id = "db_network_id",
			subnet_id = "db_subnet_id",
		},
		{
			name = "web_port",
			network_id = "web_network_id",
			subnet_id = "web_subnet_id",
		}
	]
	server_groups = ["web"]
}

Requirements

Name Version
terraform >= 1.5.0
openstack ~> 3.2.0

Providers

Name Version
openstack 3.2.0

Resources

Name Type
openstack_blockstorage_volume_v3.volume_os resource
openstack_compute_instance_v2.instance resource
openstack_compute_interface_attach_v2.hot_ports_attach resource
openstack_compute_volume_attach_v2.extra_volumes resource
openstack_networking_floatingip_associate_v2.ipa resource
openstack_networking_floatingip_v2.ip resource
openstack_networking_port_v2.boot_ports resource
openstack_networking_port_v2.hot_ports resource

Inputs

Name Description Type Default Required
admin_pass The administrative password to assign to the server. string null no
availability_zone AZ where volume's available. string null no
backup_id The backup ID from which to create the volume. string null no
block_device_delete_on_termination Delete block device when instance is shut down bool true no
block_device_description The description of the block device. string null no
block_device_device_type The low-level device type that will be used (e.g., cdrom). string null no
block_device_disk_bus The low-level disk bus that will be used (e.g., virtio, scsi). string null no
block_device_guest_format Specifies the guest server disk file system format, such as ext4 or swap. string null no
block_device_metadata Metadata key/value pairs to associate with the volume. map(string) {} no
block_device_scheduler_hints Provide the Cinder scheduler with hints on where to instantiate a volume. any null no
block_device_volume_size The volume size of block device number 20 no
config_drive Whether to use the config_drive feature to configure the instance. bool true no
consistency_group_id The consistency group to place the volume in. string null no
enable_online_resize When this option is set it allows extending attached volumes. bool true no
extra_volumes A list of additional volumes to attach to the instance.
list(object({
volume_id = string
device = optional(string)
}))
[] no
fip_description Human-readable description for the floating IP. string null no
fip_dns_domain The floating IP DNS domain. string null no
fip_dns_name The floating IP DNS name. string null no
flavor_id Instance's flavor id referenced in openstack string null no
flavor_name Instance's flavor name referenced in openstack string null no
floating_ip_port_index The index of the port to associate the floating IP with (0 for first boot-port, then hot-ports). number 0 no
force_delete Whether to force the OpenStack instance to be forcefully deleted. bool false no
hot_ports Ports attached after instance creation (hot-plug). Does not cause replacement.
list(object({
name = string
network_id = string
subnet_id = optional(string)
admin_state_up = optional(bool, true)
security_group_ids = optional(list(string), [])
fixed_ips = optional(list(object({
subnet_id = optional(string)
ip_address = optional(string)
})), [])
port_security = optional(bool, true)
no_security_groups = optional(bool, false)
description = optional(string)
dns_name = optional(string)
qos_policy_id = optional(string)
mac_address = optional(string)
no_fixed_ip = optional(bool, false)
value_specs = optional(map(string), {})
allowed_address_pairs = optional(list(object({
ip_address = string
mac_address = optional(string)
})), [])
extra_dhcp_options = optional(list(object({
name = string
value = string
ip_version = optional(number, 4)
})), [])
binding = optional(object({
host_id = optional(string)
vnic_type = optional(string)
profile = optional(string)
}))
tags = optional(list(string), [])
}))
[] no
hypervisor_hostname Specifies the exact hypervisor hostname on which to create the instance. string null no
image_id The image's id referenced in openstack string null no
image_name The image's name referenced in openstack string null no
instance_availability_zone The availability zone in which to create the server. string null no
instance_availability_zone_hints The availability zone hints in which to create the server. string null no
key_pair_name The name of the ssh key referenced in openstack string n/a yes
metadata Metadata for the OpenStack instance. map(string) {} no
name Instance's name string n/a yes
network_mode Special string for 'network' option: 'auto' or 'none'. Conflicts with 'ports'. string null no
personalities A list of files to inject into the instance at boot time.
list(object({
file = string
content = string
}))
[] no
ports Ports attached at boot time (causes replacement on change). If empty, OpenStack will create a default port.
list(object({
name = string
network_id = string
subnet_id = optional(string)
admin_state_up = optional(bool, true)
security_group_ids = optional(list(string), [])
fixed_ips = optional(list(object({
subnet_id = optional(string)
ip_address = optional(string)
})), [])
port_security = optional(bool, true)
no_security_groups = optional(bool, false)
description = optional(string)
dns_name = optional(string)
qos_policy_id = optional(string)
mac_address = optional(string)
no_fixed_ip = optional(bool, false)
value_specs = optional(map(string), {})
allowed_address_pairs = optional(list(object({
ip_address = string
mac_address = optional(string)
})), [])
extra_dhcp_options = optional(list(object({
name = string
value = string
ip_version = optional(number, 4)
})), [])
binding = optional(object({
host_id = optional(string)
vnic_type = optional(string)
profile = optional(string)
}))
tags = optional(list(string), [])
}))
[] no
power_state The VM state. Only 'active', 'shutoff', 'paused' and 'shelved_offloaded' are supported values. string "active" no
public_ip_network The name of the network who give floating IPs string null no
region Region where volume's located. string null no
scheduler_hints Provide the Nova scheduler with hints on where to instantiate an instance. any null no
snapshot_id The snapshot ID from which to create the volume. string null no
source_replica The volume ID to replicate with. string null no
source_vol_id The volume ID from which to create the volume. string null no
stop_before_destroy Whether to try stop instance gracefully before destroying it. bool false no
tags The instances tags list(string) [] no
user_data The user data for instance string null no
vendor_options Vendor-specific options for the instance.
object({
ignore_resize_confirmation = optional(bool, false)
detach_ports_before_destroy = optional(bool, false)
})
null no
volume_retype_policy Migration policy when changing volume_type. 'never' or 'on-demand'. string null no
volume_type The type of volume to use, e.g., 'ceph-ssd', 'kz-ala-1-san-nvme-h1' or 'ceph-hdd' string "ceph-ssd" no

Outputs

Name Description
access_ip_v4 The first detected IPv4 address of the instance.
access_ip_v6 The first detected IPv6 address of the instance.
admin_pass The administrative password assigned to the server.
all_fixed_ips Full list of all fixed IP addresses on all ports.
all_metadata All metadata key/value pairs associated with the instance.
all_tags All tags associated with the instance.
availability_info Availability zone and hints for the instance.
boot_ports Details of ports attached at boot time.
created_at The creation time of the instance.
extra_volume_ids List of IDs for additional volumes attached to the instance.
floating_ips Flat list of floating IP addresses.
hot_ports Details of ports attached after boot (hot-plug).
instance_ids Flat list of instance IDs.
instance_info Detailed list of all ports (boot and hot) with tags, IPs, MAC addresses and binding info.
instance_metadata The metadata associated with the instance.
private_ips Flat list of the first private IP address for all ports.
root_volume_id The ID of the instance boot volume.
updated_at The time when the instance was last updated.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors