Initial commit: stateful OpenStack API laboratory simulator.
Ship Keystone auth, multi-service handlers (Yoga→Dalmatian), Compose/Helm packaging, API contract packs, and pytest/Pulumi coverage labs.
This commit is contained in:
Generated
+24
@@ -0,0 +1,24 @@
|
||||
# This file is maintained automatically by "terraform init".
|
||||
# Manual edits may be lost in future updates.
|
||||
|
||||
provider "registry.terraform.io/terraform-provider-openstack/openstack" {
|
||||
version = "2.1.0"
|
||||
constraints = "~> 2.0"
|
||||
hashes = [
|
||||
"h1:FFgxjgOlyRstaP7vYdPpgai9q1U0T0OF9B4FF7ZknrM=",
|
||||
"zh:113661750398bf21c8fe36aade9fb6f5eb82b5bcd3bcd30bd37ac805d83398f4",
|
||||
"zh:1b3c26347b9cd61e413ee93c2f422cc3278a77f55fd3516eaabb3e2a85f65281",
|
||||
"zh:1b751bbf1e4152829a643b532fd3f5967a2e89a41fac381257e0b41665be3306",
|
||||
"zh:1b967bbfd9b344419c0e0df0c3a15fcbd731e91f19a18955a55aace8d9ec039a",
|
||||
"zh:1bc0fc7c0a21e568db043b654501ce668ba19bf7628d37a7d2aaa512fd6e5aeb",
|
||||
"zh:425cbf61757d4b503e7bf0f409ea59835ca3afbd2432d56ad552c2e5d234a572",
|
||||
"zh:67d4f059cb4d73bf6c060313ec32962c4e5bd8dc7be2542a6f2098ab32575cd9",
|
||||
"zh:7fe841ac5b68a4f52fb3cf45070828f3845de44746679d434e4349f3c23e3ef2",
|
||||
"zh:ac1ed4c6ef0b6a3410568a05d3f9933d184497f065988503c43da0b2f0786ab2",
|
||||
"zh:c5c0d14c86fabd9ab6a5d555e6a8d511942665fb5fa948dd452b0d1934068344",
|
||||
"zh:c9ae5c210192275185d6823566a9421983e8e64c2665a4cae00b92dd0706bd19",
|
||||
"zh:ee9865ccc053e7f345e532654fb628d1cf1e81cd2e929643c1691bebffcf7b98",
|
||||
"zh:f3416d2f666095e740522c4964e436470bb9ec17bd53aaae8169ad93297d07bd",
|
||||
"zh:fbca85457dd49e17168989d64f7cfc4a519d55ef4e00e89cea2859e87ad87f83",
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
terraform {
|
||||
required_version = ">= 1.5.0"
|
||||
required_providers {
|
||||
openstack = {
|
||||
source = "terraform-provider-openstack/openstack"
|
||||
version = "~> 2.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# OpenStack lab against openstack-api-simulator (NOT vsphere_* / VMware).
|
||||
# Equivalent of a compute instance: openstack_compute_instance_v2
|
||||
|
||||
provider "openstack" {
|
||||
auth_url = var.auth_url
|
||||
user_name = var.user_name
|
||||
password = var.password
|
||||
tenant_name = var.project_name
|
||||
domain_name = var.domain_name
|
||||
region = var.region
|
||||
insecure = true
|
||||
}
|
||||
|
||||
variable "auth_url" {
|
||||
type = string
|
||||
default = "http://127.0.0.1:5000/v3"
|
||||
}
|
||||
|
||||
variable "user_name" {
|
||||
type = string
|
||||
default = "admin"
|
||||
}
|
||||
|
||||
variable "password" {
|
||||
type = string
|
||||
default = "secret"
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "project_name" {
|
||||
type = string
|
||||
default = "demo"
|
||||
}
|
||||
|
||||
variable "domain_name" {
|
||||
type = string
|
||||
default = "Default"
|
||||
}
|
||||
|
||||
variable "region" {
|
||||
type = string
|
||||
default = "RegionOne"
|
||||
}
|
||||
|
||||
variable "image_name" {
|
||||
type = string
|
||||
default = "cirros"
|
||||
}
|
||||
|
||||
variable "flavor_id" {
|
||||
type = string
|
||||
default = "1"
|
||||
}
|
||||
|
||||
data "openstack_images_image_v2" "boot" {
|
||||
name = var.image_name
|
||||
most_recent = true
|
||||
}
|
||||
|
||||
data "openstack_networking_network_v2" "private" {
|
||||
name = "demo-net"
|
||||
}
|
||||
|
||||
resource "openstack_networking_network_v2" "app" {
|
||||
name = "tf-app-net"
|
||||
admin_state_up = true
|
||||
}
|
||||
|
||||
resource "openstack_networking_subnet_v2" "app" {
|
||||
name = "tf-app-subnet"
|
||||
network_id = openstack_networking_network_v2.app.id
|
||||
cidr = "10.99.0.0/24"
|
||||
ip_version = 4
|
||||
}
|
||||
|
||||
resource "openstack_compute_instance_v2" "app" {
|
||||
name = "tf-cookbook-vm"
|
||||
flavor_id = var.flavor_id
|
||||
image_id = data.openstack_images_image_v2.boot.id
|
||||
|
||||
network {
|
||||
uuid = data.openstack_networking_network_v2.private.id
|
||||
}
|
||||
|
||||
metadata = {
|
||||
managed_by = "terraform"
|
||||
stack = "openstack-api-simulator"
|
||||
}
|
||||
}
|
||||
|
||||
resource "openstack_blockstorage_volume_v3" "data" {
|
||||
name = "tf-cookbook-vol"
|
||||
size = 10
|
||||
}
|
||||
|
||||
resource "openstack_compute_volume_attach_v2" "data" {
|
||||
instance_id = openstack_compute_instance_v2.app.id
|
||||
volume_id = openstack_blockstorage_volume_v3.data.id
|
||||
}
|
||||
|
||||
output "server_id" {
|
||||
value = openstack_compute_instance_v2.app.id
|
||||
}
|
||||
|
||||
output "server_name" {
|
||||
value = openstack_compute_instance_v2.app.name
|
||||
}
|
||||
|
||||
output "network_id" {
|
||||
value = openstack_networking_network_v2.app.id
|
||||
}
|
||||
|
||||
output "volume_id" {
|
||||
value = openstack_blockstorage_volume_v3.data.id
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"version": 4,
|
||||
"terraform_version": "1.9.8",
|
||||
"serial": 33,
|
||||
"lineage": "1a96c121-a3b5-f759-513e-99d9ea2fbc67",
|
||||
"outputs": {},
|
||||
"resources": [],
|
||||
"check_results": null
|
||||
}
|
||||
@@ -0,0 +1,326 @@
|
||||
{
|
||||
"version": 4,
|
||||
"terraform_version": "1.9.8",
|
||||
"serial": 25,
|
||||
"lineage": "1a96c121-a3b5-f759-513e-99d9ea2fbc67",
|
||||
"outputs": {
|
||||
"network_id": {
|
||||
"value": "e32feab4-8e14-49d6-9e17-7d9a6476f118",
|
||||
"type": "string"
|
||||
},
|
||||
"server_id": {
|
||||
"value": "12edaad6-b6e9-4dbd-a425-dbf5cc922989",
|
||||
"type": "string"
|
||||
},
|
||||
"server_name": {
|
||||
"value": "tf-cookbook-vm",
|
||||
"type": "string"
|
||||
},
|
||||
"volume_id": {
|
||||
"value": "64a899aa-48fd-43d8-9e2b-af8b0111b1f5",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"mode": "data",
|
||||
"type": "openstack_images_image_v2",
|
||||
"name": "boot",
|
||||
"provider": "provider[\"registry.terraform.io/terraform-provider-openstack/openstack\"]",
|
||||
"instances": [
|
||||
{
|
||||
"schema_version": 0,
|
||||
"attributes": {
|
||||
"checksum": "",
|
||||
"container_format": "bare",
|
||||
"created_at": "2026-07-16T03:36:07Z",
|
||||
"disk_format": "qcow2",
|
||||
"file": "/v2/images/c58b99c0-2d7b-5842-b260-b617db2f7803/file",
|
||||
"hidden": false,
|
||||
"id": "c58b99c0-2d7b-5842-b260-b617db2f7803",
|
||||
"member_status": null,
|
||||
"metadata": {},
|
||||
"min_disk_gb": 0,
|
||||
"min_ram_mb": 0,
|
||||
"most_recent": true,
|
||||
"name": "cirros",
|
||||
"name_regex": null,
|
||||
"owner": "cfe100d7-d64c-530c-8286-4772dfea88ad",
|
||||
"properties": {},
|
||||
"protected": false,
|
||||
"region": "RegionOne",
|
||||
"schema": "/v2/schemas/image",
|
||||
"size_bytes": 13287936,
|
||||
"size_max": null,
|
||||
"size_min": null,
|
||||
"sort": "name:asc",
|
||||
"tag": null,
|
||||
"tags": [],
|
||||
"updated_at": "2026-07-16T03:36:07Z",
|
||||
"visibility": "public"
|
||||
},
|
||||
"sensitive_attributes": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"mode": "data",
|
||||
"type": "openstack_networking_network_v2",
|
||||
"name": "private",
|
||||
"provider": "provider[\"registry.terraform.io/terraform-provider-openstack/openstack\"]",
|
||||
"instances": [
|
||||
{
|
||||
"schema_version": 0,
|
||||
"attributes": {
|
||||
"admin_state_up": "true",
|
||||
"all_tags": [],
|
||||
"availability_zone_hints": [],
|
||||
"description": "",
|
||||
"dns_domain": "",
|
||||
"external": false,
|
||||
"id": "a245268b-88ba-597a-b8db-017810782f98",
|
||||
"matching_subnet_cidr": null,
|
||||
"mtu": 1450,
|
||||
"name": "demo-net",
|
||||
"network_id": null,
|
||||
"region": "RegionOne",
|
||||
"segments": [
|
||||
{
|
||||
"network_type": "vxlan",
|
||||
"physical_network": "",
|
||||
"segmentation_id": 0
|
||||
}
|
||||
],
|
||||
"shared": "false",
|
||||
"status": null,
|
||||
"subnets": [],
|
||||
"tags": null,
|
||||
"tenant_id": "8924e279-51c7-582e-b6f5-8e41b33e7581",
|
||||
"transparent_vlan": false
|
||||
},
|
||||
"sensitive_attributes": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"mode": "managed",
|
||||
"type": "openstack_blockstorage_volume_v3",
|
||||
"name": "data",
|
||||
"provider": "provider[\"registry.terraform.io/terraform-provider-openstack/openstack\"]",
|
||||
"instances": [
|
||||
{
|
||||
"schema_version": 0,
|
||||
"attributes": {
|
||||
"attachment": [],
|
||||
"availability_zone": "",
|
||||
"backup_id": "",
|
||||
"consistency_group_id": null,
|
||||
"description": "",
|
||||
"enable_online_resize": null,
|
||||
"id": "64a899aa-48fd-43d8-9e2b-af8b0111b1f5",
|
||||
"image_id": null,
|
||||
"metadata": {},
|
||||
"name": "tf-cookbook-vol",
|
||||
"region": "RegionOne",
|
||||
"scheduler_hints": [],
|
||||
"size": 10,
|
||||
"snapshot_id": "",
|
||||
"source_replica": null,
|
||||
"source_vol_id": "",
|
||||
"timeouts": null,
|
||||
"volume_type": "lvmdriver-1"
|
||||
},
|
||||
"sensitive_attributes": [],
|
||||
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6NjAwMDAwMDAwMDAwfX0="
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"mode": "managed",
|
||||
"type": "openstack_compute_instance_v2",
|
||||
"name": "app",
|
||||
"provider": "provider[\"registry.terraform.io/terraform-provider-openstack/openstack\"]",
|
||||
"instances": [
|
||||
{
|
||||
"schema_version": 0,
|
||||
"attributes": {
|
||||
"access_ip_v4": "10.0.0.173",
|
||||
"access_ip_v6": "",
|
||||
"admin_pass": null,
|
||||
"all_metadata": {},
|
||||
"all_tags": [
|
||||
"demo"
|
||||
],
|
||||
"availability_zone": "",
|
||||
"availability_zone_hints": null,
|
||||
"block_device": [],
|
||||
"config_drive": null,
|
||||
"created": "2026-07-16 03:36:12 +0000 UTC",
|
||||
"flavor_id": "1",
|
||||
"flavor_name": "m1.tiny",
|
||||
"force_delete": false,
|
||||
"id": "12edaad6-b6e9-4dbd-a425-dbf5cc922989",
|
||||
"image_id": "c58b99c0-2d7b-5842-b260-b617db2f7803",
|
||||
"image_name": "cirros",
|
||||
"key_pair": "",
|
||||
"metadata": {
|
||||
"managed_by": "terraform",
|
||||
"stack": "openstack-api-simulator"
|
||||
},
|
||||
"name": "tf-cookbook-vm",
|
||||
"network": [
|
||||
{
|
||||
"access_network": false,
|
||||
"fixed_ip_v4": "10.0.0.173",
|
||||
"fixed_ip_v6": "",
|
||||
"mac": "fa:16:3e:12:ed:aa",
|
||||
"name": "demo-net",
|
||||
"port": "",
|
||||
"uuid": "a245268b-88ba-597a-b8db-017810782f98"
|
||||
}
|
||||
],
|
||||
"network_mode": null,
|
||||
"personality": [],
|
||||
"power_state": "active",
|
||||
"region": "RegionOne",
|
||||
"scheduler_hints": [],
|
||||
"security_groups": [],
|
||||
"stop_before_destroy": false,
|
||||
"tags": null,
|
||||
"timeouts": null,
|
||||
"updated": "2026-07-16 03:36:12 +0000 UTC",
|
||||
"user_data": null,
|
||||
"vendor_options": []
|
||||
},
|
||||
"sensitive_attributes": [
|
||||
[
|
||||
{
|
||||
"type": "get_attr",
|
||||
"value": "admin_pass"
|
||||
}
|
||||
]
|
||||
],
|
||||
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxODAwMDAwMDAwMDAwLCJkZWxldGUiOjE4MDAwMDAwMDAwMDAsInVwZGF0ZSI6MTgwMDAwMDAwMDAwMH19",
|
||||
"dependencies": [
|
||||
"data.openstack_images_image_v2.boot",
|
||||
"data.openstack_networking_network_v2.private"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"mode": "managed",
|
||||
"type": "openstack_compute_volume_attach_v2",
|
||||
"name": "data",
|
||||
"provider": "provider[\"registry.terraform.io/terraform-provider-openstack/openstack\"]",
|
||||
"instances": [
|
||||
{
|
||||
"schema_version": 0,
|
||||
"attributes": {
|
||||
"device": "/dev/vdb",
|
||||
"id": "12edaad6-b6e9-4dbd-a425-dbf5cc922989/1662ea63-0b2e-4a54-8d78-ad218134fd5b",
|
||||
"instance_id": "12edaad6-b6e9-4dbd-a425-dbf5cc922989",
|
||||
"multiattach": null,
|
||||
"region": "RegionOne",
|
||||
"tag": null,
|
||||
"timeouts": null,
|
||||
"vendor_options": [],
|
||||
"volume_id": "64a899aa-48fd-43d8-9e2b-af8b0111b1f5"
|
||||
},
|
||||
"sensitive_attributes": [],
|
||||
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6NjAwMDAwMDAwMDAwfX0=",
|
||||
"dependencies": [
|
||||
"data.openstack_images_image_v2.boot",
|
||||
"data.openstack_networking_network_v2.private",
|
||||
"openstack_blockstorage_volume_v3.data",
|
||||
"openstack_compute_instance_v2.app"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"mode": "managed",
|
||||
"type": "openstack_networking_network_v2",
|
||||
"name": "app",
|
||||
"provider": "provider[\"registry.terraform.io/terraform-provider-openstack/openstack\"]",
|
||||
"instances": [
|
||||
{
|
||||
"schema_version": 0,
|
||||
"attributes": {
|
||||
"admin_state_up": true,
|
||||
"all_tags": [],
|
||||
"availability_zone_hints": [],
|
||||
"description": "",
|
||||
"dns_domain": "",
|
||||
"external": false,
|
||||
"id": "e32feab4-8e14-49d6-9e17-7d9a6476f118",
|
||||
"mtu": 1450,
|
||||
"name": "tf-app-net",
|
||||
"port_security_enabled": false,
|
||||
"qos_policy_id": "",
|
||||
"region": "RegionOne",
|
||||
"segments": [
|
||||
{
|
||||
"network_type": "vxlan",
|
||||
"physical_network": "",
|
||||
"segmentation_id": 0
|
||||
}
|
||||
],
|
||||
"shared": false,
|
||||
"tags": null,
|
||||
"tenant_id": "8924e279-51c7-582e-b6f5-8e41b33e7581",
|
||||
"timeouts": null,
|
||||
"transparent_vlan": false,
|
||||
"value_specs": null
|
||||
},
|
||||
"sensitive_attributes": [],
|
||||
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6NjAwMDAwMDAwMDAwfX0="
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"mode": "managed",
|
||||
"type": "openstack_networking_subnet_v2",
|
||||
"name": "app",
|
||||
"provider": "provider[\"registry.terraform.io/terraform-provider-openstack/openstack\"]",
|
||||
"instances": [
|
||||
{
|
||||
"schema_version": 0,
|
||||
"attributes": {
|
||||
"all_tags": [],
|
||||
"allocation_pool": [],
|
||||
"cidr": "10.99.0.0/24",
|
||||
"description": "",
|
||||
"dns_nameservers": [
|
||||
"8.8.8.8"
|
||||
],
|
||||
"dns_publish_fixed_ip": false,
|
||||
"enable_dhcp": true,
|
||||
"gateway_ip": "",
|
||||
"id": "956c5f10-205b-484c-813a-ec5eafe02f1b",
|
||||
"ip_version": 4,
|
||||
"ipv6_address_mode": "",
|
||||
"ipv6_ra_mode": "",
|
||||
"name": "tf-app-subnet",
|
||||
"network_id": "e32feab4-8e14-49d6-9e17-7d9a6476f118",
|
||||
"no_gateway": true,
|
||||
"prefix_length": null,
|
||||
"region": "RegionOne",
|
||||
"service_types": [],
|
||||
"subnetpool_id": "",
|
||||
"tags": null,
|
||||
"tenant_id": "8924e279-51c7-582e-b6f5-8e41b33e7581",
|
||||
"timeouts": null,
|
||||
"value_specs": null
|
||||
},
|
||||
"sensitive_attributes": [],
|
||||
"private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjo2MDAwMDAwMDAwMDAsImRlbGV0ZSI6NjAwMDAwMDAwMDAwfX0=",
|
||||
"dependencies": [
|
||||
"openstack_networking_network_v2.app"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"check_results": null
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
auth_url = "http://127.0.0.1:5000/v3"
|
||||
user_name = "admin"
|
||||
password = "secret"
|
||||
project_name = "demo"
|
||||
domain_name = "Default"
|
||||
image_name = "cirros"
|
||||
flavor_id = "1"
|
||||
Reference in New Issue
Block a user