|
|
@ -1,7 +1,7 @@ |
|
|
|
# Define CloudComp group number |
|
|
|
variable "group_number" { |
|
|
|
type = string |
|
|
|
default = "20" |
|
|
|
default = "<number of your group here, private-cloud is only reachable via vpn>" |
|
|
|
} |
|
|
|
|
|
|
|
## OpenStack credentials can be used in a more secure way by using |
|
|
@ -12,15 +12,17 @@ variable "group_number" { |
|
|
|
|
|
|
|
# Define OpenStack credentials, project config etc. |
|
|
|
locals { |
|
|
|
auth_url = "https://private-cloud.informatik.hs-fulda.de:5000/v3" |
|
|
|
auth_url = "https://10.32.4.182:5000/v3" |
|
|
|
user_name = "CloudComp${var.group_number}" |
|
|
|
user_password = "<password of your group here, private-cloud is only reachable via vpn>" |
|
|
|
tenant_name = "CloudComp${var.group_number}" |
|
|
|
#network_name = "CloudComp${var.group_number}-net" |
|
|
|
router_name = "CloudComp${var.group_number}-router" |
|
|
|
image_name = "Ubuntu 20.04 - Focal Fossa - 64-bit - Cloud Based Image" |
|
|
|
image_name = "ubuntu-22.04-jammy-x86_64" |
|
|
|
flavor_name = "m1.small" |
|
|
|
region_name = "RegionOne" |
|
|
|
floating_net = "ext_net" |
|
|
|
dns_nameservers = [ "10.33.16.100" ] |
|
|
|
} |
|
|
|
|
|
|
|
# Define OpenStack provider |
|
|
@ -29,7 +31,9 @@ required_version = ">= 0.14.0" |
|
|
|
required_providers { |
|
|
|
openstack = { |
|
|
|
source = "terraform-provider-openstack/openstack" |
|
|
|
version = ">= 1.47.0" |
|
|
|
# last version before 2.0.0, shows octavia/neutron lbaas deprecation warnings |
|
|
|
# "~> 1.54.1" |
|
|
|
version = ">= 2.0.0" |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -41,7 +45,8 @@ provider "openstack" { |
|
|
|
password = local.user_password |
|
|
|
auth_url = local.auth_url |
|
|
|
region = local.region_name |
|
|
|
use_octavia = true |
|
|
|
# due to currenty missing valid certificate |
|
|
|
insecure = true |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -108,6 +113,7 @@ resource "openstack_networking_subnet_v2" "terraform-subnet-1" { |
|
|
|
network_id = openstack_networking_network_v2.terraform-network-1.id |
|
|
|
cidr = "192.168.255.0/24" |
|
|
|
ip_version = 4 |
|
|
|
dns_nameservers = local.dns_nameservers |
|
|
|
} |
|
|
|
|
|
|
|
data "openstack_networking_router_v2" "router-1" { |
|
|
@ -165,12 +171,8 @@ resource "openstack_compute_instance_v2" "terraform-instance-1" { |
|
|
|
# |
|
|
|
########################################################################### |
|
|
|
resource "openstack_networking_floatingip_v2" "fip_1" { |
|
|
|
pool = "public1" |
|
|
|
} |
|
|
|
|
|
|
|
resource "openstack_compute_floatingip_associate_v2" "fip_1_assoc" { |
|
|
|
floating_ip = openstack_networking_floatingip_v2.fip_1.address |
|
|
|
instance_id = openstack_compute_instance_v2.terraform-instance-1.id |
|
|
|
pool = local.floating_net |
|
|
|
port_id = openstack_compute_instance_v2.terraform-instance-1.network[0].port |
|
|
|
} |
|
|
|
|
|
|
|
output "vip_addr" { |
|
|
|