Last active
December 4, 2019 10:36
-
-
Save avakhov/389e544544a0d67dc5bbf6e12836ea3a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "openstack_blockstorage_volume_v1" "disk-for-box01" { | |
name = "disk-for-box01" | |
region = "ru-1" | |
size = 10 | |
image_id = "${var.image_list["ubuntu-x64-1604"]}" | |
volume_type = "basic.ru-1a" | |
} | |
resource "openstack_compute_instance_v2" "box01" { | |
name = "box01" | |
flavor_name = "flavor-1024-1" | |
region = "ru-1" | |
network { | |
uuid = "${var.network-id}" | |
fixed_ip_v4 = "${var.box01-ip}" | |
floating_ip = "${var.box01-floating-ip}" | |
} | |
metadata = { | |
"x_sel_server_default_addr" = "{\"ipv4\":\"\"}" | |
} | |
block_device { | |
uuid = "${openstack_blockstorage_volume_v1.disk-for-box01.id}" | |
source_type = "volume" | |
boot_index = 0 | |
destination_type = "volume" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# docker run --rm \ | |
# -e OS_AUTH_URL=https://api.selvpc.ru/identity/v3 \ | |
# -e OS_PROJECT_ID=$TF_VAR_PROJ_ID \ | |
# -e OS_USER_DOMAIN_NAME=$TF_VAR_SELECTEL_ACCOUNT \ | |
# -e OS_USERNAME=$TF_VAR_USER \ | |
# -e OS_PASSWORD=$TF_VAR_PASSWORD \ | |
# -e OS_REGION_NAME='ru-1' \ | |
# uchiru/ostack:v2 glance image-list | |
docker run --rm \ | |
-e OS_AUTH_URL=https://api.selvpc.ru/identity/v3 \ | |
-e OS_PROJECT_ID=$TF_VAR_PROJ_ID \ | |
-e OS_USER_DOMAIN_NAME=$TF_VAR_SELECTEL_ACCOUNT \ | |
-e OS_USERNAME=$TF_VAR_USER \ | |
-e OS_PASSWORD=$TF_VAR_PASSWORD \ | |
-e OS_REGION_NAME='ru-1' \ | |
uchiru/ostack:v2 nova flavor-create flavor-1024-1 auto 1024 0 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export TF_VAR_SELECTEL_ACCOUNT=3.. # ваш логин от аккаунта Селектела | |
export TF_VAR_PROJ_ID=5b1b496.. # идентификатор проекта | |
export TF_VAR_USER=... # логин пользователя | |
export TF_VAR_PASSWORD=... # пароль этого пользователя |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider "openstack" { | |
domain_name = "${var.SELECTEL_ACCOUNT}" | |
auth_url = "https://api.selvpc.ru/identity/v3" | |
tenant_name = "${var.PROJ_ID}" | |
tenant_id = "${var.PROJ_ID}" | |
user_name = "${var.USER}" | |
password = "${var.PASSWORD}" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variable "image_list" { | |
type = "map" | |
default = { | |
"ubuntu-x64-1604" = "ce532860-acef-40cd-b3c7-699c22b4dfd6" | |
} | |
} | |
variable "PROJ_ID" {} | |
variable "SELECTEL_ACCOUNT" {} | |
variable "USER" {} | |
variable "PASSWORD" {} | |
# floating IPs | |
variable "box01-floating-ip" { default = "77.244.221.145" } | |
# network | |
variable "network-id" { default = "90d4f3d5-8af6-45ec-986a-a2d7ec1d139e" } | |
variable "box01-ip" { default = "192.168.0.4" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment