Skip to content

Instantly share code, notes, and snippets.

@rruu
Created August 7, 2018 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rruu/d1477793c5770d4255d727aad9d06346 to your computer and use it in GitHub Desktop.
Save rruu/d1477793c5770d4255d727aad9d06346 to your computer and use it in GitHub Desktop.
infra
# Configure the OpenStack Provider
provider "openstack" {
tenant_name = "xxx"
tenant_id = "xxx"
user_name = "xxxx@xxxx"
password = "xxxx"
auth_url = "https://infra.mail.ru:35357/v3/"
}
# app01
resource "openstack_compute_instance_v2" "app01" {
region = "RegionOne"
name = "app01"
image_id = "fce7b6f8-d395-4f93-9aac-1db55e14d766"
flavor_id = "25ae869c-be29-4840-8e12-99e046d2dbd4"
key_pair = "key2"
security_groups = ["all"]
block_device {
uuid = "da8fe38a-6236-4d60-a7b4-928c817137dc"
source_type = "image"
volume_size = 10
boot_index = 0
destination_type = "volume"
delete_on_termination = true
}
network {
name = "int-net1"
}
network {
name = "private"
}
}
resource "openstack_networking_floatingip_v2" "fip_1" {
pool = "ext-net"
}
resource "openstack_compute_floatingip_associate_v2" "fip_1" {
floating_ip = "${openstack_networking_floatingip_v2.fip_1.address}"
instance_id = "${openstack_compute_instance_v2.app01.id}"
}
## app02
#resource "openstack_compute_instance_v2" "app02" {
# region = "RegionOne"
# name = "app02"
# image_id = "fce7b6f8-d395-4f93-9aac-1db55e14d766"
# flavor_id = "25ae869c-be29-4840-8e12-99e046d2dbd4"
# key_pair = "key2"
# security_groups = ["all"]
#
#
# block_device {
# uuid = "da8fe38a-6236-4d60-a7b4-928c817137dc"
# source_type = "image"
# volume_size = 10
# boot_index = 0
# destination_type = "volume"
# delete_on_termination = true
# }
#
# network {
# name = "int-net1"
# }
#
# network {
# name = "private"
# }
#
#}
#
# resource "openstack_networking_floatingip_v2" "fip_2" {
# pool = "ext-net"
# }
#
# resource "openstack_compute_floatingip_associate_v2" "fip_2" {
# floating_ip = "${openstack_networking_floatingip_v2.fip_2.address}"
# instance_id = "${openstack_compute_instance_v2.app02.id}"
#}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment