diff --git a/.github/workflows/modules.yml b/.github/workflows/modules.yml new file mode 100644 index 0000000..09d2ab1 --- /dev/null +++ b/.github/workflows/modules.yml @@ -0,0 +1,48 @@ +name: 'Test Selectel Terraform modules' + +on: + schedule: + - cron: '0 7 * * *' # run every day at 10:00 MSK + workflow_dispatch: + +jobs: + setup: + name: 'Test Selectel Terraform modules' + runs-on: self-hosted + env: + TF_VAR_selectel_domain_name: ${{ secrets.SELECTEL_ID }} + TF_VAR_selectel_user_admin_user: ${{ secrets.SERVICE_USER }} + TF_VAR_selectel_user_admin_password: ${{ secrets.SERVICE_PASSWORD }} + + steps: + - name: Checkout the repo + uses: actions/checkout@v3 + + - name: Setup NodeJS v20 + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Setup Terraform + uses: hashicorp/setup-terraform@v3.0.0 + +# - name: Run Checkov action # suppressed for now because it fails to copy a file inside a self-hosted runner +# uses: bridgecrewio/checkov-action@v12 +# with: +# quiet: true +# directory: . +# output_format: cli +# framework: terraform,github_actions +# container_user: 1000 + + - name: Lint Terraform + run: terraform fmt -diff -check -recursive + + - name: Init Terraform + run: terraform init + + - name: Terraform apply + run: terraform apply -auto-approve + + - name: Terraform destroy + run: terraform destroy -auto-approve \ No newline at end of file diff --git a/.idea/GitlabLint.xml b/.idea/GitlabLint.xml new file mode 100644 index 0000000..76d5271 --- /dev/null +++ b/.idea/GitlabLint.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..d56657a --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..52a1c19 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/selectel-infra-examples.iml b/.idea/selectel-infra-examples.iml new file mode 100644 index 0000000..d0876a7 --- /dev/null +++ b/.idea/selectel-infra-examples.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/shelf/Uncommitted_changes_before_Update_at_27_12_2023,_14_06_[Changes]/shelved.patch b/.idea/shelf/Uncommitted_changes_before_Update_at_27_12_2023,_14_06_[Changes]/shelved.patch new file mode 100644 index 0000000..26fd25f --- /dev/null +++ b/.idea/shelf/Uncommitted_changes_before_Update_at_27_12_2023,_14_06_[Changes]/shelved.patch @@ -0,0 +1,1459 @@ +Index: README.md +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+># Selectel terraform modules example\n\n\n> Для работы с облачными ресурсами в Selectel через `terraform` будет не лишним ознакомиться с документацией по работе с `terraform providers openstack/selectel` на [офф. странице.](https://docs.selectel.ru/terraform/)\n\nВ данном репозитории находяться примеры terraform модулей, используемых для создания инфраструктуры в облаке Selectel.\n\n## Usage\n\n1. Инициализировать terraform backend\n```bash\nterraform init\n```\n\n2. Создать файл `main.tf`, где описана необходимая инфраструктура (пример ниже - создание `simple file storage`)\n```yaml\nmodule \"sfs\" {\n source = \"modules/sfs\"\n os_network_id = var.nat_network_id\n os_subnet_id = var.nat_subnet_id\n sfs_size = var.sfs_size\n sfs_volume_type = var.sfs_volume_type\n os_availability_zone = var.os_availability_zone\n}\n```\n\n3. Для проверки и применения настроек необходимо запустить команды `terraform plan/apply`\n```bash\nterraform plan\nterraform apply\n```\n\n## Repository structure\n\n### Modules\n\n * [craas](modules/craas) - создание [Container as a Service](https://selectel.ru/services/cloud/container-registry/)\n * [flavor](modules/flavor) - создание flavor (тип инстанса)\n * [floatingip](modules/floatingip) - создание плавающего ip адреса\n * [image_datasource](modules/image_datasource) - считывание айдишника образа\n * [keypair](modules/keypair) - создание ключевой пары для подключения по ssh\n * [mks](modules/mks) - набор модулей для создания [Selectel Managed Kubernetes](https://selectel.ru/services/cloud/kubernetes/)\n * [k8s-cluster](modules/mks/k8s-cluster) - создание master ноды k8s\n * [k8s-cluster-standalone](modules/mks/k8s-cluster-standalone) - создание managed kubernetes кластера\n * [k8s-nodegroup](modules/mks/k8s-nodegroup) - создание compute ноды k8s\n * [k8s-nodegroup-gpu](modules/mks/k8s-nodegroup-gpu) - создание compute ноды с gpu k8s\n * [nat](modules/nat) - создание nat сет\n * [os_project_with_user](modules/os_project_with_user) - создание проекта в облаке selectel\n * [s3](modules/s3) - создание [объектного хранилища s3](https://selectel.ru/services/cloud/storage/)\n * [s3](modules/s3-bucket) - создание s3 бакета\n * [s3](modules/s3-credentioals) - создание s3 параметров авторизации\n * [selectel-token](modules/selectel) - создание токена аккаунта selectel\n * [sfs](modules/sfs) - создание [файлового хранилища](https://selectel.ru/lab/file-storage/)\n * [vm](modules/vm) - создание [виртуального облачного сервера](https://selectel.ru/services/cloud/servers/)\n * [volume](modules/volume) - создание облачного диска +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/README.md b/README.md +--- a/README.md (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/README.md (date 1703670370005) +@@ -1,4 +1,4 @@ +-# Selectel terraform modules example ++# Selectel infra terraform modules example + + + > Для работы с облачными ресурсами в Selectel через `terraform` будет не лишним ознакомиться с документацией по работе с `terraform providers openstack/selectel` на [офф. странице.](https://docs.selectel.ru/terraform/) +@@ -30,6 +30,31 @@ + terraform apply + ``` + ++## Example of usage ++ ++В репозитории можно найти пример использования модулей. В корне репозитория созданы `*.tf` файлы которые можно использовать как пример вызова модулей. ++ ++Для их использования достаточно перейти в корень репозитория и инициализоровать terraform: ++ ++```bash ++terraform init ++``` ++ ++Далее можно скорректировать некоторые параметры в файле `main.tf`, которые передаются в модули, например объем sfs, имя кластера и другие. ++ ++Теперь можно выполнять комадны `terraform plan/apply`, но чтобы terraform знал где именно ему все это добро запускать, необходимо указать значения переменных `selectel_domain_name`, `selectel_user_admin_user`, `selectel_user_admin_password`. К слову при вызове команд `terraform plan/apply` будет предложены ввести значения для данных переменных. ++ ++Приведу пример команды для запуска команды `terraform plan` и указанием `env` переменных перед командой: ++ ++```bash ++TF_VAR_selectel_domain_name= \ ++TF_VAR_selectel_user_admin_user=<Имя сервисного пользователя с нужными правами> \ ++TF_VAR_selectel_user_admin_password=<Пароль от сервисного пользователя> \ ++terraform plan ++``` ++ ++После успешного выполнения ++ + ## Repository structure + + ### Modules +Index: modules/os_project/README.md +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/os_project/README.md b/modules/os_project/README.md +new file mode 100644 +--- /dev/null (date 1703674921738) ++++ b/modules/os_project/README.md (date 1703674921738) +@@ -0,0 +1,35 @@ ++## Requirements ++ ++| Name | Version | ++|------|---------| ++| [terraform](#requirement\_terraform) | >= 1.5.0 | ++| [selectel](#requirement\_selectel) | >= 4.0.1 | ++ ++## Providers ++ ++| Name | Version | ++|------|---------| ++| [selectel](#provider\_selectel) | >= 4.0.1 | ++ ++## Modules ++ ++No modules. ++ ++## Resources ++ ++| Name | Type | ++|------|------| ++| [selectel_vpc_project_v2.project_1](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/vpc_project_v2) | resource | ++ ++## Inputs ++ ++| Name | Description | Type | Default | Required | ++|------|-------------|------|---------|:--------:| ++| [os\_project\_name](#input\_os\_project\_name) | Name of OpenStack project to create | `string` | n/a | yes | ++ ++## Outputs ++ ++| Name | Description | ++|------|-------------| ++| [project\_id](#output\_project\_id) | ID of created project | ++| [project\_name](#output\_project\_name) | Name of created project | +Index: modules/sfs/versions.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>terraform {\n required_providers {\n openstack = {\n source = \"terraform-provider-openstack/openstack\"\n version = \">= 1.46.0\"\n }\n }\n required_version = \">= 1.5.0\"\n}\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/sfs/versions.tf b/modules/sfs/versions.tf +--- a/modules/sfs/versions.tf (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/sfs/versions.tf (date 1703609108035) +@@ -2,7 +2,7 @@ + required_providers { + openstack = { + source = "terraform-provider-openstack/openstack" +- version = ">= 1.46.0" ++ version = "1.53.0" + } + } + required_version = ">= 1.5.0" +Index: modules/os_project/vars.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/os_project/vars.tf b/modules/os_project/vars.tf +new file mode 100644 +--- /dev/null (date 1703612440944) ++++ b/modules/os_project/vars.tf (date 1703612440944) +@@ -0,0 +1,4 @@ ++variable "os_project_name" { ++ description = "Name of OpenStack project to create" ++ type = string ++} +Index: modules/os_project/versions.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/os_project/versions.tf b/modules/os_project/versions.tf +new file mode 100644 +--- /dev/null (date 1703612440934) ++++ b/modules/os_project/versions.tf (date 1703612440934) +@@ -0,0 +1,9 @@ ++terraform { ++ required_providers { ++ selectel = { ++ source = "selectel/selectel" ++ version = ">= 4.0.1" ++ } ++ } ++ required_version = ">= 1.5.0" ++} +Index: modules/os_project/outputs.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/os_project/outputs.tf b/modules/os_project/outputs.tf +new file mode 100644 +--- /dev/null (date 1703612440937) ++++ b/modules/os_project/outputs.tf (date 1703612440937) +@@ -0,0 +1,9 @@ ++output "project_id" { ++ description = "ID of created project" ++ value = selectel_vpc_project_v2.project_1.id ++} ++ ++output "project_name" { ++ description = "Name of created project" ++ value = selectel_vpc_project_v2.project_1.name ++} +Index: modules/os_project/main.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/os_project/main.tf b/modules/os_project/main.tf +new file mode 100644 +--- /dev/null (date 1703612440931) ++++ b/modules/os_project/main.tf (date 1703612440931) +@@ -0,0 +1,3 @@ ++resource "selectel_vpc_project_v2" "project_1" { ++ name = var.os_project_name ++} +Index: modules/sfs/README.md +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>\n## Requirements\n\n| Name | Version |\n|------|---------|\n| [terraform](#requirement\\_terraform) | >= 1.5.0 |\n| [openstack](#requirement\\_openstack) | >= 1.46.0 |\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| [openstack](#provider\\_openstack) | 1.46.0 |\n\n## Modules\n\nNo modules.\n\n## Resources\n\n| Name | Type |\n|------|------|\n| openstack_sharedfilesystem_share_access_v2.share_access_1 | resource |\n| openstack_sharedfilesystem_share_v2.sfs_share | resource |\n| openstack_sharedfilesystem_sharenetwork_v2.sfs_sharenetwork | resource |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| [nat\\_subnet\\_cidr](#input\\_nat\\_subnet\\_cidr) | Subnet, which will be able to access SFS | `string` | `\"10.222.0.0/16\"` | no |\n| [os\\_availability\\_zone](#input\\_os\\_availability\\_zone) | Zone, where SFS will be deployed | `string` | `\"ru-7a\"` | no |\n| [os\\_network\\_id](#input\\_os\\_network\\_id) | Network, where SFS will be deployed | `string` | n/a | yes |\n| [os\\_subnet\\_id](#input\\_os\\_subnet\\_id) | Subnet, where SFS will be deployed | `string` | n/a | yes |\n| [sfs\\_name\\_prefix](#input\\_sfs\\_name\\_prefix) | Prefix of all SFS resources | `string` | `\"cmlp\"` | no |\n| [sfs\\_proto](#input\\_sfs\\_proto) | SFS proto | `string` | `\"NFS\"` | no |\n| [sfs\\_size](#input\\_sfs\\_size) | SFS size | `number` | `50` | no |\n| [sfs\\_volume\\_type](#input\\_sfs\\_volume\\_type) | SFS volume type | `string` | `\"basic\"` | no |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| [sfs\\_address](#output\\_sfs\\_address) | SFS path |\n| [sfs\\_addressess](#output\\_sfs\\_addressess) | SFS paths array. For debug purposes |\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/sfs/README.md b/modules/sfs/README.md +--- a/modules/sfs/README.md (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/sfs/README.md (date 1703674945105) +@@ -1,16 +1,15 @@ +- + ## Requirements + + | Name | Version | + |------|---------| + | [terraform](#requirement\_terraform) | >= 1.5.0 | +-| [openstack](#requirement\_openstack) | >= 1.46.0 | ++| [openstack](#requirement\_openstack) | 1.53.0 | + + ## Providers + + | Name | Version | + |------|---------| +-| [openstack](#provider\_openstack) | 1.46.0 | ++| [openstack](#provider\_openstack) | 1.53.0 | + + ## Modules + +@@ -20,9 +19,9 @@ + + | Name | Type | + |------|------| +-| openstack_sharedfilesystem_share_access_v2.share_access_1 | resource | +-| openstack_sharedfilesystem_share_v2.sfs_share | resource | +-| openstack_sharedfilesystem_sharenetwork_v2.sfs_sharenetwork | resource | ++| [openstack_sharedfilesystem_share_access_v2.share_access_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/sharedfilesystem_share_access_v2) | resource | ++| [openstack_sharedfilesystem_share_v2.sfs_share](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/sharedfilesystem_share_v2) | resource | ++| [openstack_sharedfilesystem_sharenetwork_v2.sfs_sharenetwork](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/sharedfilesystem_sharenetwork_v2) | resource | + + ## Inputs + +@@ -43,4 +42,3 @@ + |------|-------------| + | [sfs\_address](#output\_sfs\_address) | SFS path | + | [sfs\_addressess](#output\_sfs\_addressess) | SFS paths array. For debug purposes | +- +\ No newline at end of file +Index: main.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/main.tf b/main.tf +new file mode 100644 +--- /dev/null (date 1703675114079) ++++ b/main.tf (date 1703675114079) +@@ -0,0 +1,119 @@ ++# Запуск модулей ++ ++# Создаем проект с пользователем ++# данный модуль создать проект/пользователя и креды для него ++module "project-with-user" { ++ source = "./modules/os_project_with_user" ++ os_project_name = "gh_test_tf_modules" ++ os_username = "gh_test_tf_user" ++} ++ ++# Создаём виртуалку и все что необходимо для ее работы ++module "vm" { ++ source = "./modules/vm" ++ os_region = "ru-9" ++ os_zone = "ru-9a" ++ vm_name = "test-vm" ++ server_root_disk_gb = ["10"] ++ vm_vcpus = 4 ++ vm_ram_mb = 4096 ++ enable_dhcp = true ++ ++ depends_on = [ ++ module.project-with-user ++ ] ++} ++ ++# Создаём simple file storage в ту же сеть что и виртуальная машина ++module "sfs" { ++ source = "./modules/sfs" ++ os_availability_zone = "ru-9a" ++ sfs_size = 70 ++ sfs_volume_type = "basic" ++ os_network_id = module.vm.nat_net_id ++ os_subnet_id = module.vm.nat_sub_id ++ ++ depends_on = [ ++ module.project-with-user ++ ] ++} ++ ++# S3 нет в провайдере selectel, поэтому под капотом terracurl ++ ++# Создаём S3-ключ для пользователя ++module "s3-creds" { ++ source = "./modules/s3/s3-credentials" ++ os_account = var.selectel_domain_name ++ os_username = var.selectel_user_admin_user ++ os_password = var.selectel_user_admin_password ++ os_user_id = module.project-with-user.user_id ++ os_project_id = module.project-with-user.project_id ++ credentials_name = "gh-s3-cred" ++ ++ depends_on = [ ++ module.project-with-user ++ ] ++} ++ ++# Создаём s3 bucket ++module "s3-bucket" { ++ source = "./modules/s3/s3-bucket" ++ os_account = var.selectel_domain_name ++ os_username = module.project-with-user.user_name ++ os_password = module.project-with-user.user_password ++ os_project_id = module.project-with-user.project_id ++ os_project_name = module.project-with-user.project_name ++ s3_bucket_name = "s3-gh-test" ++} ++ ++# Создаем CRaaS ++module "craas" { ++ source = "./modules/craas" ++ os_project_id = module.project-with-user.project_id ++ token_ttl = "1y" ++} ++ ++# Приатачим плавающий ip к виртуалке ++ ++# создадим floating ip ++module "fl_ip" { ++ source = "./modules/floatingip" ++ region = "ru-9" ++} ++ ++resource "openstack_networking_floatingip_associate_v2" "association_1" { ++ port_id = module.vm.vm_port_id ++ floating_ip = module.fl_ip.floatingip_address ++ region = "ru-9" ++} ++ ++# Создаем MKS с cpu и gpu нод группами ++module "mks" { ++ source = "./modules/mks/k8s-cluster-standalone" ++ ++ cluster_name = "gh-cluster-test" ++ kube_version = "1.28.3" # Здесь важно выбрать доступную версию, может протухнуть ++ ++ os_availability_zone = "ru-9a" ++ os_region = "ru-9" ++ os_project_id = module.project-with-user.project_id ++ ++ nodegroups = 2 ++ ng_nodes_count = [2, 1] ++ ng_cpus = [4, 4] ++ ng_ram_mb = [8192, 8192] ++ ng_volume_gb = [100, 100] ++ ng_volume_type = ["fast", "fast"] ++ ng_labels = [{ "role" : "system" }, { "role" : "cpu" }] ++ ++ gpu_nodegroups = 1 ++ gpu_ng_nodes_count = [1] ++ gpu_ng_volume_gb = [100] ++ gpu_ng_volume_type = ["fast"] ++ gpu_ng_labels = [{ "role" : "gpu" }] ++ gpu_ng_flavor = ["3031"] ++ ++ nat_subnet_cidr = "10.222.0.0/16" ++ enable_autorepair = false ++ network_id = "" ++} +Index: modules/nat/README.md +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>## Requirements\n\n| Name | Version |\n|------|---------|\n| [terraform](#requirement\\_terraform) | >= 1.5.0 |\n| [openstack](#requirement\\_openstack) | >= 1.46.0 |\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| [openstack](#provider\\_openstack) | >= 1.46.0 |\n\n## Modules\n\nNo modules.\n\n## Resources\n\n| Name | Type |\n|------|------|\n| openstack_networking_network_v2.network_1 | resource |\n| openstack_networking_router_interface_v2.router_interface_1 | resource |\n| openstack_networking_router_v2.router_1 | resource |\n| openstack_networking_subnet_v2.subnet_1 | resource |\n| openstack_networking_network_v2.external_net | data source |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| [dns\\_nameservers](#input\\_dns\\_nameservers) | DNS servers to be used | `list(string)` |
[
\"188.93.16.19\",
\"188.93.17.19\"
]
| no |\n| [enable\\_dhcp](#input\\_enable\\_dhcp) | DHCP enable flag | `bool` | `false` | no |\n| [network\\_name](#input\\_network\\_name) | Network name to be created | `string` | `\"network_1\"` | no |\n| [router\\_external\\_net\\_name](#input\\_router\\_external\\_net\\_name) | Name of external network to be used | `string` | `\"external-network\"` | no |\n| [router\\_name](#input\\_router\\_name) | Router name to be created | `string` | `\"router_1\"` | no |\n| [subnet\\_cidr](#input\\_subnet\\_cidr) | Subnet CIRD to be created | `string` | `\"192.168.0.0/24\"` | no |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| [external\\_network\\_id](#output\\_external\\_network\\_id) | ID внешней подсети |\n| [network\\_id](#output\\_network\\_id) | ID созданной сети |\n| [router\\_id](#output\\_router\\_id) | ID созданного роутера |\n| [subnet\\_id](#output\\_subnet\\_id) | ID созданной подсети |\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/nat/README.md b/modules/nat/README.md +--- a/modules/nat/README.md (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/nat/README.md (date 1703674916274) +@@ -3,13 +3,13 @@ + | Name | Version | + |------|---------| + | [terraform](#requirement\_terraform) | >= 1.5.0 | +-| [openstack](#requirement\_openstack) | >= 1.46.0 | ++| [openstack](#requirement\_openstack) | 1.53.0 | + + ## Providers + + | Name | Version | + |------|---------| +-| [openstack](#provider\_openstack) | >= 1.46.0 | ++| [openstack](#provider\_openstack) | 1.53.0 | + + ## Modules + +@@ -19,11 +19,11 @@ + + | Name | Type | + |------|------| +-| openstack_networking_network_v2.network_1 | resource | +-| openstack_networking_router_interface_v2.router_interface_1 | resource | +-| openstack_networking_router_v2.router_1 | resource | +-| openstack_networking_subnet_v2.subnet_1 | resource | +-| openstack_networking_network_v2.external_net | data source | ++| [openstack_networking_network_v2.network_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/networking_network_v2) | resource | ++| [openstack_networking_router_interface_v2.router_interface_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/networking_router_interface_v2) | resource | ++| [openstack_networking_router_v2.router_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/networking_router_v2) | resource | ++| [openstack_networking_subnet_v2.subnet_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/networking_subnet_v2) | resource | ++| [openstack_networking_network_v2.external_net](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/data-sources/networking_network_v2) | data source | + + ## Inputs + +Index: modules/os_project_with_user/README.md +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>## Requirements\n\n| Name | Version |\n|------|---------|\n| [terraform](#requirement\\_terraform) | >= 1.5.0 |\n| [random](#requirement\\_random) | >= 3.3.2 |\n| [selectel](#requirement\\_selectel) | >= 4.0.1 |\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| [random](#provider\\_random) | >= 3.3.2 |\n| [selectel](#provider\\_selectel) | >= 4.0.1 |\n\n## Modules\n\nNo modules.\n\n## Resources\n\n| Name | Type |\n|------|------|\n| random_password.user_1_password | resource |\n| selectel_vpc_project_v2.project_1 | resource |\n| selectel_vpc_role_v2.role_1 | resource |\n| selectel_vpc_user_v2.user_1 | resource |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| [os\\_project\\_name](#input\\_os\\_project\\_name) | Name of OpenStack project to create | `string` | n/a | yes |\n| [os\\_username](#input\\_os\\_username) | Username of user create in OpenStack project | `string` | n/a | yes |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| [project\\_id](#output\\_project\\_id) | ID of created project |\n| [project\\_name](#output\\_project\\_name) | Name of created project |\n| [role\\_id](#output\\_role\\_id) | ID of created user role |\n| [user\\_id](#output\\_user\\_id) | ID of user, that admins the project |\n| [user\\_name](#output\\_user\\_name) | Username of created user |\n| [user\\_password](#output\\_user\\_password) | Password of created user. Generated automatically. |\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/os_project_with_user/README.md b/modules/os_project_with_user/README.md +--- a/modules/os_project_with_user/README.md (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/os_project_with_user/README.md (date 1703674927185) +@@ -21,10 +21,10 @@ + + | Name | Type | + |------|------| +-| random_password.user_1_password | resource | +-| selectel_vpc_project_v2.project_1 | resource | +-| selectel_vpc_role_v2.role_1 | resource | +-| selectel_vpc_user_v2.user_1 | resource | ++| [random_password.user_1_password](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password) | resource | ++| [selectel_vpc_project_v2.project_1](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/vpc_project_v2) | resource | ++| [selectel_vpc_role_v2.role_1](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/vpc_role_v2) | resource | ++| [selectel_vpc_user_v2.user_1](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/vpc_user_v2) | resource | + + ## Inputs + +Index: modules/nat/versions.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>terraform {\n required_providers {\n openstack = {\n source = \"terraform-provider-openstack/openstack\"\n version = \">= 1.46.0\"\n }\n }\n required_version = \">= 1.5.0\"\n}\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/nat/versions.tf b/modules/nat/versions.tf +--- a/modules/nat/versions.tf (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/nat/versions.tf (date 1703609108029) +@@ -2,7 +2,7 @@ + required_providers { + openstack = { + source = "terraform-provider-openstack/openstack" +- version = ">= 1.46.0" ++ version = "1.53.0" + } + } + required_version = ">= 1.5.0" +Index: modules/mks/k8s-cluster-standalone/versions.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>terraform {\n required_providers {\n selectel = {\n source = \"selectel/selectel\"\n version = \">= 4.0.1\"\n }\n openstack = {\n source = \"terraform-provider-openstack/openstack\"\n version = \">= 1.46.0\"\n }\n }\n required_version = \">= 1.5.0\"\n}\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/mks/k8s-cluster-standalone/versions.tf b/modules/mks/k8s-cluster-standalone/versions.tf +--- a/modules/mks/k8s-cluster-standalone/versions.tf (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/mks/k8s-cluster-standalone/versions.tf (date 1703609108039) +@@ -2,11 +2,11 @@ + required_providers { + selectel = { + source = "selectel/selectel" +- version = ">= 4.0.1" ++ version = ">= 4.0.2" + } + openstack = { + source = "terraform-provider-openstack/openstack" +- version = ">= 1.46.0" ++ version = "1.53.0" + } + } + required_version = ">= 1.5.0" +Index: modules/mks/k8s-cluster-standalone/README.md +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>## Requirements\n\n| Name | Version |\n|------|---------|\n| [terraform](#requirement\\_terraform) | >= 1.5.0 |\n| [openstack](#requirement\\_openstack) | >= 1.46.0 |\n| [selectel](#requirement\\_selectel) | >= 4.0.1 |\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| [selectel](#provider\\_selectel) | >= 4.0.1 |\n\n## Modules\n\n| Name | Source | Version |\n|------|--------|---------|\n| [kubernetes\\_cluster](#module\\_kubernetes\\_cluster) | ../k8s-cluster | n/a |\n| [kubernetes\\_nodegroup](#module\\_kubernetes\\_nodegroup) | ../k8s-nodegroup | n/a |\n| [kubernetes\\_nodegroup\\_gpu](#module\\_kubernetes\\_nodegroup\\_gpu) | ../k8s-nodegroup-gpu | n/a |\n| [nat](#module\\_nat) | ../../nat | n/a |\n\n## Resources\n\n| Name | Type |\n|------|------|\n| selectel_mks_kubeconfig_v1.kubeconfig | data source |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| [cluster\\_name](#input\\_cluster\\_name) | n/a | `string` | n/a | yes |\n| [enable\\_autorepair](#input\\_enable\\_autorepair) | n/a | `bool` | `false` | no |\n| [enable\\_patch\\_version\\_auto\\_upgrade](#input\\_enable\\_patch\\_version\\_auto\\_upgrade) | n/a | `bool` | `false` | no |\n| [gpu\\_ng\\_flavor](#input\\_gpu\\_ng\\_flavor) | n/a | `list(string)` |
[
\"2\"
]
| no |\n| [gpu\\_ng\\_labels](#input\\_gpu\\_ng\\_labels) | n/a | `list(map(any))` |
[
{
\"role\": \"gpu\"
}
]
| no |\n| [gpu\\_ng\\_nodes\\_count](#input\\_gpu\\_ng\\_nodes\\_count) | n/a | `list(number)` |
[
2
]
| no |\n| [gpu\\_ng\\_taints](#input\\_gpu\\_ng\\_taints) | n/a |
list(object({
key = string
value = string
effect = string
}))
| `[]` | no |\n| [gpu\\_ng\\_volume\\_gb](#input\\_gpu\\_ng\\_volume\\_gb) | n/a | `list(number)` |
[
32
]
| no |\n| [gpu\\_ng\\_volume\\_type](#input\\_gpu\\_ng\\_volume\\_type) | n/a | `list(string)` |
[
\"fast\"
]
| no |\n| [gpu\\_nodegroups](#input\\_gpu\\_nodegroups) | n/a | `number` | `0` | no |\n| [kube\\_version](#input\\_kube\\_version) | n/a | `string` | n/a | yes |\n| [maintenance\\_window\\_end](#input\\_maintenance\\_window\\_end) | n/a | `string` | `\"04:00:00\"` | no |\n| [maintenance\\_window\\_start](#input\\_maintenance\\_window\\_start) | n/a | `string` | `\"03:00:00\"` | no |\n| [nat\\_subnet\\_cidr](#input\\_nat\\_subnet\\_cidr) | n/a | `string` | `\"10.222.0.0/16\"` | no |\n| [network\\_id](#input\\_network\\_id) | n/a | `string` | `\"\"` | no |\n| [ng\\_affinity\\_policy](#input\\_ng\\_affinity\\_policy) | n/a | `string` | `\"\"` | no |\n| [ng\\_cpus](#input\\_ng\\_cpus) | n/a | `list(number)` |
[
2
]
| no |\n| [ng\\_keypair\\_name](#input\\_ng\\_keypair\\_name) | n/a | `string` | `\"\"` | no |\n| [ng\\_labels](#input\\_ng\\_labels) | n/a | `list(map(any))` |
[
{
\"role\": \"system\"
}
]
| no |\n| [ng\\_nodes\\_count](#input\\_ng\\_nodes\\_count) | n/a | `list(number)` |
[
2
]
| no |\n| [ng\\_ram\\_mb](#input\\_ng\\_ram\\_mb) | n/a | `list(number)` |
[
4096
]
| no |\n| [ng\\_taints](#input\\_ng\\_taints) | n/a |
list(object({
key = string
value = string
effect = string
}))
| `[]` | no |\n| [ng\\_volume\\_gb](#input\\_ng\\_volume\\_gb) | n/a | `list(number)` |
[
32
]
| no |\n| [ng\\_volume\\_type](#input\\_ng\\_volume\\_type) | n/a | `list(string)` |
[
\"fast\"
]
| no |\n| [nodegroups](#input\\_nodegroups) | n/a | `string` | `1` | no |\n| [os\\_auth\\_url](#input\\_os\\_auth\\_url) | n/a | `string` | `\"https://api.selvpc.ru/identity/v3/auth/\"` | no |\n| [os\\_availability\\_zone](#input\\_os\\_availability\\_zone) | n/a | `string` | n/a | yes |\n| [os\\_project\\_id](#input\\_os\\_project\\_id) | ID проекта | `string` | n/a | yes |\n| [os\\_region](#input\\_os\\_region) | Region of openstack | `string` | n/a | yes |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| [kube\\_config](#output\\_kube\\_config) | n/a |\n| [nat\\_network\\_id](#output\\_nat\\_network\\_id) | n/a |\n| [nat\\_subnet\\_id](#output\\_nat\\_subnet\\_id) | n/a |\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/mks/k8s-cluster-standalone/README.md b/modules/mks/k8s-cluster-standalone/README.md +--- a/modules/mks/k8s-cluster-standalone/README.md (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/mks/k8s-cluster-standalone/README.md (date 1703674888376) +@@ -3,14 +3,14 @@ + | Name | Version | + |------|---------| + | [terraform](#requirement\_terraform) | >= 1.5.0 | +-| [openstack](#requirement\_openstack) | >= 1.46.0 | +-| [selectel](#requirement\_selectel) | >= 4.0.1 | ++| [openstack](#requirement\_openstack) | 1.53.0 | ++| [selectel](#requirement\_selectel) | >= 4.0.2 | + + ## Providers + + | Name | Version | + |------|---------| +-| [selectel](#provider\_selectel) | >= 4.0.1 | ++| [selectel](#provider\_selectel) | >= 4.0.2 | + + ## Modules + +@@ -25,7 +25,7 @@ + + | Name | Type | + |------|------| +-| selectel_mks_kubeconfig_v1.kubeconfig | data source | ++| [selectel_mks_kubeconfig_v1.kubeconfig](https://registry.terraform.io/providers/selectel/selectel/latest/docs/data-sources/mks_kubeconfig_v1) | data source | + + ## Inputs + +Index: modules/mks/k8s-nodegroup-gpu/README.md +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>## Requirements\n\n| Name | Version |\n|------|---------|\n| [terraform](#requirement\\_terraform) | >= 1.5.0 |\n| [selectel](#requirement\\_selectel) | >= 4.0.1 |\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| [selectel](#provider\\_selectel) | >= 4.0.1 |\n\n## Modules\n\nNo modules.\n\n## Resources\n\n| Name | Type |\n|------|------|\n| selectel_mks_nodegroup_v1.nodegroup_1 | resource |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| [affinity\\_policy](#input\\_affinity\\_policy) | n/a | `string` | `\"\"` | no |\n| [availability\\_zone](#input\\_availability\\_zone) | n/a | `any` | n/a | yes |\n| [cluster\\_id](#input\\_cluster\\_id) | ID кластера | `string` | n/a | yes |\n| [cpus](#input\\_cpus) | n/a | `number` | `1` | no |\n| [flavor\\_id](#input\\_flavor\\_id) | n/a | `any` | n/a | yes |\n| [keypair\\_name](#input\\_keypair\\_name) | n/a | `string` | `\"\"` | no |\n| [labels](#input\\_labels) | n/a | `any` | n/a | yes |\n| [nodes\\_count](#input\\_nodes\\_count) | n/a | `number` | `1` | no |\n| [os\\_project\\_id](#input\\_os\\_project\\_id) | ID проекта | `string` | n/a | yes |\n| [os\\_region](#input\\_os\\_region) | Регион my.selectel | `any` | n/a | yes |\n| [ram\\_mb](#input\\_ram\\_mb) | n/a | `number` | `1024` | no |\n| [taints](#input\\_taints) | n/a | `any` | n/a | yes |\n| [volume\\_gb](#input\\_volume\\_gb) | n/a | `number` | `10` | no |\n| [volume\\_type](#input\\_volume\\_type) | n/a | `any` | n/a | yes |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| [nodegroup\\_id](#output\\_nodegroup\\_id) | ID созданной группы нод |\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/mks/k8s-nodegroup-gpu/README.md b/modules/mks/k8s-nodegroup-gpu/README.md +--- a/modules/mks/k8s-nodegroup-gpu/README.md (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/mks/k8s-nodegroup-gpu/README.md (date 1703674909534) +@@ -3,13 +3,13 @@ + | Name | Version | + |------|---------| + | [terraform](#requirement\_terraform) | >= 1.5.0 | +-| [selectel](#requirement\_selectel) | >= 4.0.1 | ++| [selectel](#requirement\_selectel) | >= 4.0.2 | + + ## Providers + + | Name | Version | + |------|---------| +-| [selectel](#provider\_selectel) | >= 4.0.1 | ++| [selectel](#provider\_selectel) | >= 4.0.2 | + + ## Modules + +@@ -19,7 +19,7 @@ + + | Name | Type | + |------|------| +-| selectel_mks_nodegroup_v1.nodegroup_1 | resource | ++| [selectel_mks_nodegroup_v1.nodegroup_1](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/mks_nodegroup_v1) | resource | + + ## Inputs + +Index: modules/mks/k8s-nodegroup-gpu/versions.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>terraform {\n required_providers {\n selectel = {\n source = \"selectel/selectel\"\n version = \">= 4.0.1\"\n }\n }\n required_version = \">= 1.5.0\"\n}\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/mks/k8s-nodegroup-gpu/versions.tf b/modules/mks/k8s-nodegroup-gpu/versions.tf +--- a/modules/mks/k8s-nodegroup-gpu/versions.tf (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/mks/k8s-nodegroup-gpu/versions.tf (date 1703608624717) +@@ -2,7 +2,7 @@ + required_providers { + selectel = { + source = "selectel/selectel" +- version = ">= 4.0.1" ++ version = ">= 4.0.2" + } + } + required_version = ">= 1.5.0" +Index: modules/image_datasource/README.md +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>## Requirements\n\n| Name | Version |\n|------|---------|\n| [terraform](#requirement\\_terraform) | >= 1.5.0 |\n| [openstack](#requirement\\_openstack) | >= 1.46.0 |\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| [openstack](#provider\\_openstack) | >= 1.46.0 |\n\n## Modules\n\nNo modules.\n\n## Resources\n\n| Name | Type |\n|------|------|\n| [openstack_images_image_v2.image_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/latest/docs/data-sources/images_image_v2) | data source |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| [image\\_name](#input\\_image\\_name) | Имя образа | `string` | `\"Ubuntu 20.04 LTS 64-bit\"` | no |\n| [most\\_recent](#input\\_most\\_recent) | Если возвращается более одного результата, используйте самое последнее изображение. | `bool` | `true` | no |\n| [os\\_region](#input\\_os\\_region) | Region of openstack | `string` | n/a | yes |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| [image\\_id](#output\\_image\\_id) | ID созданного image |\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/image_datasource/README.md b/modules/image_datasource/README.md +--- a/modules/image_datasource/README.md (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/image_datasource/README.md (date 1703674857450) +@@ -3,13 +3,13 @@ + | Name | Version | + |------|---------| + | [terraform](#requirement\_terraform) | >= 1.5.0 | +-| [openstack](#requirement\_openstack) | >= 1.46.0 | ++| [openstack](#requirement\_openstack) | 1.53.0 | + + ## Providers + + | Name | Version | + |------|---------| +-| [openstack](#provider\_openstack) | >= 1.46.0 | ++| [openstack](#provider\_openstack) | 1.53.0 | + + ## Modules + +@@ -19,7 +19,7 @@ + + | Name | Type | + |------|------| +-| [openstack_images_image_v2.image_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/latest/docs/data-sources/images_image_v2) | data source | ++| [openstack_images_image_v2.image_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/data-sources/images_image_v2) | data source | + + ## Inputs + +Index: modules/mks/k8s-nodegroup/versions.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>terraform {\n required_providers {\n selectel = {\n source = \"selectel/selectel\"\n version = \">= 4.0.1\"\n }\n }\n required_version = \">= 1.5.0\"\n}\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/mks/k8s-nodegroup/versions.tf b/modules/mks/k8s-nodegroup/versions.tf +--- a/modules/mks/k8s-nodegroup/versions.tf (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/mks/k8s-nodegroup/versions.tf (date 1703608624711) +@@ -2,7 +2,7 @@ + required_providers { + selectel = { + source = "selectel/selectel" +- version = ">= 4.0.1" ++ version = ">= 4.0.2" + } + } + required_version = ">= 1.5.0" +Index: modules/image_datasource/versions.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>terraform {\n required_providers {\n openstack = {\n source = \"terraform-provider-openstack/openstack\"\n version = \">= 1.46.0\"\n }\n }\n required_version = \">= 1.5.0\"\n}\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/image_datasource/versions.tf b/modules/image_datasource/versions.tf +--- a/modules/image_datasource/versions.tf (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/image_datasource/versions.tf (date 1703609108032) +@@ -2,7 +2,7 @@ + required_providers { + openstack = { + source = "terraform-provider-openstack/openstack" +- version = ">= 1.46.0" ++ version = "1.53.0" + } + } + required_version = ">= 1.5.0" +Index: modules/mks/k8s-nodegroup/README.md +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>## Requirements\n\n| Name | Version |\n|------|---------|\n| [terraform](#requirement\\_terraform) | >= 1.5.0 |\n| [selectel](#requirement\\_selectel) | >= 4.0.1 |\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| [selectel](#provider\\_selectel) | >= 4.0.1 |\n\n## Modules\n\nNo modules.\n\n## Resources\n\n| Name | Type |\n|------|------|\n| selectel_mks_nodegroup_v1.nodegroup_1 | resource |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| [affinity\\_policy](#input\\_affinity\\_policy) | n/a | `string` | `\"\"` | no |\n| [availability\\_zone](#input\\_availability\\_zone) | n/a | `any` | n/a | yes |\n| [cluster\\_id](#input\\_cluster\\_id) | ID кластера | `string` | n/a | yes |\n| [cpus](#input\\_cpus) | n/a | `string` | `\"\"` | no |\n| [flavor\\_id](#input\\_flavor\\_id) | n/a | `string` | `\"\"` | no |\n| [keypair\\_name](#input\\_keypair\\_name) | n/a | `string` | `\"\"` | no |\n| [labels](#input\\_labels) | n/a | `any` | n/a | yes |\n| [nodes\\_count](#input\\_nodes\\_count) | n/a | `number` | `1` | no |\n| [os\\_project\\_id](#input\\_os\\_project\\_id) | ID проекта | `string` | n/a | yes |\n| [os\\_region](#input\\_os\\_region) | Region of openstack | `string` | n/a | yes |\n| [ram\\_mb](#input\\_ram\\_mb) | n/a | `string` | `\"\"` | no |\n| [taints](#input\\_taints) | n/a | `any` | n/a | yes |\n| [volume\\_gb](#input\\_volume\\_gb) | n/a | `number` | `10` | no |\n| [volume\\_type](#input\\_volume\\_type) | n/a | `any` | n/a | yes |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| [nodegroup\\_id](#output\\_nodegroup\\_id) | n/a |\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/mks/k8s-nodegroup/README.md b/modules/mks/k8s-nodegroup/README.md +--- a/modules/mks/k8s-nodegroup/README.md (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/mks/k8s-nodegroup/README.md (date 1703674902431) +@@ -3,13 +3,13 @@ + | Name | Version | + |------|---------| + | [terraform](#requirement\_terraform) | >= 1.5.0 | +-| [selectel](#requirement\_selectel) | >= 4.0.1 | ++| [selectel](#requirement\_selectel) | >= 4.0.2 | + + ## Providers + + | Name | Version | + |------|---------| +-| [selectel](#provider\_selectel) | >= 4.0.1 | ++| [selectel](#provider\_selectel) | >= 4.0.2 | + + ## Modules + +@@ -19,7 +19,7 @@ + + | Name | Type | + |------|------| +-| selectel_mks_nodegroup_v1.nodegroup_1 | resource | ++| [selectel_mks_nodegroup_v1.nodegroup_1](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/mks_nodegroup_v1) | resource | + + ## Inputs + +Index: modules/selectel-token/vars.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>variable \"os_username\" {\n type = string\n description = \"Логин пользователя\"\n}\n\nvariable \"os_password\" {\n type = string\n description = \"Пароль пользователя\"\n}\n\nvariable \"os_project_name\" {\n description = \"Название проекта, к которому будет создан ключ\"\n type = string\n default = \"\"\n}\n\nvariable \"os_account\" {\n type = string\n description = \"Account ID\"\n default = \"122972\"\n}\n\n\nvariable \"fetch_account_token\" {\n default = true\n type = bool\n description = \"Если пользователь не может получить токен аккаунта, выставить в 0\"\n} +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/selectel-token/vars.tf b/modules/selectel-token/vars.tf +--- a/modules/selectel-token/vars.tf (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/selectel-token/vars.tf (date 1703667097589) +@@ -9,17 +9,15 @@ + } + + variable "os_project_name" { +- description = "Название проекта, к которому будет создан ключ" + type = string ++ description = "Название проекта, к которому будет создан ключ" + default = "" + } + + variable "os_account" { + type = string + description = "Account ID" +- default = "122972" + } +- + + variable "fetch_account_token" { + default = true +Index: modules/mks/k8s-cluster/README.md +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>## Requirements\n\n| Name | Version |\n|------|---------|\n| [terraform](#requirement\\_terraform) | >= 1.5.0 |\n| [selectel](#requirement\\_selectel) | >= 4.0.1 |\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| [selectel](#provider\\_selectel) | >= 4.0.1 |\n\n## Modules\n\nNo modules.\n\n## Resources\n\n| Name | Type |\n|------|------|\n| selectel_mks_cluster_v1.cluster_1 | resource |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| [cluster\\_name](#input\\_cluster\\_name) | Имя кластера | `string` | n/a | yes |\n| [enable\\_autorepair](#input\\_enable\\_autorepair) | Включает или отключает автоматическое восстановление узлов (worker nodes автоматически перезапускаются). Автоматическое восстановление недоступно, если у вас есть один worker node. После автовосстановления все данные на загрузочных томах удаляются. | `bool` | `true` | no |\n| [enable\\_patch\\_version\\_auto\\_upgrade](#input\\_enable\\_patch\\_version\\_auto\\_upgrade) | Включает или отключает автоматическое обновление кластера до последней доступной версии исправления Kubernetes во время периода обслуживания. | `bool` | `true` | no |\n| [kube\\_version](#input\\_kube\\_version) | Версия кластера kubernetes | `string` | n/a | yes |\n| [maintenance\\_window\\_start](#input\\_maintenance\\_window\\_start) | Время в формате UTC, когда начинается обслуживание кластера. Формат: hh:mm:ss. | `string` | `\"\"` | no |\n| [os\\_network\\_id](#input\\_os\\_network\\_id) | ID сети openstack | `string` | n/a | yes |\n| [os\\_project\\_id](#input\\_os\\_project\\_id) | ID проекта | `string` | n/a | yes |\n| [os\\_region](#input\\_os\\_region) | Region of openstack | `string` | n/a | yes |\n| [os\\_subnet\\_id](#input\\_os\\_subnet\\_id) | ID подсети openstack | `string` | n/a | yes |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| [cluster\\_id](#output\\_cluster\\_id) | ID созданного кластера |\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/mks/k8s-cluster/README.md b/modules/mks/k8s-cluster/README.md +--- a/modules/mks/k8s-cluster/README.md (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/mks/k8s-cluster/README.md (date 1703674878034) +@@ -3,13 +3,13 @@ + | Name | Version | + |------|---------| + | [terraform](#requirement\_terraform) | >= 1.5.0 | +-| [selectel](#requirement\_selectel) | >= 4.0.1 | ++| [selectel](#requirement\_selectel) | >= 4.0.2 | + + ## Providers + + | Name | Version | + |------|---------| +-| [selectel](#provider\_selectel) | >= 4.0.1 | ++| [selectel](#provider\_selectel) | >= 4.0.2 | + + ## Modules + +@@ -19,7 +19,7 @@ + + | Name | Type | + |------|------| +-| selectel_mks_cluster_v1.cluster_1 | resource | ++| [selectel_mks_cluster_v1.cluster_1](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/mks_cluster_v1) | resource | + + ## Inputs + +Index: modules/selectel-token/README.md +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>## Requirements\n\n| Name | Version |\n|------|---------|\n| [terraform](#requirement\\_terraform) | >= 1.0.0 |\n| [http-full](#requirement\\_http-full) | >= 1.3.1 |\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| [http-full](#provider\\_http-full) | >= 1.3.1 |\n\n## Modules\n\nNo modules.\n\n## Resources\n\n| Name | Type |\n|------|------|\n| http-full_http.accout-token | data source |\n| http-full_http.project-token | data source |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| [fetch\\_account\\_token](#input\\_fetch\\_account\\_token) | Если пользователь не может получить токен аккаунта, выставить в 0 | `bool` | `true` | no |\n| [os\\_account](#input\\_os\\_account) | Account ID | `string` | `\"122972\"` | no |\n| [os\\_password](#input\\_os\\_password) | Пароль пользователя | `string` | n/a | yes |\n| [os\\_project\\_name](#input\\_os\\_project\\_name) | Название проекта, к которому будет создан ключ | `string` | `\"\"` | no |\n| [os\\_username](#input\\_os\\_username) | Логин пользователя | `string` | n/a | yes |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| [account\\_token](#output\\_account\\_token) | n/a |\n| [project\\_token](#output\\_project\\_token) | n/a |\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/selectel-token/README.md b/modules/selectel-token/README.md +--- a/modules/selectel-token/README.md (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/selectel-token/README.md (date 1703674938850) +@@ -19,15 +19,15 @@ + + | Name | Type | + |------|------| +-| http-full_http.accout-token | data source | +-| http-full_http.project-token | data source | ++| [http-full_http.accout-token](https://registry.terraform.io/providers/salrashid123/http-full/latest/docs/data-sources/http) | data source | ++| [http-full_http.project-token](https://registry.terraform.io/providers/salrashid123/http-full/latest/docs/data-sources/http) | data source | + + ## Inputs + + | Name | Description | Type | Default | Required | + |------|-------------|------|---------|:--------:| + | [fetch\_account\_token](#input\_fetch\_account\_token) | Если пользователь не может получить токен аккаунта, выставить в 0 | `bool` | `true` | no | +-| [os\_account](#input\_os\_account) | Account ID | `string` | `"122972"` | no | ++| [os\_account](#input\_os\_account) | Account ID | `string` | n/a | yes | + | [os\_password](#input\_os\_password) | Пароль пользователя | `string` | n/a | yes | + | [os\_project\_name](#input\_os\_project\_name) | Название проекта, к которому будет создан ключ | `string` | `""` | no | + | [os\_username](#input\_os\_username) | Логин пользователя | `string` | n/a | yes | +Index: modules/vm/outputs.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/vm/outputs.tf b/modules/vm/outputs.tf +new file mode 100644 +--- /dev/null (date 1703668107441) ++++ b/modules/vm/outputs.tf (date 1703668107441) +@@ -0,0 +1,11 @@ ++output "nat_net_id" { ++ value = module.nat.network_id ++} ++ ++output "nat_sub_id" { ++ value = module.nat.subnet_id ++} ++ ++output "vm_port_id" { ++ value = openstack_networking_port_v2.port_1.id ++} +Index: modules/mks/k8s-cluster/versions.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>terraform {\n required_providers {\n selectel = {\n source = \"selectel/selectel\"\n version = \">= 4.0.1\"\n }\n }\n required_version = \">= 1.5.0\"\n}\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/mks/k8s-cluster/versions.tf b/modules/mks/k8s-cluster/versions.tf +--- a/modules/mks/k8s-cluster/versions.tf (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/mks/k8s-cluster/versions.tf (date 1703608624714) +@@ -2,7 +2,7 @@ + required_providers { + selectel = { + source = "selectel/selectel" +- version = ">= 4.0.1" ++ version = ">= 4.0.2" + } + } + required_version = ">= 1.5.0" +Index: modules/floatingip/README.md +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>## Requirements\n\n| Name | Version |\n|------|---------|\n| [terraform](#requirement\\_terraform) | >= 1.5.0 |\n| [openstack](#requirement\\_openstack) | >= 1.46.0 |\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| [openstack](#provider\\_openstack) | >= 1.46.0 |\n\n## Modules\n\nNo modules.\n\n## Resources\n\n| Name | Type |\n|------|------|\n| [openstack_networking_floatingip_v2.floatingip_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/latest/docs/resources/networking_floatingip_v2) | resource |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| [pool](#input\\_pool) | Имя пула, из которого можно получить плавающий IP-адрес. Изменение этого параметра создает новый плавающий IP-адрес. | `string` | `\"external-network\"` | no |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| [floatingip\\_address](#output\\_floatingip\\_address) | floating ip |\n| [floatingip\\_id](#output\\_floatingip\\_id) | floating ip id |\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/floatingip/README.md b/modules/floatingip/README.md +--- a/modules/floatingip/README.md (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/floatingip/README.md (date 1703674850513) +@@ -3,13 +3,13 @@ + | Name | Version | + |------|---------| + | [terraform](#requirement\_terraform) | >= 1.5.0 | +-| [openstack](#requirement\_openstack) | >= 1.46.0 | ++| [openstack](#requirement\_openstack) | 1.53.0 | + + ## Providers + + | Name | Version | + |------|---------| +-| [openstack](#provider\_openstack) | >= 1.46.0 | ++| [openstack](#provider\_openstack) | 1.53.0 | + + ## Modules + +@@ -19,13 +19,14 @@ + + | Name | Type | + |------|------| +-| [openstack_networking_floatingip_v2.floatingip_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/latest/docs/resources/networking_floatingip_v2) | resource | ++| [openstack_networking_floatingip_v2.floatingip_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/networking_floatingip_v2) | resource | + + ## Inputs + + | Name | Description | Type | Default | Required | + |------|-------------|------|---------|:--------:| + | [pool](#input\_pool) | Имя пула, из которого можно получить плавающий IP-адрес. Изменение этого параметра создает новый плавающий IP-адрес. | `string` | `"external-network"` | no | ++| [region](#input\_region) | n/a | `string` | n/a | yes | + + ## Outputs + +Index: modules/floatingip/versions.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>terraform {\n required_providers {\n openstack = {\n source = \"terraform-provider-openstack/openstack\"\n version = \">= 1.46.0\"\n }\n }\n required_version = \">= 1.5.0\"\n}\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/floatingip/versions.tf b/modules/floatingip/versions.tf +--- a/modules/floatingip/versions.tf (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/floatingip/versions.tf (date 1703609108037) +@@ -2,7 +2,7 @@ + required_providers { + openstack = { + source = "terraform-provider-openstack/openstack" +- version = ">= 1.46.0" ++ version = "1.53.0" + } + } + required_version = ">= 1.5.0" +Index: modules/vm/vars.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>variable \"vm_name\" {\n type = string\n description = \"Name of VM to create\"\n}\n\nvariable \"os_region\" {\n type = string\n description = \"Region where network will be created\"\n}\n\nvariable \"os_zone\" {\n type = string\n description = \"OS zone to be used\"\n}\n\nvariable \"os_project_name\" {\n type = string\n description = \"Name of OpenStack project\"\n}\n\nvariable \"server_root_disk_gb\" {\n type = list(number)\n default = [40]\n description = \"List of disks\"\n}\n\n\nvariable \"server_volume_type\" {\n type = list(string)\n default = [\"fast\"]\n description = \"List of disk types\"\n}\n\nvariable \"image_name\" {\n type = list(string)\n default = [\"Ubuntu 20.04 LTS 64-bit\"]\n\n}\n\nvariable \"vm_local_disk_gb\" {\n type = string\n description = \"Flavor's local disk size\"\n default = \"0\"\n}\n\nvariable \"vm_vcpus\" {\n type = number\n description = \"CPU in VMs flavor\"\n default = 2\n}\n\nvariable \"vm_ram_mb\" {\n type = number\n description = \"RAM in VMs flavor\"\n default = 4096\n}\n\n\nvariable \"router_external_net_name\" {\n type = string\n default = \"external-network\"\n description = \"Name of external network to be used\"\n}\n\nvariable \"dns_nameservers\" {\n description = \"DNS servers to be used\"\n type = list(string)\n default = [\n \"188.93.16.19\",\n \"188.93.17.19\",\n ]\n}\n\nvariable \"subnet_cidr\" {\n description = \"Subnet CIRD to be created\"\n type = string\n default = \"192.168.0.0/24\"\n}\n\nvariable \"router_name\" {\n description = \"Router name to be created\"\n type = string\n default = \"router_1\"\n}\n\nvariable \"network_name\" {\n description = \"Network name to be created\"\n type = string\n default = \"network_1\"\n}\n\nvariable \"enable_dhcp\" {\n description = \"DHCP enable flag\"\n type = bool\n default = false\n}\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/vm/vars.tf b/modules/vm/vars.tf +--- a/modules/vm/vars.tf (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/vm/vars.tf (date 1703610852924) +@@ -13,18 +13,12 @@ + description = "OS zone to be used" + } + +-variable "os_project_name" { +- type = string +- description = "Name of OpenStack project" +-} +- + variable "server_root_disk_gb" { + type = list(number) + default = [40] + description = "List of disks" + } + +- + variable "server_volume_type" { + type = list(string) + default = ["fast"] +@@ -55,7 +49,6 @@ + default = 4096 + } + +- + variable "router_external_net_name" { + type = string + default = "external-network" +@@ -63,7 +56,7 @@ + } + + variable "dns_nameservers" { +- description = "DNS servers to be used" ++ description = "DNS servers to be used, selectel dns is default" + type = list(string) + default = [ + "188.93.16.19", +Index: modules/vm/main.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>module \"os-flavor\" {\n source = \"../flavor\"\n\n flavor_name = var.vm_name\n flavor_vcpus = var.vm_vcpus\n flavor_ram_mb = var.vm_ram_mb\n flavor_local_disk_gb = var.vm_local_disk_gb\n os_region = var.os_region\n}\n\nmodule \"volume\" {\n source = \"../volume\"\n\n count = length(var.server_root_disk_gb)\n server_root_disk_gb = var.server_root_disk_gb[count.index]\n server_volume_type = var.server_volume_type[count.index]\n os_zone = var.os_zone\n image_name = var.image_name[count.index]\n}\n\n\nmodule \"nat\" {\n source = \"../nat\"\n\n router_external_net_name = var.router_external_net_name\n dns_nameservers = var.dns_nameservers\n subnet_cidr = var.subnet_cidr\n router_name = var.router_name\n network_name = var.network_name\n enable_dhcp = var.enable_dhcp\n\n}\n\n\nresource \"openstack_networking_port_v2\" \"port_1\" {\n name = \"${var.vm_name}-eth0\"\n network_id = module.nat.network_id\n\n fixed_ip {\n subnet_id = module.nat.subnet_id\n }\n}\n\n\nresource \"openstack_compute_instance_v2\" \"instance_1\" {\n name = var.vm_name\n\n flavor_id = module.os-flavor.flavor_id\n availability_zone = var.os_zone\n\n network {\n port = openstack_networking_port_v2.port_1.id\n }\n\n dynamic \"block_device\" {\n for_each = module.volume\n content {\n source_type = \"volume\"\n destination_type = \"volume\"\n uuid = block_device.value.volume_id\n boot_index = block_device.key\n }\n }\n\n vendor_options {\n ignore_resize_confirmation = true\n }\n\n lifecycle {\n ignore_changes = [\n key_pair,\n ]\n }\n}\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/vm/main.tf b/modules/vm/main.tf +--- a/modules/vm/main.tf (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/vm/main.tf (date 1703610852928) +@@ -18,7 +18,6 @@ + image_name = var.image_name[count.index] + } + +- + module "nat" { + source = "../nat" + +@@ -28,9 +27,7 @@ + router_name = var.router_name + network_name = var.network_name + enable_dhcp = var.enable_dhcp +- + } +- + + resource "openstack_networking_port_v2" "port_1" { + name = "${var.vm_name}-eth0" +@@ -41,7 +38,6 @@ + } + } + +- + resource "openstack_compute_instance_v2" "instance_1" { + name = var.vm_name + +Index: modules/keypair/versions.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>terraform {\n required_providers {\n openstack = {\n source = \"terraform-provider-openstack/openstack\"\n version = \">= 1.46.0\"\n }\n }\n required_version = \">= 1.5.0\"\n}\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/keypair/versions.tf b/modules/keypair/versions.tf +--- a/modules/keypair/versions.tf (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/keypair/versions.tf (date 1703609108019) +@@ -2,7 +2,7 @@ + required_providers { + openstack = { + source = "terraform-provider-openstack/openstack" +- version = ">= 1.46.0" ++ version = "1.53.0" + } + } + required_version = ">= 1.5.0" +Index: modules/vm/versions.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>terraform {\n required_providers {\n selectel = {\n source = \"selectel/selectel\"\n version = \">= 4.0.1\"\n }\n openstack = {\n source = \"terraform-provider-openstack/openstack\"\n version = \">= 1.46.0\"\n }\n }\n required_version = \">= 1.5.0\"\n}\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/vm/versions.tf b/modules/vm/versions.tf +--- a/modules/vm/versions.tf (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/vm/versions.tf (date 1703609108016) +@@ -2,11 +2,11 @@ + required_providers { + selectel = { + source = "selectel/selectel" +- version = ">= 4.0.1" ++ version = ">= 4.0.2" + } + openstack = { + source = "terraform-provider-openstack/openstack" +- version = ">= 1.46.0" ++ version = "1.53.0" + } + } + required_version = ">= 1.5.0" +Index: modules/floatingip/vars.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>variable \"pool\" {\n type = string\n description = \"Имя пула, из которого можно получить плавающий IP-адрес. Изменение этого параметра создает новый плавающий IP-адрес.\"\n default = \"external-network\"\n}\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/floatingip/vars.tf b/modules/floatingip/vars.tf +--- a/modules/floatingip/vars.tf (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/floatingip/vars.tf (date 1703668107450) +@@ -3,3 +3,7 @@ + description = "Имя пула, из которого можно получить плавающий IP-адрес. Изменение этого параметра создает новый плавающий IP-адрес." + default = "external-network" + } ++ ++variable "region" { ++ type = string ++} +Index: modules/vm/README.md +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>\n## Requirements\n\n| Name | Version |\n|------|---------|\n| [terraform](#requirement\\_terraform) | >= 1.5.0 |\n| [openstack](#requirement\\_openstack) | >= 1.46.0 |\n| [selectel](#requirement\\_selectel) | >= 4.0.1 |\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| [openstack](#provider\\_openstack) | >= 1.46.0 |\n\n## Modules\n\n| Name | Source | Version |\n|------|--------|---------|\n| [nat](#module\\_nat) | git.selectel.org/rpd/nat/local | 1.0.0 |\n| [os-flavor](#module\\_os-flavor) | git.selectel.org/rpd/os-flavor/local | 1.0.0 |\n| [volume](#module\\_volume) | git.selectel.org/rpd/volume/local | 1.0.0 |\n\n## Resources\n\n| Name | Type |\n|------|------|\n| openstack_compute_instance_v2.instance_1 | resource |\n| openstack_networking_port_v2.port_1 | resource |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| [dns\\_nameservers](#input\\_dns\\_nameservers) | DNS servers to be used | `list(string)` |
[
\"188.93.16.19\",
\"188.93.17.19\"
]
| no |\n| [enable\\_dhcp](#input\\_enable\\_dhcp) | DHCP enable flag | `bool` | `false` | no |\n| [image\\_name](#input\\_image\\_name) | n/a | `list(string)` |
[
\"Ubuntu 20.04 LTS 64-bit\"
]
| no |\n| [network\\_name](#input\\_network\\_name) | Network name to be created | `string` | `\"network_1\"` | no |\n| [os\\_project\\_name](#input\\_os\\_project\\_name) | Name of OpenStack project | `string` | n/a | yes |\n| [os\\_region](#input\\_os\\_region) | Region where network will be created | `string` | n/a | yes |\n| [os\\_zone](#input\\_os\\_zone) | OS zone to be used | `string` | n/a | yes |\n| [router\\_external\\_net\\_name](#input\\_router\\_external\\_net\\_name) | Name of external network to be used | `string` | `\"external-network\"` | no |\n| [router\\_name](#input\\_router\\_name) | Router name to be created | `string` | `\"router_1\"` | no |\n| [server\\_root\\_disk\\_gb](#input\\_server\\_root\\_disk\\_gb) | List of disks | `list(number)` |
[
40
]
| no |\n| [server\\_volume\\_type](#input\\_server\\_volume\\_type) | List of disk types | `list(string)` |
[
\"fast\"
]
| no |\n| [subnet\\_cidr](#input\\_subnet\\_cidr) | Subnet CIRD to be created | `string` | `\"192.168.0.0/24\"` | no |\n| [vm\\_local\\_disk\\_gb](#input\\_vm\\_local\\_disk\\_gb) | Flavor's local disk size | `string` | `\"0\"` | no |\n| [vm\\_name](#input\\_vm\\_name) | Name of VM to create | `string` | n/a | yes |\n| [vm\\_ram\\_mb](#input\\_vm\\_ram\\_mb) | RAM in VMs flavor | `number` | `4096` | no |\n| [vm\\_vcpus](#input\\_vm\\_vcpus) | CPU in VMs flavor | `number` | `2` | no |\n\n## Outputs\n\nNo outputs.\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/vm/README.md b/modules/vm/README.md +--- a/modules/vm/README.md (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/vm/README.md (date 1703674950885) +@@ -1,42 +1,40 @@ +- + ## Requirements + + | Name | Version | + |------|---------| + | [terraform](#requirement\_terraform) | >= 1.5.0 | +-| [openstack](#requirement\_openstack) | >= 1.46.0 | +-| [selectel](#requirement\_selectel) | >= 4.0.1 | ++| [openstack](#requirement\_openstack) | 1.53.0 | ++| [selectel](#requirement\_selectel) | >= 4.0.2 | + + ## Providers + + | Name | Version | + |------|---------| +-| [openstack](#provider\_openstack) | >= 1.46.0 | ++| [openstack](#provider\_openstack) | 1.53.0 | + + ## Modules + + | Name | Source | Version | + |------|--------|---------| +-| [nat](#module\_nat) | git.selectel.org/rpd/nat/local | 1.0.0 | +-| [os-flavor](#module\_os-flavor) | git.selectel.org/rpd/os-flavor/local | 1.0.0 | +-| [volume](#module\_volume) | git.selectel.org/rpd/volume/local | 1.0.0 | ++| [nat](#module\_nat) | ../nat | n/a | ++| [os-flavor](#module\_os-flavor) | ../flavor | n/a | ++| [volume](#module\_volume) | ../volume | n/a | + + ## Resources + + | Name | Type | + |------|------| +-| openstack_compute_instance_v2.instance_1 | resource | +-| openstack_networking_port_v2.port_1 | resource | ++| [openstack_compute_instance_v2.instance_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/compute_instance_v2) | resource | ++| [openstack_networking_port_v2.port_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/networking_port_v2) | resource | + + ## Inputs + + | Name | Description | Type | Default | Required | + |------|-------------|------|---------|:--------:| +-| [dns\_nameservers](#input\_dns\_nameservers) | DNS servers to be used | `list(string)` |
[
"188.93.16.19",
"188.93.17.19"
]
| no | ++| [dns\_nameservers](#input\_dns\_nameservers) | DNS servers to be used, selectel dns is default | `list(string)` |
[
"188.93.16.19",
"188.93.17.19"
]
| no | + | [enable\_dhcp](#input\_enable\_dhcp) | DHCP enable flag | `bool` | `false` | no | + | [image\_name](#input\_image\_name) | n/a | `list(string)` |
[
"Ubuntu 20.04 LTS 64-bit"
]
| no | + | [network\_name](#input\_network\_name) | Network name to be created | `string` | `"network_1"` | no | +-| [os\_project\_name](#input\_os\_project\_name) | Name of OpenStack project | `string` | n/a | yes | + | [os\_region](#input\_os\_region) | Region where network will be created | `string` | n/a | yes | + | [os\_zone](#input\_os\_zone) | OS zone to be used | `string` | n/a | yes | + | [router\_external\_net\_name](#input\_router\_external\_net\_name) | Name of external network to be used | `string` | `"external-network"` | no | +@@ -51,5 +49,8 @@ + + ## Outputs + +-No outputs. +- +\ No newline at end of file ++| Name | Description | ++|------|-------------| ++| [nat\_net\_id](#output\_nat\_net\_id) | n/a | ++| [nat\_sub\_id](#output\_nat\_sub\_id) | n/a | ++| [vm\_port\_id](#output\_vm\_port\_id) | n/a | +Index: modules/floatingip/main.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>resource \"openstack_networking_floatingip_v2\" \"floatingip_1\" {\n pool = var.pool\n}\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/floatingip/main.tf b/modules/floatingip/main.tf +--- a/modules/floatingip/main.tf (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/floatingip/main.tf (date 1703668107445) +@@ -1,3 +1,4 @@ + resource "openstack_networking_floatingip_v2" "floatingip_1" { +- pool = var.pool ++ pool = var.pool ++ region = var.region + } +Index: modules/keypair/README.md +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>## Requirements\n\n| Name | Version |\n|------|---------|\n| [terraform](#requirement\\_terraform) | >= 1.5.0 |\n| [openstack](#requirement\\_openstack) | >= 1.46.0 |\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| [openstack](#provider\\_openstack) | >= 1.46.0 |\n\n## Modules\n\nNo modules.\n\n## Resources\n\n| Name | Type |\n|------|------|\n| openstack_compute_keypair_v2.keypair_1 | resource |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| [keypair\\_name](#input\\_keypair\\_name) | n/a | `string` | `\"keypair_1\"` | no |\n| [keypair\\_public\\_key](#input\\_keypair\\_public\\_key) | n/a | `string` | n/a | yes |\n| [os\\_region](#input\\_os\\_region) | Region of openstack | `string` | n/a | yes |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| [keypair\\_id](#output\\_keypair\\_id) | ID созданной KeyPair |\n| [keypair\\_name](#output\\_keypair\\_name) | Имя созданной KeyPair |\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/keypair/README.md b/modules/keypair/README.md +--- a/modules/keypair/README.md (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/keypair/README.md (date 1703674863903) +@@ -3,13 +3,13 @@ + | Name | Version | + |------|---------| + | [terraform](#requirement\_terraform) | >= 1.5.0 | +-| [openstack](#requirement\_openstack) | >= 1.46.0 | ++| [openstack](#requirement\_openstack) | 1.53.0 | + + ## Providers + + | Name | Version | + |------|---------| +-| [openstack](#provider\_openstack) | >= 1.46.0 | ++| [openstack](#provider\_openstack) | 1.53.0 | + + ## Modules + +@@ -19,7 +19,7 @@ + + | Name | Type | + |------|------| +-| openstack_compute_keypair_v2.keypair_1 | resource | ++| [openstack_compute_keypair_v2.keypair_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/compute_keypair_v2) | resource | + + ## Inputs + +Index: modules/volume/README.md +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>## Requirements\n\n| Name | Version |\n|------|---------|\n| [terraform](#requirement\\_terraform) | >= 1.5.0 |\n| [openstack](#requirement\\_openstack) | >= 1.46.0 |\n| [random](#requirement\\_random) | >= 3.3.2 |\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| [openstack](#provider\\_openstack) | >= 1.46.0 |\n| [random](#provider\\_random) | >= 3.3.2 |\n\n## Modules\n\nNo modules.\n\n## Resources\n\n| Name | Type |\n|------|------|\n| openstack_blockstorage_volume_v3.volume_1 | resource |\n| random_string.random | resource |\n| openstack_images_image_v2.image_1 | data source |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| [image\\_name](#input\\_image\\_name) | Root image name | `string` | `\"Ubuntu 20.04 LTS 64-bit\"` | no |\n| [image\\_visibility](#input\\_image\\_visibility) | Image visibility | `string` | `\"public\"` | no |\n| [os\\_zone](#input\\_os\\_zone) | OS zone to be used | `string` | n/a | yes |\n| [server\\_root\\_disk\\_gb](#input\\_server\\_root\\_disk\\_gb) | Root disk size | `number` | `40` | no |\n| [server\\_volume\\_type](#input\\_server\\_volume\\_type) | Disk type to be used | `string` | `\"fast\"` | no |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| [image\\_id](#output\\_image\\_id) | ID of image used |\n| [volume\\_id](#output\\_volume\\_id) | Created volume ID |\n| [volume\\_name](#output\\_volume\\_name) | Name of created volume |\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/volume/README.md b/modules/volume/README.md +--- a/modules/volume/README.md (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/volume/README.md (date 1703674955683) +@@ -3,14 +3,14 @@ + | Name | Version | + |------|---------| + | [terraform](#requirement\_terraform) | >= 1.5.0 | +-| [openstack](#requirement\_openstack) | >= 1.46.0 | ++| [openstack](#requirement\_openstack) | 1.53.0 | + | [random](#requirement\_random) | >= 3.3.2 | + + ## Providers + + | Name | Version | + |------|---------| +-| [openstack](#provider\_openstack) | >= 1.46.0 | ++| [openstack](#provider\_openstack) | 1.53.0 | + | [random](#provider\_random) | >= 3.3.2 | + + ## Modules +@@ -21,9 +21,9 @@ + + | Name | Type | + |------|------| +-| openstack_blockstorage_volume_v3.volume_1 | resource | +-| random_string.random | resource | +-| openstack_images_image_v2.image_1 | data source | ++| [openstack_blockstorage_volume_v3.volume_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/blockstorage_volume_v3) | resource | ++| [random_string.random](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/string) | resource | ++| [openstack_images_image_v2.image_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/data-sources/images_image_v2) | data source | + + ## Inputs + +Index: modules/s3/s3-bucket/versions.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>terraform {\n required_providers {\n openstack = {\n source = \"terraform-provider-openstack/openstack\"\n version = \">= 1.46.0\"\n }\n http-full = {\n source = \"salrashid123/http-full\"\n version = \">= 1.3.1\"\n }\n\n terracurl = {\n source = \"devops-rob/terracurl\"\n version = \">= 1.0.1\"\n }\n }\n required_version = \">= 1.5.0\"\n}\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/s3/s3-bucket/versions.tf b/modules/s3/s3-bucket/versions.tf +--- a/modules/s3/s3-bucket/versions.tf (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/s3/s3-bucket/versions.tf (date 1703609108013) +@@ -2,7 +2,7 @@ + required_providers { + openstack = { + source = "terraform-provider-openstack/openstack" +- version = ">= 1.46.0" ++ version = "1.53.0" + } + http-full = { + source = "salrashid123/http-full" +Index: modules/s3/s3-credentials/vars.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>variable \"os_username\" {\n type = string\n description = \"Логин пользователя МИНИМУМ с ролью Администратор пользователей. Именем этого пользователя будут выданы ключи от S3\"\n}\n\nvariable \"os_password\" {\n type = string\n description = \"Пароль пользователя МИНИМУМ с ролью Администратор пользователей. Именем этого пользователя будут выданы ключи от S3\"\n}\n\nvariable \"os_user_id\" {\n type = string\n description = \"ID пользователя, которому надо выдать ключи S3\"\n}\n\nvariable \"os_project_id\" {\n type = string\n description = \"ID проекта, в котором находится бакет\"\n}\n\nvariable \"os_account\" {\n type = string\n default = \"122972\"\n description = \"ID аккаунта\"\n}\n\n\nvariable \"credentials_name\" {\n default = \"CMLP\"\n type = string\n description = \"Название создаваемых кред для S3\"\n}\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/s3/s3-credentials/vars.tf b/modules/s3/s3-credentials/vars.tf +--- a/modules/s3/s3-credentials/vars.tf (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/s3/s3-credentials/vars.tf (date 1703667345542) +@@ -20,13 +20,10 @@ + + variable "os_account" { + type = string +- default = "122972" + description = "ID аккаунта" + } + +- + variable "credentials_name" { +- default = "CMLP" + type = string + description = "Название создаваемых кред для S3" + } +Index: modules/volume/versions.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>terraform {\n required_providers {\n openstack = {\n source = \"terraform-provider-openstack/openstack\"\n version = \">= 1.46.0\"\n }\n random = {\n source = \"hashicorp/random\"\n version = \">= 3.3.2\"\n }\n }\n required_version = \">= 1.5.0\"\n}\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/volume/versions.tf b/modules/volume/versions.tf +--- a/modules/volume/versions.tf (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/volume/versions.tf (date 1703609108022) +@@ -2,7 +2,7 @@ + required_providers { + openstack = { + source = "terraform-provider-openstack/openstack" +- version = ">= 1.46.0" ++ version = "1.53.0" + } + random = { + source = "hashicorp/random" +Index: modules/s3/s3-credentials/main.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>module \"selectel_token\" {\n source = \"../../selectel-token\"\n os_account = var.os_account\n os_password = var.os_password\n os_username = var.os_username\n}\n\nresource \"terracurl_request\" \"s3_credentials\" {\n name = \"vault-mount\"\n url = \"https://api.selectel.ru/iam/v1/service_users/${var.os_user_id}/credentials\"\n method = \"POST\"\n request_body = <UTF-8 +=================================================================== +diff --git a/modules/s3/s3-credentials/main.tf b/modules/s3/s3-credentials/main.tf +--- a/modules/s3/s3-credentials/main.tf (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/s3/s3-credentials/main.tf (date 1703667345549) +@@ -1,8 +1,8 @@ + module "selectel_token" { +- source = "../../selectel-token" +- os_account = var.os_account +- os_password = var.os_password +- os_username = var.os_username ++ source = "../../selectel-token" ++ os_account = var.os_account ++ os_password = var.os_password ++ os_username = var.os_username + } + + resource "terracurl_request" "s3_credentials" { +@@ -10,8 +10,8 @@ + url = "https://api.selectel.ru/iam/v1/service_users/${var.os_user_id}/credentials" + method = "POST" + request_body = <terraform {\n required_providers {\n openstack = {\n source = \"terraform-provider-openstack/openstack\"\n version = \">= 1.46.0\"\n }\n }\n required_version = \">= 1.5.0\"\n}\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/flavor/versions.tf b/modules/flavor/versions.tf +--- a/modules/flavor/versions.tf (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/flavor/versions.tf (date 1703609108025) +@@ -2,7 +2,7 @@ + required_providers { + openstack = { + source = "terraform-provider-openstack/openstack" +- version = ">= 1.46.0" ++ version = "1.53.0" + } + } + required_version = ">= 1.5.0" +Index: modules/s3/s3-bucket/vars.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>variable \"s3_bucket_name\" {\n type = string\n}\n\nvariable \"os_account\" {\n type = string\n description = \"Account ID\"\n default = \"122972\"\n}\n\nvariable \"os_region\" {\n type = string\n description = \"Region where network will be created\"\n default = \"ru-1\"\n}\n\nvariable \"os_username\" {\n type = string\n description = \"Login to be used\"\n}\n\nvariable \"os_password\" {\n type = string\n description = \"Password of user\"\n\n}\n\nvariable \"os_auth_url\" {\n type = string\n default = \"https://cloud.api.selcloud.ru/identity/v3\"\n description = \"Auth endpoint\"\n}\n\n\nvariable \"os_project_id\" {\n description = \"ID of project, where bucket will be created\"\n type = string\n}\n\n\nvariable \"os_project_name\" {\n description = \"ID of project, where bucket will be created\"\n type = string\n}\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/s3/s3-bucket/vars.tf b/modules/s3/s3-bucket/vars.tf +--- a/modules/s3/s3-bucket/vars.tf (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/s3/s3-bucket/vars.tf (date 1703613846211) +@@ -5,7 +5,6 @@ + variable "os_account" { + type = string + description = "Account ID" +- default = "122972" + } + + variable "os_region" { +Index: versions.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/versions.tf b/versions.tf +new file mode 100644 +--- /dev/null (date 1703609043364) ++++ b/versions.tf (date 1703609043364) +@@ -0,0 +1,13 @@ ++terraform { ++ required_providers { ++ selectel = { ++ source = "selectel/selectel" ++ version = "4.0.2" ++ } ++ openstack = { ++ source = "terraform-provider-openstack/openstack" ++ version = "1.53.0" ++ } ++ } ++ required_version = ">= 1.0.0" ++} +Index: vars.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/vars.tf b/vars.tf +new file mode 100644 +--- /dev/null (date 1703605935414) ++++ b/vars.tf (date 1703605935414) +@@ -0,0 +1,22 @@ ++# Selectel provider vars ++variable "selectel_domain_name" { ++ type = string ++ description = "ID Selectel аккаунта" ++} ++ ++variable "selectel_user_admin_user" { ++ type = string ++ description = "Имя сервисного пользователя, необходимо создать через панель my.selectel" ++} ++ ++variable "selectel_user_admin_password" { ++ type = string ++ description = "Пароль от сервисного пользователя" ++} ++ ++# Openstack provider vars ++variable "os_auth_url" { ++ type = string ++ default = "https://cloud.api.selcloud.ru/identity/v3" ++ description = "URL до openstack api" ++} +Index: modules/flavor/README.md +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>## Requirements\n\n| Name | Version |\n|------|---------|\n| [terraform](#requirement\\_terraform) | >= 1.5.0 |\n| [openstack](#requirement\\_openstack) | >= 1.46.0 |\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| [openstack](#provider\\_openstack) | >= 1.46.0 |\n\n## Modules\n\nNo modules.\n\n## Resources\n\n| Name | Type |\n|------|------|\n| [openstack_compute_flavor_v2.flavor](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/latest/docs/resources/compute_flavor_v2) | resource |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| [flavor\\_is\\_public](#input\\_flavor\\_is\\_public) | Make flavor public | `bool` | `false` | no |\n| [flavor\\_local\\_disk\\_gb](#input\\_flavor\\_local\\_disk\\_gb) | Local disk size in GB | `number` | `0` | no |\n| [flavor\\_name](#input\\_flavor\\_name) | Flavor name | `string` | `\"flavor\"` | no |\n| [flavor\\_ram\\_mb](#input\\_flavor\\_ram\\_mb) | RAM in MB in flavor | `number` | `2048` | no |\n| [flavor\\_vcpus](#input\\_flavor\\_vcpus) | CPUs in flavor | `number` | `2` | no |\n| [os\\_region](#input\\_os\\_region) | Region of openstack | `string` | n/a | yes |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| [flavor\\_id](#output\\_flavor\\_id) | n/a |\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/flavor/README.md b/modules/flavor/README.md +--- a/modules/flavor/README.md (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/flavor/README.md (date 1703674836211) +@@ -3,13 +3,13 @@ + | Name | Version | + |------|---------| + | [terraform](#requirement\_terraform) | >= 1.5.0 | +-| [openstack](#requirement\_openstack) | >= 1.46.0 | ++| [openstack](#requirement\_openstack) | 1.53.0 | + + ## Providers + + | Name | Version | + |------|---------| +-| [openstack](#provider\_openstack) | >= 1.46.0 | ++| [openstack](#provider\_openstack) | 1.53.0 | + + ## Modules + +@@ -19,7 +19,7 @@ + + | Name | Type | + |------|------| +-| [openstack_compute_flavor_v2.flavor](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/latest/docs/resources/compute_flavor_v2) | resource | ++| [openstack_compute_flavor_v2.flavor](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/compute_flavor_v2) | resource | + + ## Inputs + +Index: modules/craas/README.md +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>## Requirements\n\n| Name | Version |\n|------|---------|\n| [selectel](#requirement\\_selectel) | >= 4.0.1 |\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| [selectel](#provider\\_selectel) | >= 4.0.1 |\n\n## Modules\n\nNo modules.\n\n## Resources\n\n| Name | Type |\n|------|------|\n| [selectel_craas_registry_v1.registry_1](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/craas_registry_v1) | resource |\n| [selectel_craas_token_v1.token_1](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/craas_token_v1) | resource |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| [craas\\_name](#input\\_craas\\_name) | Имя CRaaS | `string` | `\"registry\"` | no |\n| [os\\_project\\_id](#input\\_os\\_project\\_id) | ID openstack проекта | `string` | n/a | yes |\n| [token\\_ttl](#input\\_token\\_ttl) | Время жизни токена | `string` | n/a | yes |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| [craas\\_password](#output\\_craas\\_password) | craas token |\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/craas/README.md b/modules/craas/README.md +--- a/modules/craas/README.md (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/craas/README.md (date 1703674729642) +@@ -2,13 +2,13 @@ + + | Name | Version | + |------|---------| +-| [selectel](#requirement\_selectel) | >= 4.0.1 | ++| [selectel](#requirement\_selectel) | >= 4.0.2 | + + ## Providers + + | Name | Version | + |------|---------| +-| [selectel](#provider\_selectel) | >= 4.0.1 | ++| [selectel](#provider\_selectel) | >= 4.0.2 | + + ## Modules + +Index: providers.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/providers.tf b/providers.tf +new file mode 100644 +--- /dev/null (date 1703612709463) ++++ b/providers.tf (date 1703612709463) +@@ -0,0 +1,15 @@ ++provider "selectel" { ++ domain_name = var.selectel_domain_name ++ username = var.selectel_user_admin_user ++ password = var.selectel_user_admin_password ++} ++ ++provider "openstack" { ++ auth_url = var.os_auth_url ++ user_name = module.project-with-user.user_name ++ tenant_name = module.project-with-user.project_name ++ password = module.project-with-user.user_password ++ project_domain_name = var.selectel_domain_name ++ user_domain_name = var.selectel_domain_name ++ region = "ru-9" ++} +Index: modules/craas/versions.tf +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>terraform {\n required_providers {\n selectel = {\n source = \"selectel/selectel\"\n version = \">= 4.0.1\"\n }\n }\n}\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/modules/craas/versions.tf b/modules/craas/versions.tf +--- a/modules/craas/versions.tf (revision f52b2b7f8d4f353d6831ffe7a29d08cb21ec1576) ++++ b/modules/craas/versions.tf (date 1703608624705) +@@ -2,7 +2,7 @@ + required_providers { + selectel = { + source = "selectel/selectel" +- version = ">= 4.0.1" ++ version = ">= 4.0.2" + } + } + } diff --git a/.idea/shelf/Uncommitted_changes_before_Update_at_27_12_2023__14_06__Changes_.xml b/.idea/shelf/Uncommitted_changes_before_Update_at_27_12_2023__14_06__Changes_.xml new file mode 100644 index 0000000..27c6222 --- /dev/null +++ b/.idea/shelf/Uncommitted_changes_before_Update_at_27_12_2023__14_06__Changes_.xml @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..8553017 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 5b5edc1..24afdec 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,80 @@ -# selectel-infra-examples -Selectel some examples of terraform modules +# Selectel infra terraform modules example + + +> Для работы с облачными ресурсами в Selectel через `terraform` будет не лишним ознакомиться с документацией по работе с `terraform providers openstack/selectel` на [офф. странице.](https://docs.selectel.ru/terraform/) + +В данном репозитории находяться примеры terraform модулей, используемых для создания инфраструктуры в облаке Selectel. + +## Usage + +1. Инициализировать terraform backend +```bash +terraform init +``` + +2. Создать файл `main.tf`, где описана необходимая инфраструктура (пример ниже - создание `simple file storage`) +```yaml +module "sfs" { + source = "modules/sfs" + os_network_id = var.nat_network_id + os_subnet_id = var.nat_subnet_id + sfs_size = var.sfs_size + sfs_volume_type = var.sfs_volume_type + os_availability_zone = var.os_availability_zone +} +``` + +3. Для проверки и применения настроек необходимо запустить команды `terraform plan/apply` +```bash +terraform plan +terraform apply +``` + +## Example of usage + +В репозитории можно найти пример использования модулей. В корне репозитория созданы `*.tf` файлы которые можно использовать как пример вызова модулей. + +Для их использования достаточно перейти в корень репозитория и инициализоровать terraform: + +```bash +terraform init +``` + +Далее можно скорректировать некоторые параметры в файле `main.tf`, которые передаются в модули, например объем sfs, имя кластера и другие. + +Теперь можно выполнять комадны `terraform plan/apply`, но чтобы terraform знал где именно ему все это добро запускать, необходимо указать значения переменных `selectel_domain_name`, `selectel_user_admin_user`, `selectel_user_admin_password`. К слову при вызове команд `terraform plan/apply` будет предложены ввести значения для данных переменных. + +Приведу пример команды для запуска команды `terraform plan/apply` и указанием `env` переменных перед командой: + +```bash +TF_VAR_selectel_domain_name= \ +TF_VAR_selectel_user_admin_user=<Имя сервисного пользователя с нужными правами> \ +TF_VAR_selectel_user_admin_password=<Пароль от сервисного пользователя> \ +terraform plan/apply +``` + +После успешного выполнения команды `terraform apply` вы должны увидеть с свое аккаунты новый проект, в котором будет запущены все модули (MKS, SFS, vm, CRaaS и др.) + +## Repository structure + +### Modules + + * [craas](modules/craas) - создание [Container as a Service](https://selectel.ru/services/cloud/container-registry/) + * [flavor](modules/flavor) - создание flavor (тип инстанса) + * [floatingip](modules/floatingip) - создание плавающего ip адреса + * [image_datasource](modules/image_datasource) - считывание айдишника образа + * [keypair](modules/keypair) - создание ключевой пары для подключения по ssh + * [mks](modules/mks) - набор модулей для создания [Selectel Managed Kubernetes](https://selectel.ru/services/cloud/kubernetes/) + * [k8s-cluster](modules/mks/k8s-cluster) - создание master ноды k8s + * [k8s-cluster-standalone](modules/mks/k8s-cluster-standalone) - создание managed kubernetes кластера + * [k8s-nodegroup](modules/mks/k8s-nodegroup) - создание compute ноды k8s + * [k8s-nodegroup-gpu](modules/mks/k8s-nodegroup-gpu) - создание compute ноды с gpu k8s + * [nat](modules/nat) - создание nat сет + * [os_project_with_user](modules/os_project_with_user) - создание проекта в облаке selectel + * [s3](modules/s3) - создание [объектного хранилища s3](https://selectel.ru/services/cloud/storage/) + * [s3](modules/s3-bucket) - создание s3 бакета + * [s3](modules/s3-credentioals) - создание s3 параметров авторизации + * [selectel-token](modules/selectel) - создание токена аккаунта selectel + * [sfs](modules/sfs) - создание [файлового хранилища](https://selectel.ru/lab/file-storage/) + * [vm](modules/vm) - создание [виртуального облачного сервера](https://selectel.ru/services/cloud/servers/) + * [volume](modules/volume) - создание облачного диска \ No newline at end of file diff --git a/main.tf b/main.tf new file mode 100644 index 0000000..a140948 --- /dev/null +++ b/main.tf @@ -0,0 +1,139 @@ +# Запуск модулей + +# Создаем проект с пользователем +# данный модуль создать проект/пользователя и креды для него +module "project-with-user" { + source = "./modules/os_project_with_user" + os_project_name = "gh_test_tf_modules" + os_username = "gh_test_tf_user" +} + +# Создаём виртуалку и все что необходимо для ее работы +module "vm" { + source = "./modules/vm" + os_region = "ru-9" + os_zone = "ru-9a" + vm_name = "test-vm" + server_root_disk_gb = ["10"] + vm_vcpus = 4 + vm_ram_mb = 4096 + enable_dhcp = true + + depends_on = [ + module.project-with-user + ] +} + +# Создаём simple file storage в ту же сеть что и виртуальная машина +module "sfs" { + source = "./modules/sfs" + os_availability_zone = "ru-9a" + sfs_size = 70 + sfs_volume_type = "basic" + os_network_id = module.vm.nat_net_id + os_subnet_id = module.vm.nat_sub_id + + depends_on = [ + module.vm + ] +} + +# S3 нет в провайдере selectel, поэтому под капотом terracurl + +# Создаём S3-ключ для пользователя +module "s3-creds" { + source = "./modules/s3/s3-credentials" + os_account = var.selectel_domain_name + os_username = var.selectel_user_admin_user + os_password = var.selectel_user_admin_password + os_user_id = module.project-with-user.user_id + os_project_id = module.project-with-user.project_id + credentials_name = "gh-s3-cred" + + depends_on = [ + module.project-with-user + ] +} + +# Создаём s3 bucket +module "s3-bucket" { + source = "./modules/s3/s3-bucket" + os_account = var.selectel_domain_name + os_username = module.project-with-user.user_name + os_password = module.project-with-user.user_password + os_project_id = module.project-with-user.project_id + os_project_name = module.project-with-user.project_name + s3_bucket_name = "s3-gh-test" + + depends_on = [ + module.project-with-user + ] +} + +# Создаем CRaaS +module "craas" { + source = "./modules/craas" + os_project_id = module.project-with-user.project_id + token_ttl = "1y" + + depends_on = [ + module.project-with-user + ] +} + +# Приатачим плавающий ip к виртуалке + +# создадим floating ip +module "fl_ip" { + source = "./modules/floatingip" + region = "ru-9" + + depends_on = [ + module.vm + ] +} + +resource "openstack_networking_floatingip_associate_v2" "association_1" { + port_id = module.vm.vm_port_id + floating_ip = module.fl_ip.floatingip_address + region = "ru-9" + + depends_on = [ + module.fl_ip + ] +} + +# Создаем MKS с cpu и gpu нод группами +module "mks" { + source = "./modules/mks/k8s-cluster-standalone" + + cluster_name = "gh-cluster-test" + kube_version = "1.28.3" # Здесь важно выбрать доступную версию, может протухнуть + + os_availability_zone = "ru-9a" + os_region = "ru-9" + os_project_id = module.project-with-user.project_id + + nodegroups = 1 + ng_nodes_count = [1] + ng_cpus = [4] + ng_ram_mb = [8192] + ng_volume_gb = [100] + ng_volume_type = ["fast"] + ng_labels = [{ "role" : "cpu" }] + + gpu_nodegroups = 1 + gpu_ng_nodes_count = [1] + gpu_ng_volume_gb = [100] + gpu_ng_volume_type = ["fast"] + gpu_ng_labels = [{ "role" : "gpu" }] + gpu_ng_flavor = ["3031"] + + nat_subnet_cidr = "10.222.0.0/16" + enable_autorepair = false + network_id = "" + + depends_on = [ + module.project-with-user + ] +} diff --git a/modules/craas/README.md b/modules/craas/README.md new file mode 100644 index 0000000..10225e6 --- /dev/null +++ b/modules/craas/README.md @@ -0,0 +1,36 @@ +## Requirements + +| Name | Version | +|------|---------| +| [selectel](#requirement\_selectel) | >= 4.0.2 | + +## Providers + +| Name | Version | +|------|---------| +| [selectel](#provider\_selectel) | >= 4.0.2 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [selectel_craas_registry_v1.registry_1](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/craas_registry_v1) | resource | +| [selectel_craas_token_v1.token_1](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/craas_token_v1) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [craas\_name](#input\_craas\_name) | Имя CRaaS | `string` | `"registry"` | no | +| [os\_project\_id](#input\_os\_project\_id) | ID openstack проекта | `string` | n/a | yes | +| [token\_ttl](#input\_token\_ttl) | Время жизни токена | `string` | n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| [craas\_password](#output\_craas\_password) | craas token | diff --git a/modules/craas/main.tf b/modules/craas/main.tf new file mode 100644 index 0000000..9383a6c --- /dev/null +++ b/modules/craas/main.tf @@ -0,0 +1,9 @@ +resource "selectel_craas_registry_v1" "registry_1" { + name = var.craas_name + project_id = var.os_project_id +} + +resource "selectel_craas_token_v1" "token_1" { + project_id = var.os_project_id + token_ttl = var.token_ttl +} diff --git a/modules/craas/output.tf b/modules/craas/output.tf new file mode 100644 index 0000000..89c85f3 --- /dev/null +++ b/modules/craas/output.tf @@ -0,0 +1,5 @@ +output "craas_password" { + value = selectel_craas_token_v1.token_1.token + sensitive = true + description = "craas token" +} diff --git a/modules/craas/vars.tf b/modules/craas/vars.tf new file mode 100644 index 0000000..de0756c --- /dev/null +++ b/modules/craas/vars.tf @@ -0,0 +1,15 @@ +variable "craas_name" { + description = "Имя CRaaS" + type = string + default = "registry" +} + +variable "os_project_id" { + description = "ID openstack проекта" + type = string +} + +variable "token_ttl" { + description = "Время жизни токена" + type = string +} \ No newline at end of file diff --git a/modules/craas/versions.tf b/modules/craas/versions.tf new file mode 100644 index 0000000..ef07da0 --- /dev/null +++ b/modules/craas/versions.tf @@ -0,0 +1,8 @@ +terraform { + required_providers { + selectel = { + source = "selectel/selectel" + version = ">= 4.0.2" + } + } +} diff --git a/modules/flavor/README.md b/modules/flavor/README.md new file mode 100644 index 0000000..e3e4754 --- /dev/null +++ b/modules/flavor/README.md @@ -0,0 +1,39 @@ +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.5.0 | +| [openstack](#requirement\_openstack) | 1.53.0 | + +## Providers + +| Name | Version | +|------|---------| +| [openstack](#provider\_openstack) | 1.53.0 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [openstack_compute_flavor_v2.flavor](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/compute_flavor_v2) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [flavor\_is\_public](#input\_flavor\_is\_public) | Make flavor public | `bool` | `false` | no | +| [flavor\_local\_disk\_gb](#input\_flavor\_local\_disk\_gb) | Local disk size in GB | `number` | `0` | no | +| [flavor\_name](#input\_flavor\_name) | Flavor name | `string` | `"flavor"` | no | +| [flavor\_ram\_mb](#input\_flavor\_ram\_mb) | RAM in MB in flavor | `number` | `2048` | no | +| [flavor\_vcpus](#input\_flavor\_vcpus) | CPUs in flavor | `number` | `2` | no | +| [os\_region](#input\_os\_region) | Region of openstack | `string` | n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| [flavor\_id](#output\_flavor\_id) | n/a | diff --git a/modules/flavor/main.tf b/modules/flavor/main.tf new file mode 100644 index 0000000..1fb907e --- /dev/null +++ b/modules/flavor/main.tf @@ -0,0 +1,12 @@ +resource "openstack_compute_flavor_v2" "flavor" { + name = var.flavor_name + ram = var.flavor_ram_mb + vcpus = var.flavor_vcpus + disk = var.flavor_local_disk_gb + is_public = var.flavor_is_public + region = var.os_region + + lifecycle { + create_before_destroy = true + } +} diff --git a/modules/flavor/outputs.tf b/modules/flavor/outputs.tf new file mode 100644 index 0000000..5788216 --- /dev/null +++ b/modules/flavor/outputs.tf @@ -0,0 +1,3 @@ +output "flavor_id" { + value = openstack_compute_flavor_v2.flavor.id +} \ No newline at end of file diff --git a/modules/flavor/vars.tf b/modules/flavor/vars.tf new file mode 100644 index 0000000..0831b09 --- /dev/null +++ b/modules/flavor/vars.tf @@ -0,0 +1,34 @@ +variable "flavor_name" { + description = "Flavor name" + type = string + default = "flavor" +} + +variable "flavor_vcpus" { + description = "CPUs in flavor" + type = number + default = 2 +} + +variable "flavor_ram_mb" { + description = "RAM in MB in flavor" + type = number + default = 2048 +} + +variable "flavor_local_disk_gb" { + description = "Local disk size in GB" + type = number + default = 0 +} + +variable "flavor_is_public" { + type = bool + description = "Make flavor public" + default = false +} + +variable "os_region" { + description = "Region of openstack" + type = string +} diff --git a/modules/flavor/versions.tf b/modules/flavor/versions.tf new file mode 100644 index 0000000..6b12975 --- /dev/null +++ b/modules/flavor/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_providers { + openstack = { + source = "terraform-provider-openstack/openstack" + version = "1.53.0" + } + } + required_version = ">= 1.5.0" +} diff --git a/modules/floatingip/README.md b/modules/floatingip/README.md new file mode 100644 index 0000000..9ab2d04 --- /dev/null +++ b/modules/floatingip/README.md @@ -0,0 +1,36 @@ +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.5.0 | +| [openstack](#requirement\_openstack) | 1.53.0 | + +## Providers + +| Name | Version | +|------|---------| +| [openstack](#provider\_openstack) | 1.53.0 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [openstack_networking_floatingip_v2.floatingip_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/networking_floatingip_v2) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [pool](#input\_pool) | Имя пула, из которого можно получить плавающий IP-адрес. Изменение этого параметра создает новый плавающий IP-адрес. | `string` | `"external-network"` | no | +| [region](#input\_region) | n/a | `string` | n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| [floatingip\_address](#output\_floatingip\_address) | floating ip | +| [floatingip\_id](#output\_floatingip\_id) | floating ip id | diff --git a/modules/floatingip/main.tf b/modules/floatingip/main.tf new file mode 100644 index 0000000..35ba4cc --- /dev/null +++ b/modules/floatingip/main.tf @@ -0,0 +1,4 @@ +resource "openstack_networking_floatingip_v2" "floatingip_1" { + pool = var.pool + region = var.region +} diff --git a/modules/floatingip/outputs.tf b/modules/floatingip/outputs.tf new file mode 100644 index 0000000..625fe07 --- /dev/null +++ b/modules/floatingip/outputs.tf @@ -0,0 +1,9 @@ +output "floatingip_id" { + value = openstack_networking_floatingip_v2.floatingip_1.id + description = "floating ip id" +} + +output "floatingip_address" { + value = openstack_networking_floatingip_v2.floatingip_1.address + description = "floating ip" +} diff --git a/modules/floatingip/vars.tf b/modules/floatingip/vars.tf new file mode 100644 index 0000000..158ccc0 --- /dev/null +++ b/modules/floatingip/vars.tf @@ -0,0 +1,9 @@ +variable "pool" { + type = string + description = "Имя пула, из которого можно получить плавающий IP-адрес. Изменение этого параметра создает новый плавающий IP-адрес." + default = "external-network" +} + +variable "region" { + type = string +} diff --git a/modules/floatingip/versions.tf b/modules/floatingip/versions.tf new file mode 100644 index 0000000..6b12975 --- /dev/null +++ b/modules/floatingip/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_providers { + openstack = { + source = "terraform-provider-openstack/openstack" + version = "1.53.0" + } + } + required_version = ">= 1.5.0" +} diff --git a/modules/image_datasource/README.md b/modules/image_datasource/README.md new file mode 100644 index 0000000..a54c7c0 --- /dev/null +++ b/modules/image_datasource/README.md @@ -0,0 +1,36 @@ +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.5.0 | +| [openstack](#requirement\_openstack) | 1.53.0 | + +## Providers + +| Name | Version | +|------|---------| +| [openstack](#provider\_openstack) | 1.53.0 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [openstack_images_image_v2.image_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/data-sources/images_image_v2) | data source | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [image\_name](#input\_image\_name) | Имя образа | `string` | `"Ubuntu 20.04 LTS 64-bit"` | no | +| [most\_recent](#input\_most\_recent) | Если возвращается более одного результата, используйте самое последнее изображение. | `bool` | `true` | no | +| [os\_region](#input\_os\_region) | Region of openstack | `string` | n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| [image\_id](#output\_image\_id) | ID созданного image | diff --git a/modules/image_datasource/main.tf b/modules/image_datasource/main.tf new file mode 100644 index 0000000..634555a --- /dev/null +++ b/modules/image_datasource/main.tf @@ -0,0 +1,5 @@ +data "openstack_images_image_v2" "image_1" { + name = var.image_name + most_recent = var.most_recent + region = var.os_region +} diff --git a/modules/image_datasource/outputs.tf b/modules/image_datasource/outputs.tf new file mode 100644 index 0000000..48f0201 --- /dev/null +++ b/modules/image_datasource/outputs.tf @@ -0,0 +1,4 @@ +output "image_id" { + value = data.openstack_images_image_v2.image_1.id + description = "ID созданного image" +} diff --git a/modules/image_datasource/vars.tf b/modules/image_datasource/vars.tf new file mode 100644 index 0000000..2a21747 --- /dev/null +++ b/modules/image_datasource/vars.tf @@ -0,0 +1,16 @@ +variable "image_name" { + type = string + default = "Ubuntu 20.04 LTS 64-bit" + description = "Имя образа" +} + +variable "most_recent" { + type = bool + default = true + description = "Если возвращается более одного результата, используйте самое последнее изображение." +} + +variable "os_region" { + type = string + description = "Region of openstack" +} diff --git a/modules/image_datasource/versions.tf b/modules/image_datasource/versions.tf new file mode 100644 index 0000000..6b12975 --- /dev/null +++ b/modules/image_datasource/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_providers { + openstack = { + source = "terraform-provider-openstack/openstack" + version = "1.53.0" + } + } + required_version = ">= 1.5.0" +} diff --git a/modules/keypair/README.md b/modules/keypair/README.md new file mode 100644 index 0000000..a13bc08 --- /dev/null +++ b/modules/keypair/README.md @@ -0,0 +1,37 @@ +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.5.0 | +| [openstack](#requirement\_openstack) | 1.53.0 | + +## Providers + +| Name | Version | +|------|---------| +| [openstack](#provider\_openstack) | 1.53.0 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [openstack_compute_keypair_v2.keypair_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/compute_keypair_v2) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [keypair\_name](#input\_keypair\_name) | n/a | `string` | `"keypair_1"` | no | +| [keypair\_public\_key](#input\_keypair\_public\_key) | n/a | `string` | n/a | yes | +| [os\_region](#input\_os\_region) | Region of openstack | `string` | n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| [keypair\_id](#output\_keypair\_id) | ID созданной KeyPair | +| [keypair\_name](#output\_keypair\_name) | Имя созданной KeyPair | diff --git a/modules/keypair/main.tf b/modules/keypair/main.tf new file mode 100644 index 0000000..d44641e --- /dev/null +++ b/modules/keypair/main.tf @@ -0,0 +1,5 @@ +resource "openstack_compute_keypair_v2" "keypair_1" { + name = var.keypair_name + public_key = var.keypair_public_key + region = var.os_region +} diff --git a/modules/keypair/output.tf b/modules/keypair/output.tf new file mode 100644 index 0000000..82959e3 --- /dev/null +++ b/modules/keypair/output.tf @@ -0,0 +1,9 @@ +output "keypair_id" { + value = openstack_compute_keypair_v2.keypair_1.id + description = "ID созданной KeyPair" +} + +output "keypair_name" { + value = openstack_compute_keypair_v2.keypair_1.name + description = "Имя созданной KeyPair" +} diff --git a/modules/keypair/vars.tf b/modules/keypair/vars.tf new file mode 100644 index 0000000..2d5fdbd --- /dev/null +++ b/modules/keypair/vars.tf @@ -0,0 +1,13 @@ +variable "keypair_name" { + default = "keypair_1" + type = string +} + +variable "keypair_public_key" { + type = string +} + +variable "os_region" { + type = string + description = "Region of openstack" +} diff --git a/modules/keypair/versions.tf b/modules/keypair/versions.tf new file mode 100644 index 0000000..6b12975 --- /dev/null +++ b/modules/keypair/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_providers { + openstack = { + source = "terraform-provider-openstack/openstack" + version = "1.53.0" + } + } + required_version = ">= 1.5.0" +} diff --git a/modules/mks/k8s-cluster-standalone/README.md b/modules/mks/k8s-cluster-standalone/README.md new file mode 100644 index 0000000..93162ab --- /dev/null +++ b/modules/mks/k8s-cluster-standalone/README.md @@ -0,0 +1,70 @@ +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.5.0 | +| [openstack](#requirement\_openstack) | 1.53.0 | +| [selectel](#requirement\_selectel) | >= 4.0.2 | + +## Providers + +| Name | Version | +|------|---------| +| [selectel](#provider\_selectel) | >= 4.0.2 | + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [kubernetes\_cluster](#module\_kubernetes\_cluster) | ../k8s-cluster | n/a | +| [kubernetes\_nodegroup](#module\_kubernetes\_nodegroup) | ../k8s-nodegroup | n/a | +| [kubernetes\_nodegroup\_gpu](#module\_kubernetes\_nodegroup\_gpu) | ../k8s-nodegroup-gpu | n/a | +| [nat](#module\_nat) | ../../nat | n/a | + +## Resources + +| Name | Type | +|------|------| +| [selectel_mks_kubeconfig_v1.kubeconfig](https://registry.terraform.io/providers/selectel/selectel/latest/docs/data-sources/mks_kubeconfig_v1) | data source | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [cluster\_name](#input\_cluster\_name) | n/a | `string` | n/a | yes | +| [enable\_autorepair](#input\_enable\_autorepair) | n/a | `bool` | `false` | no | +| [enable\_patch\_version\_auto\_upgrade](#input\_enable\_patch\_version\_auto\_upgrade) | n/a | `bool` | `false` | no | +| [gpu\_ng\_flavor](#input\_gpu\_ng\_flavor) | n/a | `list(string)` |
[
"2"
]
| no | +| [gpu\_ng\_labels](#input\_gpu\_ng\_labels) | n/a | `list(map(any))` |
[
{
"role": "gpu"
}
]
| no | +| [gpu\_ng\_nodes\_count](#input\_gpu\_ng\_nodes\_count) | n/a | `list(number)` |
[
2
]
| no | +| [gpu\_ng\_taints](#input\_gpu\_ng\_taints) | n/a |
list(object({
key = string
value = string
effect = string
}))
| `[]` | no | +| [gpu\_ng\_volume\_gb](#input\_gpu\_ng\_volume\_gb) | n/a | `list(number)` |
[
32
]
| no | +| [gpu\_ng\_volume\_type](#input\_gpu\_ng\_volume\_type) | n/a | `list(string)` |
[
"fast"
]
| no | +| [gpu\_nodegroups](#input\_gpu\_nodegroups) | n/a | `number` | `0` | no | +| [kube\_version](#input\_kube\_version) | n/a | `string` | n/a | yes | +| [maintenance\_window\_end](#input\_maintenance\_window\_end) | n/a | `string` | `"04:00:00"` | no | +| [maintenance\_window\_start](#input\_maintenance\_window\_start) | n/a | `string` | `"03:00:00"` | no | +| [nat\_subnet\_cidr](#input\_nat\_subnet\_cidr) | n/a | `string` | `"10.222.0.0/16"` | no | +| [network\_id](#input\_network\_id) | n/a | `string` | `""` | no | +| [ng\_affinity\_policy](#input\_ng\_affinity\_policy) | n/a | `string` | `""` | no | +| [ng\_cpus](#input\_ng\_cpus) | n/a | `list(number)` |
[
2
]
| no | +| [ng\_keypair\_name](#input\_ng\_keypair\_name) | n/a | `string` | `""` | no | +| [ng\_labels](#input\_ng\_labels) | n/a | `list(map(any))` |
[
{
"role": "system"
}
]
| no | +| [ng\_nodes\_count](#input\_ng\_nodes\_count) | n/a | `list(number)` |
[
2
]
| no | +| [ng\_ram\_mb](#input\_ng\_ram\_mb) | n/a | `list(number)` |
[
4096
]
| no | +| [ng\_taints](#input\_ng\_taints) | n/a |
list(object({
key = string
value = string
effect = string
}))
| `[]` | no | +| [ng\_volume\_gb](#input\_ng\_volume\_gb) | n/a | `list(number)` |
[
32
]
| no | +| [ng\_volume\_type](#input\_ng\_volume\_type) | n/a | `list(string)` |
[
"fast"
]
| no | +| [nodegroups](#input\_nodegroups) | n/a | `string` | `1` | no | +| [os\_auth\_url](#input\_os\_auth\_url) | n/a | `string` | `"https://api.selvpc.ru/identity/v3/auth/"` | no | +| [os\_availability\_zone](#input\_os\_availability\_zone) | n/a | `string` | n/a | yes | +| [os\_project\_id](#input\_os\_project\_id) | ID проекта | `string` | n/a | yes | +| [os\_region](#input\_os\_region) | Region of openstack | `string` | n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| [kube\_config](#output\_kube\_config) | n/a | +| [nat\_network\_id](#output\_nat\_network\_id) | n/a | +| [nat\_subnet\_id](#output\_nat\_subnet\_id) | n/a | diff --git a/modules/mks/k8s-cluster-standalone/main.tf b/modules/mks/k8s-cluster-standalone/main.tf new file mode 100644 index 0000000..3a95076 --- /dev/null +++ b/modules/mks/k8s-cluster-standalone/main.tf @@ -0,0 +1,73 @@ +module "nat" { + source = "../../nat" + subnet_cidr = var.nat_subnet_cidr + router_name = "${var.cluster_name}-router" +} + +module "kubernetes_cluster" { + source = "../k8s-cluster" + + cluster_name = var.cluster_name + os_project_id = var.os_project_id + os_region = var.os_region + kube_version = var.kube_version + enable_autorepair = var.enable_autorepair + enable_patch_version_auto_upgrade = var.enable_patch_version_auto_upgrade + os_network_id = module.nat.network_id + os_subnet_id = module.nat.subnet_id + maintenance_window_start = var.maintenance_window_start +} + +# Create nodegroup +module "kubernetes_nodegroup" { + source = "../k8s-nodegroup" + + count = var.nodegroups + + cluster_id = module.kubernetes_cluster.cluster_id + os_project_id = var.os_project_id + os_region = var.os_region + availability_zone = var.os_availability_zone + nodes_count = var.ng_nodes_count[count.index] + keypair_name = var.ng_keypair_name + affinity_policy = var.ng_affinity_policy + cpus = var.ng_cpus[count.index] + ram_mb = var.ng_ram_mb[count.index] + volume_gb = var.ng_volume_gb[count.index] + labels = var.ng_labels[count.index] + taints = var.ng_taints + volume_type = "${var.ng_volume_type[count.index]}.${var.os_availability_zone}" + + depends_on = [ + module.kubernetes_cluster + ] +} + +module "kubernetes_nodegroup_gpu" { + source = "../k8s-nodegroup-gpu" + + count = var.gpu_nodegroups + + cluster_id = module.kubernetes_cluster.cluster_id + os_project_id = var.os_project_id + os_region = var.os_region + availability_zone = var.os_availability_zone + nodes_count = var.gpu_ng_nodes_count[count.index] + keypair_name = var.ng_keypair_name + affinity_policy = var.ng_affinity_policy + volume_gb = var.gpu_ng_volume_gb[count.index] + labels = var.gpu_ng_labels[count.index] + taints = var.gpu_ng_taints + flavor_id = var.gpu_ng_flavor[count.index] + volume_type = "${var.gpu_ng_volume_type[count.index]}.${var.os_availability_zone}" + + depends_on = [ + module.kubernetes_cluster + ] +} + +data "selectel_mks_kubeconfig_v1" "kubeconfig" { + cluster_id = module.kubernetes_cluster.cluster_id + project_id = var.os_project_id + region = var.os_region +} diff --git a/modules/mks/k8s-cluster-standalone/output.tf b/modules/mks/k8s-cluster-standalone/output.tf new file mode 100644 index 0000000..0660aaa --- /dev/null +++ b/modules/mks/k8s-cluster-standalone/output.tf @@ -0,0 +1,12 @@ +output "kube_config" { + value = data.selectel_mks_kubeconfig_v1.kubeconfig + sensitive = true +} + +output "nat_network_id" { + value = module.nat.network_id +} + +output "nat_subnet_id" { + value = module.nat.subnet_id +} diff --git a/modules/mks/k8s-cluster-standalone/vars.tf b/modules/mks/k8s-cluster-standalone/vars.tf new file mode 100644 index 0000000..910f0eb --- /dev/null +++ b/modules/mks/k8s-cluster-standalone/vars.tf @@ -0,0 +1,162 @@ +variable "os_auth_url" { + type = string + default = "https://api.selvpc.ru/identity/v3/auth/" +} + +variable "os_project_id" { + type = string + description = "ID проекта" +} + +# NAT vars + +variable "os_region" { + type = string + description = "Region of openstack" +} + +variable "nat_subnet_cidr" { + type = string + default = "10.222.0.0/16" +} + + +# MSK cluster vars + +variable "cluster_name" { + type = string +} + +variable "enable_autorepair" { + type = bool + default = false +} + +variable "enable_patch_version_auto_upgrade" { + type = bool + default = false +} + +variable "network_id" { + type = string + default = "" +} + +variable "kube_version" { + type = string +} + +variable "maintenance_window_start" { + type = string + default = "03:00:00" +} + +variable "maintenance_window_end" { + type = string + default = "04:00:00" +} + +# MKS NodeGroup vars + +variable "os_availability_zone" { + type = string +} + +variable "nodegroups" { + type = string + default = 1 +} + + +variable "ng_nodes_count" { + type = list(number) + default = [2] +} + +variable "ng_cpus" { + type = list(number) + default = [2] +} + +variable "ng_ram_mb" { + type = list(number) + default = [4096] +} + +variable "ng_volume_gb" { + type = list(number) + default = [32] +} + +variable "ng_volume_type" { + type = list(string) + default = ["fast"] +} + +variable "ng_labels" { + type = list(map(any)) + default = [{ "role" : "system" }] +} + +variable "ng_taints" { + type = list(object({ + key = string + value = string + effect = string + })) + default = [] +} + +variable "ng_keypair_name" { + type = string + default = "" +} + +variable "ng_affinity_policy" { + type = string + default = "" +} + + +# Еще раз, для групп с gpu + +variable "gpu_nodegroups" { + type = number + default = 0 +} + + +variable "gpu_ng_flavor" { + type = list(string) + default = ["2"] +} + +variable "gpu_ng_nodes_count" { + type = list(number) + default = [2] +} + + +variable "gpu_ng_volume_gb" { + type = list(number) + default = [32] +} + +variable "gpu_ng_volume_type" { + type = list(string) + default = ["fast"] +} + +variable "gpu_ng_labels" { + type = list(map(any)) + default = [{ "role" : "gpu" }] +} + +variable "gpu_ng_taints" { + type = list(object({ + key = string + value = string + effect = string + })) + default = [] +} diff --git a/modules/mks/k8s-cluster-standalone/versions.tf b/modules/mks/k8s-cluster-standalone/versions.tf new file mode 100644 index 0000000..a0ffbd8 --- /dev/null +++ b/modules/mks/k8s-cluster-standalone/versions.tf @@ -0,0 +1,13 @@ +terraform { + required_providers { + selectel = { + source = "selectel/selectel" + version = ">= 4.0.2" + } + openstack = { + source = "terraform-provider-openstack/openstack" + version = "1.53.0" + } + } + required_version = ">= 1.5.0" +} diff --git a/modules/mks/k8s-cluster/README.md b/modules/mks/k8s-cluster/README.md new file mode 100644 index 0000000..f70b849 --- /dev/null +++ b/modules/mks/k8s-cluster/README.md @@ -0,0 +1,42 @@ +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.5.0 | +| [selectel](#requirement\_selectel) | >= 4.0.2 | + +## Providers + +| Name | Version | +|------|---------| +| [selectel](#provider\_selectel) | >= 4.0.2 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [selectel_mks_cluster_v1.cluster_1](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/mks_cluster_v1) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [cluster\_name](#input\_cluster\_name) | Имя кластера | `string` | n/a | yes | +| [enable\_autorepair](#input\_enable\_autorepair) | Включает или отключает автоматическое восстановление узлов (worker nodes автоматически перезапускаются). Автоматическое восстановление недоступно, если у вас есть один worker node. После автовосстановления все данные на загрузочных томах удаляются. | `bool` | `true` | no | +| [enable\_patch\_version\_auto\_upgrade](#input\_enable\_patch\_version\_auto\_upgrade) | Включает или отключает автоматическое обновление кластера до последней доступной версии исправления Kubernetes во время периода обслуживания. | `bool` | `true` | no | +| [kube\_version](#input\_kube\_version) | Версия кластера kubernetes | `string` | n/a | yes | +| [maintenance\_window\_start](#input\_maintenance\_window\_start) | Время в формате UTC, когда начинается обслуживание кластера. Формат: hh:mm:ss. | `string` | `""` | no | +| [os\_network\_id](#input\_os\_network\_id) | ID сети openstack | `string` | n/a | yes | +| [os\_project\_id](#input\_os\_project\_id) | ID проекта | `string` | n/a | yes | +| [os\_region](#input\_os\_region) | Region of openstack | `string` | n/a | yes | +| [os\_subnet\_id](#input\_os\_subnet\_id) | ID подсети openstack | `string` | n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| [cluster\_id](#output\_cluster\_id) | ID созданного кластера | diff --git a/modules/mks/k8s-cluster/main.tf b/modules/mks/k8s-cluster/main.tf new file mode 100644 index 0000000..e2936ab --- /dev/null +++ b/modules/mks/k8s-cluster/main.tf @@ -0,0 +1,11 @@ +resource "selectel_mks_cluster_v1" "cluster_1" { + name = var.cluster_name + project_id = var.os_project_id + region = var.os_region + kube_version = var.kube_version + enable_autorepair = var.enable_autorepair + enable_patch_version_auto_upgrade = var.enable_patch_version_auto_upgrade + network_id = var.os_network_id + subnet_id = var.os_subnet_id + maintenance_window_start = var.maintenance_window_start +} diff --git a/modules/mks/k8s-cluster/outputs.tf b/modules/mks/k8s-cluster/outputs.tf new file mode 100644 index 0000000..c99d341 --- /dev/null +++ b/modules/mks/k8s-cluster/outputs.tf @@ -0,0 +1,4 @@ +output "cluster_id" { + description = "ID созданного кластера" + value = selectel_mks_cluster_v1.cluster_1.id +} diff --git a/modules/mks/k8s-cluster/vars.tf b/modules/mks/k8s-cluster/vars.tf new file mode 100644 index 0000000..0632c41 --- /dev/null +++ b/modules/mks/k8s-cluster/vars.tf @@ -0,0 +1,47 @@ +variable "cluster_name" { + type = string + description = "Имя кластера" +} + +variable "os_project_id" { + type = string + description = "ID проекта" +} + +variable "os_region" { + type = string + description = "Region of openstack" +} + +variable "kube_version" { + type = string + description = "Версия кластера kubernetes" +} + +variable "enable_autorepair" { + type = bool + description = "Включает или отключает автоматическое восстановление узлов (worker nodes автоматически перезапускаются). Автоматическое восстановление недоступно, если у вас есть один worker node. После автовосстановления все данные на загрузочных томах удаляются." + default = true +} + +variable "enable_patch_version_auto_upgrade" { + type = bool + description = "Включает или отключает автоматическое обновление кластера до последней доступной версии исправления Kubernetes во время периода обслуживания." + default = true +} + +variable "os_network_id" { + type = string + description = "ID сети openstack" +} + +variable "os_subnet_id" { + type = string + description = "ID подсети openstack" +} + +variable "maintenance_window_start" { + type = string + description = "Время в формате UTC, когда начинается обслуживание кластера. Формат: hh:mm:ss." + default = "" +} diff --git a/modules/mks/k8s-cluster/versions.tf b/modules/mks/k8s-cluster/versions.tf new file mode 100644 index 0000000..2a57f62 --- /dev/null +++ b/modules/mks/k8s-cluster/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_providers { + selectel = { + source = "selectel/selectel" + version = ">= 4.0.2" + } + } + required_version = ">= 1.5.0" +} diff --git a/modules/mks/k8s-nodegroup-gpu/README.md b/modules/mks/k8s-nodegroup-gpu/README.md new file mode 100644 index 0000000..1b9b983 --- /dev/null +++ b/modules/mks/k8s-nodegroup-gpu/README.md @@ -0,0 +1,47 @@ +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.5.0 | +| [selectel](#requirement\_selectel) | >= 4.0.2 | + +## Providers + +| Name | Version | +|------|---------| +| [selectel](#provider\_selectel) | >= 4.0.2 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [selectel_mks_nodegroup_v1.nodegroup_1](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/mks_nodegroup_v1) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [affinity\_policy](#input\_affinity\_policy) | n/a | `string` | `""` | no | +| [availability\_zone](#input\_availability\_zone) | n/a | `any` | n/a | yes | +| [cluster\_id](#input\_cluster\_id) | ID кластера | `string` | n/a | yes | +| [cpus](#input\_cpus) | n/a | `number` | `1` | no | +| [flavor\_id](#input\_flavor\_id) | n/a | `any` | n/a | yes | +| [keypair\_name](#input\_keypair\_name) | n/a | `string` | `""` | no | +| [labels](#input\_labels) | n/a | `any` | n/a | yes | +| [nodes\_count](#input\_nodes\_count) | n/a | `number` | `1` | no | +| [os\_project\_id](#input\_os\_project\_id) | ID проекта | `string` | n/a | yes | +| [os\_region](#input\_os\_region) | Регион my.selectel | `any` | n/a | yes | +| [ram\_mb](#input\_ram\_mb) | n/a | `number` | `1024` | no | +| [taints](#input\_taints) | n/a | `any` | n/a | yes | +| [volume\_gb](#input\_volume\_gb) | n/a | `number` | `10` | no | +| [volume\_type](#input\_volume\_type) | n/a | `any` | n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| [nodegroup\_id](#output\_nodegroup\_id) | ID созданной группы нод | diff --git a/modules/mks/k8s-nodegroup-gpu/main.tf b/modules/mks/k8s-nodegroup-gpu/main.tf new file mode 100644 index 0000000..0e1f979 --- /dev/null +++ b/modules/mks/k8s-nodegroup-gpu/main.tf @@ -0,0 +1,21 @@ +resource "selectel_mks_nodegroup_v1" "nodegroup_1" { + cluster_id = var.cluster_id + project_id = var.os_project_id + region = var.os_region + availability_zone = var.availability_zone + nodes_count = var.nodes_count + keypair_name = var.keypair_name + affinity_policy = var.affinity_policy + volume_gb = var.volume_gb + volume_type = var.volume_type + labels = var.labels + flavor_id = var.flavor_id + dynamic "taints" { + for_each = var.taints[*] + content { + key = taints.value["key"] + value = taints.value["value"] + effect = taints.value["effect"] + } + } +} diff --git a/modules/mks/k8s-nodegroup-gpu/output.tf b/modules/mks/k8s-nodegroup-gpu/output.tf new file mode 100644 index 0000000..b6d6fb8 --- /dev/null +++ b/modules/mks/k8s-nodegroup-gpu/output.tf @@ -0,0 +1,4 @@ +output "nodegroup_id" { + value = selectel_mks_nodegroup_v1.nodegroup_1.id + description = "ID созданной группы нод" +} diff --git a/modules/mks/k8s-nodegroup-gpu/vars.tf b/modules/mks/k8s-nodegroup-gpu/vars.tf new file mode 100644 index 0000000..4696db6 --- /dev/null +++ b/modules/mks/k8s-nodegroup-gpu/vars.tf @@ -0,0 +1,49 @@ +variable "cluster_id" { + type = string + description = "ID кластера" +} + +variable "os_project_id" { + type = string + description = "ID проекта" +} + +variable "os_region" { + description = "Регион my.selectel" +} + + +variable "availability_zone" {} + +variable "nodes_count" { + default = 1 +} + +variable "keypair_name" { + default = "" +} + +variable "affinity_policy" { + default = "" +} + +variable "cpus" { + default = 1 +} + +variable "ram_mb" { + default = 1024 +} + +variable "volume_gb" { + default = 10 +} + +variable "volume_type" {} + +variable "labels" {} + +variable "taints" {} + +variable "flavor_id" {} + diff --git a/modules/mks/k8s-nodegroup-gpu/versions.tf b/modules/mks/k8s-nodegroup-gpu/versions.tf new file mode 100644 index 0000000..2a57f62 --- /dev/null +++ b/modules/mks/k8s-nodegroup-gpu/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_providers { + selectel = { + source = "selectel/selectel" + version = ">= 4.0.2" + } + } + required_version = ">= 1.5.0" +} diff --git a/modules/mks/k8s-nodegroup/README.md b/modules/mks/k8s-nodegroup/README.md new file mode 100644 index 0000000..c9f39a0 --- /dev/null +++ b/modules/mks/k8s-nodegroup/README.md @@ -0,0 +1,47 @@ +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.5.0 | +| [selectel](#requirement\_selectel) | >= 4.0.2 | + +## Providers + +| Name | Version | +|------|---------| +| [selectel](#provider\_selectel) | >= 4.0.2 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [selectel_mks_nodegroup_v1.nodegroup_1](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/mks_nodegroup_v1) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [affinity\_policy](#input\_affinity\_policy) | n/a | `string` | `""` | no | +| [availability\_zone](#input\_availability\_zone) | n/a | `any` | n/a | yes | +| [cluster\_id](#input\_cluster\_id) | ID кластера | `string` | n/a | yes | +| [cpus](#input\_cpus) | n/a | `string` | `""` | no | +| [flavor\_id](#input\_flavor\_id) | n/a | `string` | `""` | no | +| [keypair\_name](#input\_keypair\_name) | n/a | `string` | `""` | no | +| [labels](#input\_labels) | n/a | `any` | n/a | yes | +| [nodes\_count](#input\_nodes\_count) | n/a | `number` | `1` | no | +| [os\_project\_id](#input\_os\_project\_id) | ID проекта | `string` | n/a | yes | +| [os\_region](#input\_os\_region) | Region of openstack | `string` | n/a | yes | +| [ram\_mb](#input\_ram\_mb) | n/a | `string` | `""` | no | +| [taints](#input\_taints) | n/a | `any` | n/a | yes | +| [volume\_gb](#input\_volume\_gb) | n/a | `number` | `10` | no | +| [volume\_type](#input\_volume\_type) | n/a | `any` | n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| [nodegroup\_id](#output\_nodegroup\_id) | n/a | diff --git a/modules/mks/k8s-nodegroup/main.tf b/modules/mks/k8s-nodegroup/main.tf new file mode 100644 index 0000000..a5a2fe1 --- /dev/null +++ b/modules/mks/k8s-nodegroup/main.tf @@ -0,0 +1,25 @@ +resource "selectel_mks_nodegroup_v1" "nodegroup_1" { + cluster_id = var.cluster_id + project_id = var.os_project_id + region = var.os_region + availability_zone = var.availability_zone + nodes_count = var.nodes_count + keypair_name = var.keypair_name + affinity_policy = var.affinity_policy + volume_gb = var.volume_gb + volume_type = var.volume_type + labels = var.labels + + cpus = var.cpus != "" && var.flavor_id == "" ? var.cpus : null + ram_mb = var.ram_mb != "" && var.flavor_id == "" ? var.ram_mb : null + flavor_id = var.flavor_id != "" && var.ram_mb == "" && var.cpus == "" ? var.flavor_id : null + + dynamic "taints" { + for_each = var.taints[*] + content { + key = taints.value["key"] + value = taints.value["value"] + effect = taints.value["effect"] + } + } +} diff --git a/modules/mks/k8s-nodegroup/outputs.tf b/modules/mks/k8s-nodegroup/outputs.tf new file mode 100644 index 0000000..0135e05 --- /dev/null +++ b/modules/mks/k8s-nodegroup/outputs.tf @@ -0,0 +1,3 @@ +output "nodegroup_id" { + value = selectel_mks_nodegroup_v1.nodegroup_1.id +} diff --git a/modules/mks/k8s-nodegroup/vars.tf b/modules/mks/k8s-nodegroup/vars.tf new file mode 100644 index 0000000..00222e2 --- /dev/null +++ b/modules/mks/k8s-nodegroup/vars.tf @@ -0,0 +1,50 @@ +variable "cluster_id" { + type = string + description = "ID кластера" +} + +variable "os_project_id" { + type = string + description = "ID проекта" +} + +variable "os_region" { + type = string + description = "Region of openstack" +} + +variable "availability_zone" {} + +variable "nodes_count" { + default = 1 +} + +variable "keypair_name" { + default = "" +} + +variable "affinity_policy" { + default = "" +} + +variable "cpus" { + default = "" +} + +variable "ram_mb" { + default = "" +} + +variable "volume_gb" { + default = 10 +} + +variable "volume_type" {} + +variable "labels" {} + +variable "taints" {} + +variable "flavor_id" { + default = "" +} \ No newline at end of file diff --git a/modules/mks/k8s-nodegroup/versions.tf b/modules/mks/k8s-nodegroup/versions.tf new file mode 100644 index 0000000..2a57f62 --- /dev/null +++ b/modules/mks/k8s-nodegroup/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_providers { + selectel = { + source = "selectel/selectel" + version = ">= 4.0.2" + } + } + required_version = ">= 1.5.0" +} diff --git a/modules/nat/README.md b/modules/nat/README.md new file mode 100644 index 0000000..aae0ae3 --- /dev/null +++ b/modules/nat/README.md @@ -0,0 +1,46 @@ +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.5.0 | +| [openstack](#requirement\_openstack) | 1.53.0 | + +## Providers + +| Name | Version | +|------|---------| +| [openstack](#provider\_openstack) | 1.53.0 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [openstack_networking_network_v2.network_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/networking_network_v2) | resource | +| [openstack_networking_router_interface_v2.router_interface_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/networking_router_interface_v2) | resource | +| [openstack_networking_router_v2.router_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/networking_router_v2) | resource | +| [openstack_networking_subnet_v2.subnet_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/networking_subnet_v2) | resource | +| [openstack_networking_network_v2.external_net](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/data-sources/networking_network_v2) | data source | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [dns\_nameservers](#input\_dns\_nameservers) | DNS servers to be used | `list(string)` |
[
"188.93.16.19",
"188.93.17.19"
]
| no | +| [enable\_dhcp](#input\_enable\_dhcp) | DHCP enable flag | `bool` | `false` | no | +| [network\_name](#input\_network\_name) | Network name to be created | `string` | `"network_1"` | no | +| [router\_external\_net\_name](#input\_router\_external\_net\_name) | Name of external network to be used | `string` | `"external-network"` | no | +| [router\_name](#input\_router\_name) | Router name to be created | `string` | `"router_1"` | no | +| [subnet\_cidr](#input\_subnet\_cidr) | Subnet CIRD to be created | `string` | `"192.168.0.0/24"` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [external\_network\_id](#output\_external\_network\_id) | ID внешней подсети | +| [network\_id](#output\_network\_id) | ID созданной сети | +| [router\_id](#output\_router\_id) | ID созданного роутера | +| [subnet\_id](#output\_subnet\_id) | ID созданной подсети | diff --git a/modules/nat/main.tf b/modules/nat/main.tf new file mode 100644 index 0000000..23f5035 --- /dev/null +++ b/modules/nat/main.tf @@ -0,0 +1,26 @@ +data "openstack_networking_network_v2" "external_net" { + name = var.router_external_net_name + external = true +} + +resource "openstack_networking_router_v2" "router_1" { + external_network_id = data.openstack_networking_network_v2.external_net.id + name = var.router_name +} + +resource "openstack_networking_network_v2" "network_1" { + name = var.network_name +} + +resource "openstack_networking_subnet_v2" "subnet_1" { + network_id = openstack_networking_network_v2.network_1.id + dns_nameservers = var.dns_nameservers + cidr = var.subnet_cidr + name = var.subnet_cidr + enable_dhcp = var.enable_dhcp +} + +resource "openstack_networking_router_interface_v2" "router_interface_1" { + router_id = openstack_networking_router_v2.router_1.id + subnet_id = openstack_networking_subnet_v2.subnet_1.id +} diff --git a/modules/nat/outputs.tf b/modules/nat/outputs.tf new file mode 100644 index 0000000..c8c3a6c --- /dev/null +++ b/modules/nat/outputs.tf @@ -0,0 +1,19 @@ +output "router_id" { + value = openstack_networking_router_v2.router_1.id + description = "ID созданного роутера" +} + +output "network_id" { + value = openstack_networking_network_v2.network_1.id + description = "ID созданной сети" +} + +output "subnet_id" { + value = openstack_networking_subnet_v2.subnet_1.id + description = "ID созданной подсети" +} + +output "external_network_id" { + value = openstack_networking_router_v2.router_1.external_network_id + description = "ID внешней подсети" +} diff --git a/modules/nat/vars.tf b/modules/nat/vars.tf new file mode 100644 index 0000000..0f848de --- /dev/null +++ b/modules/nat/vars.tf @@ -0,0 +1,38 @@ +variable "router_external_net_name" { + type = string + default = "external-network" + description = "Name of external network to be used" +} + +variable "dns_nameservers" { + description = "DNS servers to be used" + type = list(string) + default = [ + "188.93.16.19", + "188.93.17.19", + ] +} + +variable "subnet_cidr" { + description = "Subnet CIRD to be created" + type = string + default = "192.168.0.0/24" +} + +variable "router_name" { + description = "Router name to be created" + type = string + default = "router_1" +} + +variable "network_name" { + description = "Network name to be created" + type = string + default = "network_1" +} + +variable "enable_dhcp" { + description = "DHCP enable flag" + type = bool + default = false +} diff --git a/modules/nat/versions.tf b/modules/nat/versions.tf new file mode 100644 index 0000000..6b12975 --- /dev/null +++ b/modules/nat/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_providers { + openstack = { + source = "terraform-provider-openstack/openstack" + version = "1.53.0" + } + } + required_version = ">= 1.5.0" +} diff --git a/modules/os_project/README.md b/modules/os_project/README.md new file mode 100644 index 0000000..1ca7a88 --- /dev/null +++ b/modules/os_project/README.md @@ -0,0 +1,35 @@ +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.5.0 | +| [selectel](#requirement\_selectel) | >= 4.0.1 | + +## Providers + +| Name | Version | +|------|---------| +| [selectel](#provider\_selectel) | >= 4.0.1 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [selectel_vpc_project_v2.project_1](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/vpc_project_v2) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [os\_project\_name](#input\_os\_project\_name) | Name of OpenStack project to create | `string` | n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| [project\_id](#output\_project\_id) | ID of created project | +| [project\_name](#output\_project\_name) | Name of created project | diff --git a/modules/os_project/main.tf b/modules/os_project/main.tf new file mode 100644 index 0000000..68ea3a0 --- /dev/null +++ b/modules/os_project/main.tf @@ -0,0 +1,3 @@ +resource "selectel_vpc_project_v2" "project_1" { + name = var.os_project_name +} diff --git a/modules/os_project/outputs.tf b/modules/os_project/outputs.tf new file mode 100644 index 0000000..acd93b4 --- /dev/null +++ b/modules/os_project/outputs.tf @@ -0,0 +1,9 @@ +output "project_id" { + description = "ID of created project" + value = selectel_vpc_project_v2.project_1.id +} + +output "project_name" { + description = "Name of created project" + value = selectel_vpc_project_v2.project_1.name +} diff --git a/modules/os_project/vars.tf b/modules/os_project/vars.tf new file mode 100644 index 0000000..bfefd3e --- /dev/null +++ b/modules/os_project/vars.tf @@ -0,0 +1,4 @@ +variable "os_project_name" { + description = "Name of OpenStack project to create" + type = string +} diff --git a/modules/os_project/versions.tf b/modules/os_project/versions.tf new file mode 100644 index 0000000..82f25ed --- /dev/null +++ b/modules/os_project/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_providers { + selectel = { + source = "selectel/selectel" + version = ">= 4.0.1" + } + } + required_version = ">= 1.5.0" +} diff --git a/modules/os_project_with_user/README.md b/modules/os_project_with_user/README.md new file mode 100644 index 0000000..3686bfb --- /dev/null +++ b/modules/os_project_with_user/README.md @@ -0,0 +1,45 @@ +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.5.0 | +| [random](#requirement\_random) | >= 3.3.2 | +| [selectel](#requirement\_selectel) | >= 4.0.1 | + +## Providers + +| Name | Version | +|------|---------| +| [random](#provider\_random) | >= 3.3.2 | +| [selectel](#provider\_selectel) | >= 4.0.1 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [random_password.user_1_password](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password) | resource | +| [selectel_vpc_project_v2.project_1](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/vpc_project_v2) | resource | +| [selectel_vpc_role_v2.role_1](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/vpc_role_v2) | resource | +| [selectel_vpc_user_v2.user_1](https://registry.terraform.io/providers/selectel/selectel/latest/docs/resources/vpc_user_v2) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [os\_project\_name](#input\_os\_project\_name) | Name of OpenStack project to create | `string` | n/a | yes | +| [os\_username](#input\_os\_username) | Username of user create in OpenStack project | `string` | n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| [project\_id](#output\_project\_id) | ID of created project | +| [project\_name](#output\_project\_name) | Name of created project | +| [role\_id](#output\_role\_id) | ID of created user role | +| [user\_id](#output\_user\_id) | ID of user, that admins the project | +| [user\_name](#output\_user\_name) | Username of created user | +| [user\_password](#output\_user\_password) | Password of created user. Generated automatically. | diff --git a/modules/os_project_with_user/main.tf b/modules/os_project_with_user/main.tf new file mode 100644 index 0000000..3b704d2 --- /dev/null +++ b/modules/os_project_with_user/main.tf @@ -0,0 +1,23 @@ +resource "selectel_vpc_project_v2" "project_1" { + name = var.os_project_name +} + +resource "random_password" "user_1_password" { + length = 32 + special = true + override_special = "!#$%&*()-_=+[]{}<>:?" + min_special = 3 + min_numeric = 1 + min_lower = 1 + min_upper = 1 +} + +resource "selectel_vpc_user_v2" "user_1" { + name = var.os_username + password = random_password.user_1_password.result +} + +resource "selectel_vpc_role_v2" "role_1" { + project_id = selectel_vpc_project_v2.project_1.id + user_id = selectel_vpc_user_v2.user_1.id +} diff --git a/modules/os_project_with_user/outputs.tf b/modules/os_project_with_user/outputs.tf new file mode 100644 index 0000000..2b92387 --- /dev/null +++ b/modules/os_project_with_user/outputs.tf @@ -0,0 +1,30 @@ +output "project_id" { + description = "ID of created project" + value = selectel_vpc_project_v2.project_1.id +} + +output "project_name" { + description = "Name of created project" + value = selectel_vpc_project_v2.project_1.name +} + +output "user_id" { + description = "ID of user, that admins the project" + value = selectel_vpc_user_v2.user_1.id +} + +output "user_name" { + description = "Username of created user" + value = selectel_vpc_user_v2.user_1.name +} + +output "role_id" { + description = "ID of created user role" + value = selectel_vpc_role_v2.role_1.id +} + +output "user_password" { + description = "Password of created user. Generated automatically." + value = random_password.user_1_password.result + sensitive = true +} diff --git a/modules/os_project_with_user/vars.tf b/modules/os_project_with_user/vars.tf new file mode 100644 index 0000000..e914108 --- /dev/null +++ b/modules/os_project_with_user/vars.tf @@ -0,0 +1,9 @@ +variable "os_project_name" { + description = "Name of OpenStack project to create" + type = string +} + +variable "os_username" { + description = "Username of user create in OpenStack project" + type = string +} diff --git a/modules/os_project_with_user/versions.tf b/modules/os_project_with_user/versions.tf new file mode 100644 index 0000000..fd44272 --- /dev/null +++ b/modules/os_project_with_user/versions.tf @@ -0,0 +1,13 @@ +terraform { + required_providers { + selectel = { + source = "selectel/selectel" + version = ">= 4.0.1" + } + random = { + source = "hashicorp/random" + version = ">= 3.3.2" + } + } + required_version = ">= 1.5.0" +} diff --git a/modules/s3/s3-bucket/README.md b/modules/s3/s3-bucket/README.md new file mode 100644 index 0000000..898962d --- /dev/null +++ b/modules/s3/s3-bucket/README.md @@ -0,0 +1,45 @@ +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.5.0 | +| [http-full](#requirement\_http-full) | >= 1.3.1 | +| [openstack](#requirement\_openstack) | 1.53.0 | +| [terracurl](#requirement\_terracurl) | >= 1.0.1 | + +## Providers + +| Name | Version | +|------|---------| +| [openstack](#provider\_openstack) | 1.53.0 | +| [terracurl](#provider\_terracurl) | >= 1.0.1 | + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [selectel\_token](#module\_selectel\_token) | ../../selectel-token | n/a | + +## Resources + +| Name | Type | +|------|------| +| [openstack_objectstorage_container_v1.bucket](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/objectstorage_container_v1) | resource | +| [terracurl_request.init_s3](https://registry.terraform.io/providers/devops-rob/terracurl/latest/docs/data-sources/request) | data source | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [os\_account](#input\_os\_account) | Account ID | `string` | n/a | yes | +| [os\_auth\_url](#input\_os\_auth\_url) | Auth endpoint | `string` | `"https://cloud.api.selcloud.ru/identity/v3"` | no | +| [os\_password](#input\_os\_password) | Password of user | `string` | n/a | yes | +| [os\_project\_id](#input\_os\_project\_id) | ID of project, where bucket will be created | `string` | n/a | yes | +| [os\_project\_name](#input\_os\_project\_name) | ID of project, where bucket will be created | `string` | n/a | yes | +| [os\_region](#input\_os\_region) | Region where network will be created | `string` | `"ru-1"` | no | +| [os\_username](#input\_os\_username) | Login to be used | `string` | n/a | yes | +| [s3\_bucket\_name](#input\_s3\_bucket\_name) | n/a | `string` | n/a | yes | + +## Outputs + +No outputs. diff --git a/modules/s3/s3-bucket/main.tf b/modules/s3/s3-bucket/main.tf new file mode 100644 index 0000000..7aa0cea --- /dev/null +++ b/modules/s3/s3-bucket/main.tf @@ -0,0 +1,34 @@ +module "selectel_token" { + source = "../../selectel-token" + os_account = var.os_account + os_password = var.os_password + os_username = var.os_username + fetch_account_token = false + os_project_name = var.os_project_name +} + +data "terracurl_request" "init_s3" { + name = "init-s3" + url = "https://api.ru-1.storage.selcloud.ru/v2/hello/init" + method = "POST" + + headers = { + "Content-Type" = "application/json" + "X-Auth-Token" = module.selectel_token.project_token + "Accept" = "application/json" + } + + response_codes = [ + 204, + 400 + ] +} + +resource "openstack_objectstorage_container_v1" "bucket" { + region = var.os_region + name = var.s3_bucket_name + content_type = "application/json" + force_destroy = true + + depends_on = [data.terracurl_request.init_s3] +} diff --git a/modules/s3/s3-bucket/vars.tf b/modules/s3/s3-bucket/vars.tf new file mode 100644 index 0000000..bdf0ba6 --- /dev/null +++ b/modules/s3/s3-bucket/vars.tf @@ -0,0 +1,43 @@ +variable "s3_bucket_name" { + type = string +} + +variable "os_account" { + type = string + description = "Account ID" +} + +variable "os_region" { + type = string + description = "Region where network will be created" + default = "ru-1" +} + +variable "os_username" { + type = string + description = "Login to be used" +} + +variable "os_password" { + type = string + description = "Password of user" + +} + +variable "os_auth_url" { + type = string + default = "https://cloud.api.selcloud.ru/identity/v3" + description = "Auth endpoint" +} + + +variable "os_project_id" { + description = "ID of project, where bucket will be created" + type = string +} + + +variable "os_project_name" { + description = "ID of project, where bucket will be created" + type = string +} diff --git a/modules/s3/s3-bucket/versions.tf b/modules/s3/s3-bucket/versions.tf new file mode 100644 index 0000000..b341182 --- /dev/null +++ b/modules/s3/s3-bucket/versions.tf @@ -0,0 +1,18 @@ +terraform { + required_providers { + openstack = { + source = "terraform-provider-openstack/openstack" + version = "1.53.0" + } + http-full = { + source = "salrashid123/http-full" + version = ">= 1.3.1" + } + + terracurl = { + source = "devops-rob/terracurl" + version = ">= 1.0.1" + } + } + required_version = ">= 1.5.0" +} diff --git a/modules/s3/s3-credentials/README.md b/modules/s3/s3-credentials/README.md new file mode 100644 index 0000000..c238e5a --- /dev/null +++ b/modules/s3/s3-credentials/README.md @@ -0,0 +1,42 @@ +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.0.0 | +| [terracurl](#requirement\_terracurl) | >= 1.0.1 | + +## Providers + +| Name | Version | +|------|---------| +| [terracurl](#provider\_terracurl) | >= 1.0.1 | + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [selectel\_token](#module\_selectel\_token) | ../../selectel-token | n/a | + +## Resources + +| Name | Type | +|------|------| +| [terracurl_request.s3_credentials](https://registry.terraform.io/providers/devops-rob/terracurl/latest/docs/resources/request) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [credentials\_name](#input\_credentials\_name) | Название создаваемых кред для S3 | `string` | n/a | yes | +| [os\_account](#input\_os\_account) | ID аккаунта | `string` | n/a | yes | +| [os\_password](#input\_os\_password) | Пароль пользователя МИНИМУМ с ролью Администратор пользователей. Именем этого пользователя будут выданы ключи от S3 | `string` | n/a | yes | +| [os\_project\_id](#input\_os\_project\_id) | ID проекта, в котором находится бакет | `string` | n/a | yes | +| [os\_user\_id](#input\_os\_user\_id) | ID пользователя, которому надо выдать ключи S3 | `string` | n/a | yes | +| [os\_username](#input\_os\_username) | Логин пользователя МИНИМУМ с ролью Администратор пользователей. Именем этого пользователя будут выданы ключи от S3 | `string` | n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| [s3\_credentials\_access\_key](#output\_s3\_credentials\_access\_key) | n/a | +| [s3\_credentials\_secret\_key](#output\_s3\_credentials\_secret\_key) | n/a | diff --git a/modules/s3/s3-credentials/main.tf b/modules/s3/s3-credentials/main.tf new file mode 100644 index 0000000..76f5e17 --- /dev/null +++ b/modules/s3/s3-credentials/main.tf @@ -0,0 +1,36 @@ +module "selectel_token" { + source = "../../selectel-token" + os_account = var.os_account + os_password = var.os_password + os_username = var.os_username +} + +resource "terracurl_request" "s3_credentials" { + name = "vault-mount" + url = "https://api.selectel.ru/iam/v1/service_users/${var.os_user_id}/credentials" + method = "POST" + request_body = < [terraform](#requirement\_terraform) | >= 1.0.0 | +| [http-full](#requirement\_http-full) | >= 1.3.1 | + +## Providers + +| Name | Version | +|------|---------| +| [http-full](#provider\_http-full) | >= 1.3.1 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [http-full_http.accout-token](https://registry.terraform.io/providers/salrashid123/http-full/latest/docs/data-sources/http) | data source | +| [http-full_http.project-token](https://registry.terraform.io/providers/salrashid123/http-full/latest/docs/data-sources/http) | data source | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [fetch\_account\_token](#input\_fetch\_account\_token) | Если пользователь не может получить токен аккаунта, выставить в 0 | `bool` | `true` | no | +| [os\_account](#input\_os\_account) | Account ID | `string` | n/a | yes | +| [os\_password](#input\_os\_password) | Пароль пользователя | `string` | n/a | yes | +| [os\_project\_name](#input\_os\_project\_name) | Название проекта, к которому будет создан ключ | `string` | `""` | no | +| [os\_username](#input\_os\_username) | Логин пользователя | `string` | n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| [account\_token](#output\_account\_token) | n/a | +| [project\_token](#output\_project\_token) | n/a | diff --git a/modules/selectel-token/main.tf b/modules/selectel-token/main.tf new file mode 100644 index 0000000..d7640e9 --- /dev/null +++ b/modules/selectel-token/main.tf @@ -0,0 +1,28 @@ +data "http" "accout-token" { + count = var.fetch_account_token ? 1 : 0 + provider = http-full + url = "https://cloud.api.selcloud.ru/identity/v3/auth/tokens" + method = "POST" + request_headers = { + "Content-Type" = "application/json" + "Accept" = "application/json" + } + request_body = "{\"auth\":{\"identity\":{\"methods\":[\"password\"],\"password\":{\"user\":{\"name\":\"${var.os_username}\",\"domain\":{\"name\":\"${var.os_account}\"},\"password\":\"${var.os_password}\"}}},\"scope\":{\"domain\":{\"name\":\"${var.os_account}\"}}}}" +} + +data "http" "project-token" { + count = var.os_project_name != "" ? 1 : 0 + provider = http-full + url = "https://cloud.api.selcloud.ru/identity/v3/auth/tokens" + method = "POST" + request_headers = { + "Content-Type" = "application/json" + "Accept" = "application/json" + } + request_body = "{\"auth\":{\"identity\":{\"methods\":[\"password\"],\"password\":{\"user\":{\"name\":\"${var.os_username}\",\"domain\":{\"name\":\"${var.os_account}\"},\"password\":\"${var.os_password}\"}}},\"scope\":{\"project\":{\"name\":\"${var.os_project_name}\",\"domain\":{\"name\":\"${var.os_account}\"}}}}}" +} + +locals { + account_token = var.fetch_account_token ? data.http.accout-token[0].response_headers["X-Subject-Token"] : "" + project_token = var.os_project_name != "" ? data.http.project-token[0].response_headers["X-Subject-Token"] : "" +} diff --git a/modules/selectel-token/output.tf b/modules/selectel-token/output.tf new file mode 100644 index 0000000..b90efb3 --- /dev/null +++ b/modules/selectel-token/output.tf @@ -0,0 +1,9 @@ +output "account_token" { + value = local.account_token + sensitive = true +} + +output "project_token" { + value = local.project_token + sensitive = true +} \ No newline at end of file diff --git a/modules/selectel-token/vars.tf b/modules/selectel-token/vars.tf new file mode 100644 index 0000000..4f1ada9 --- /dev/null +++ b/modules/selectel-token/vars.tf @@ -0,0 +1,26 @@ +variable "os_username" { + type = string + description = "Логин пользователя" +} + +variable "os_password" { + type = string + description = "Пароль пользователя" +} + +variable "os_project_name" { + type = string + description = "Название проекта, к которому будет создан ключ" + default = "" +} + +variable "os_account" { + type = string + description = "Account ID" +} + +variable "fetch_account_token" { + default = true + type = bool + description = "Если пользователь не может получить токен аккаунта, выставить в 0" +} \ No newline at end of file diff --git a/modules/selectel-token/versions.tf b/modules/selectel-token/versions.tf new file mode 100644 index 0000000..20a5a40 --- /dev/null +++ b/modules/selectel-token/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_providers { + http-full = { + source = "salrashid123/http-full" + version = ">= 1.3.1" + } + } + required_version = ">= 1.0.0" +} diff --git a/modules/sfs/README.md b/modules/sfs/README.md new file mode 100644 index 0000000..8d0e58e --- /dev/null +++ b/modules/sfs/README.md @@ -0,0 +1,44 @@ +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.5.0 | +| [openstack](#requirement\_openstack) | 1.53.0 | + +## Providers + +| Name | Version | +|------|---------| +| [openstack](#provider\_openstack) | 1.53.0 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [openstack_sharedfilesystem_share_access_v2.share_access_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/sharedfilesystem_share_access_v2) | resource | +| [openstack_sharedfilesystem_share_v2.sfs_share](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/sharedfilesystem_share_v2) | resource | +| [openstack_sharedfilesystem_sharenetwork_v2.sfs_sharenetwork](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/sharedfilesystem_sharenetwork_v2) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [nat\_subnet\_cidr](#input\_nat\_subnet\_cidr) | Subnet, which will be able to access SFS | `string` | `"10.222.0.0/16"` | no | +| [os\_availability\_zone](#input\_os\_availability\_zone) | Zone, where SFS will be deployed | `string` | `"ru-7a"` | no | +| [os\_network\_id](#input\_os\_network\_id) | Network, where SFS will be deployed | `string` | n/a | yes | +| [os\_subnet\_id](#input\_os\_subnet\_id) | Subnet, where SFS will be deployed | `string` | n/a | yes | +| [sfs\_name\_prefix](#input\_sfs\_name\_prefix) | Prefix of all SFS resources | `string` | `"cmlp"` | no | +| [sfs\_proto](#input\_sfs\_proto) | SFS proto | `string` | `"NFS"` | no | +| [sfs\_size](#input\_sfs\_size) | SFS size | `number` | `50` | no | +| [sfs\_volume\_type](#input\_sfs\_volume\_type) | SFS volume type | `string` | `"basic"` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [sfs\_address](#output\_sfs\_address) | SFS path | +| [sfs\_addressess](#output\_sfs\_addressess) | SFS paths array. For debug purposes | diff --git a/modules/sfs/main.tf b/modules/sfs/main.tf new file mode 100644 index 0000000..bc6a2e7 --- /dev/null +++ b/modules/sfs/main.tf @@ -0,0 +1,21 @@ +resource "openstack_sharedfilesystem_sharenetwork_v2" "sfs_sharenetwork" { + name = "${var.sfs_name_prefix}-sfs-sharenetwork" + description = "${var.sfs_name_prefix}-sfs-sharenetwork" + neutron_net_id = var.os_network_id + neutron_subnet_id = var.os_subnet_id +} + +resource "openstack_sharedfilesystem_share_v2" "sfs_share" { + name = "${var.sfs_name_prefix}-${var.sfs_proto}-sfs-share" + size = var.sfs_size + share_proto = var.sfs_proto + share_type = "${var.sfs_volume_type}.${var.os_availability_zone}" + share_network_id = openstack_sharedfilesystem_sharenetwork_v2.sfs_sharenetwork.id +} + +resource "openstack_sharedfilesystem_share_access_v2" "share_access_1" { + share_id = openstack_sharedfilesystem_share_v2.sfs_share.id + access_type = "ip" + access_to = var.nat_subnet_cidr + access_level = "rw" +} diff --git a/modules/sfs/output.tf b/modules/sfs/output.tf new file mode 100644 index 0000000..d89a567 --- /dev/null +++ b/modules/sfs/output.tf @@ -0,0 +1,9 @@ +output "sfs_address" { + value = openstack_sharedfilesystem_share_v2.sfs_share.export_locations[0].path + description = "SFS path" +} + +output "sfs_addressess" { + value = openstack_sharedfilesystem_share_v2.sfs_share.export_locations + description = "SFS paths array. For debug purposes" +} \ No newline at end of file diff --git a/modules/sfs/vars.tf b/modules/sfs/vars.tf new file mode 100644 index 0000000..ec9ffc8 --- /dev/null +++ b/modules/sfs/vars.tf @@ -0,0 +1,45 @@ +variable "sfs_name_prefix" { + type = string + description = "Prefix of all SFS resources" + default = "cmlp" +} + +variable "os_network_id" { + type = string + description = "Network, where SFS will be deployed" +} + +variable "os_subnet_id" { + type = string + description = "Subnet, where SFS will be deployed" +} + +variable "sfs_size" { + type = number + description = "SFS size" + default = 50 +} + +variable "sfs_proto" { + type = string + description = "SFS proto" + default = "NFS" +} + +variable "sfs_volume_type" { + type = string + description = "SFS volume type" + default = "basic" +} + +variable "os_availability_zone" { + type = string + description = "Zone, where SFS will be deployed" + default = "ru-7a" +} + +variable "nat_subnet_cidr" { + type = string + description = "Subnet, which will be able to access SFS" + default = "10.222.0.0/16" +} \ No newline at end of file diff --git a/modules/sfs/versions.tf b/modules/sfs/versions.tf new file mode 100644 index 0000000..6b12975 --- /dev/null +++ b/modules/sfs/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_providers { + openstack = { + source = "terraform-provider-openstack/openstack" + version = "1.53.0" + } + } + required_version = ">= 1.5.0" +} diff --git a/modules/vm/README.md b/modules/vm/README.md new file mode 100644 index 0000000..339d52b --- /dev/null +++ b/modules/vm/README.md @@ -0,0 +1,56 @@ +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.5.0 | +| [openstack](#requirement\_openstack) | 1.53.0 | +| [selectel](#requirement\_selectel) | >= 4.0.2 | + +## Providers + +| Name | Version | +|------|---------| +| [openstack](#provider\_openstack) | 1.53.0 | + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [nat](#module\_nat) | ../nat | n/a | +| [os-flavor](#module\_os-flavor) | ../flavor | n/a | +| [volume](#module\_volume) | ../volume | n/a | + +## Resources + +| Name | Type | +|------|------| +| [openstack_compute_instance_v2.instance_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/compute_instance_v2) | resource | +| [openstack_networking_port_v2.port_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/networking_port_v2) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [dns\_nameservers](#input\_dns\_nameservers) | DNS servers to be used, selectel dns is default | `list(string)` |
[
"188.93.16.19",
"188.93.17.19"
]
| no | +| [enable\_dhcp](#input\_enable\_dhcp) | DHCP enable flag | `bool` | `false` | no | +| [image\_name](#input\_image\_name) | n/a | `list(string)` |
[
"Ubuntu 20.04 LTS 64-bit"
]
| no | +| [network\_name](#input\_network\_name) | Network name to be created | `string` | `"network_1"` | no | +| [os\_region](#input\_os\_region) | Region where network will be created | `string` | n/a | yes | +| [os\_zone](#input\_os\_zone) | OS zone to be used | `string` | n/a | yes | +| [router\_external\_net\_name](#input\_router\_external\_net\_name) | Name of external network to be used | `string` | `"external-network"` | no | +| [router\_name](#input\_router\_name) | Router name to be created | `string` | `"router_1"` | no | +| [server\_root\_disk\_gb](#input\_server\_root\_disk\_gb) | List of disks | `list(number)` |
[
40
]
| no | +| [server\_volume\_type](#input\_server\_volume\_type) | List of disk types | `list(string)` |
[
"fast"
]
| no | +| [subnet\_cidr](#input\_subnet\_cidr) | Subnet CIRD to be created | `string` | `"192.168.0.0/24"` | no | +| [vm\_local\_disk\_gb](#input\_vm\_local\_disk\_gb) | Flavor's local disk size | `string` | `"0"` | no | +| [vm\_name](#input\_vm\_name) | Name of VM to create | `string` | n/a | yes | +| [vm\_ram\_mb](#input\_vm\_ram\_mb) | RAM in VMs flavor | `number` | `4096` | no | +| [vm\_vcpus](#input\_vm\_vcpus) | CPU in VMs flavor | `number` | `2` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [nat\_net\_id](#output\_nat\_net\_id) | n/a | +| [nat\_sub\_id](#output\_nat\_sub\_id) | n/a | +| [vm\_port\_id](#output\_vm\_port\_id) | n/a | diff --git a/modules/vm/main.tf b/modules/vm/main.tf new file mode 100644 index 0000000..ce8d34f --- /dev/null +++ b/modules/vm/main.tf @@ -0,0 +1,70 @@ +module "os-flavor" { + source = "../flavor" + + flavor_name = var.vm_name + flavor_vcpus = var.vm_vcpus + flavor_ram_mb = var.vm_ram_mb + flavor_local_disk_gb = var.vm_local_disk_gb + os_region = var.os_region +} + +module "volume" { + source = "../volume" + + count = length(var.server_root_disk_gb) + server_root_disk_gb = var.server_root_disk_gb[count.index] + server_volume_type = var.server_volume_type[count.index] + os_zone = var.os_zone + image_name = var.image_name[count.index] +} + +module "nat" { + source = "../nat" + + router_external_net_name = var.router_external_net_name + dns_nameservers = var.dns_nameservers + subnet_cidr = var.subnet_cidr + router_name = var.router_name + network_name = var.network_name + enable_dhcp = var.enable_dhcp +} + +resource "openstack_networking_port_v2" "port_1" { + name = "${var.vm_name}-eth0" + network_id = module.nat.network_id + + fixed_ip { + subnet_id = module.nat.subnet_id + } +} + +resource "openstack_compute_instance_v2" "instance_1" { + name = var.vm_name + + flavor_id = module.os-flavor.flavor_id + availability_zone = var.os_zone + + network { + port = openstack_networking_port_v2.port_1.id + } + + dynamic "block_device" { + for_each = module.volume + content { + source_type = "volume" + destination_type = "volume" + uuid = block_device.value.volume_id + boot_index = block_device.key + } + } + + vendor_options { + ignore_resize_confirmation = true + } + + lifecycle { + ignore_changes = [ + key_pair, + ] + } +} diff --git a/modules/vm/outputs.tf b/modules/vm/outputs.tf new file mode 100644 index 0000000..44696f8 --- /dev/null +++ b/modules/vm/outputs.tf @@ -0,0 +1,11 @@ +output "nat_net_id" { + value = module.nat.network_id +} + +output "nat_sub_id" { + value = module.nat.subnet_id +} + +output "vm_port_id" { + value = openstack_networking_port_v2.port_1.id +} diff --git a/modules/vm/vars.tf b/modules/vm/vars.tf new file mode 100644 index 0000000..76e1e08 --- /dev/null +++ b/modules/vm/vars.tf @@ -0,0 +1,89 @@ +variable "vm_name" { + type = string + description = "Name of VM to create" +} + +variable "os_region" { + type = string + description = "Region where network will be created" +} + +variable "os_zone" { + type = string + description = "OS zone to be used" +} + +variable "server_root_disk_gb" { + type = list(number) + default = [40] + description = "List of disks" +} + +variable "server_volume_type" { + type = list(string) + default = ["fast"] + description = "List of disk types" +} + +variable "image_name" { + type = list(string) + default = ["Ubuntu 20.04 LTS 64-bit"] + +} + +variable "vm_local_disk_gb" { + type = string + description = "Flavor's local disk size" + default = "0" +} + +variable "vm_vcpus" { + type = number + description = "CPU in VMs flavor" + default = 2 +} + +variable "vm_ram_mb" { + type = number + description = "RAM in VMs flavor" + default = 4096 +} + +variable "router_external_net_name" { + type = string + default = "external-network" + description = "Name of external network to be used" +} + +variable "dns_nameservers" { + description = "DNS servers to be used, selectel dns is default" + type = list(string) + default = [ + "188.93.16.19", + "188.93.17.19", + ] +} + +variable "subnet_cidr" { + description = "Subnet CIRD to be created" + type = string + default = "192.168.0.0/24" +} + +variable "router_name" { + description = "Router name to be created" + type = string + default = "router_1" +} + +variable "network_name" { + description = "Network name to be created" + type = string + default = "network_1" +} + +variable "enable_dhcp" { + description = "DHCP enable flag" + type = bool + default = false +} diff --git a/modules/vm/versions.tf b/modules/vm/versions.tf new file mode 100644 index 0000000..a0ffbd8 --- /dev/null +++ b/modules/vm/versions.tf @@ -0,0 +1,13 @@ +terraform { + required_providers { + selectel = { + source = "selectel/selectel" + version = ">= 4.0.2" + } + openstack = { + source = "terraform-provider-openstack/openstack" + version = "1.53.0" + } + } + required_version = ">= 1.5.0" +} diff --git a/modules/volume/README.md b/modules/volume/README.md new file mode 100644 index 0000000..199fe0b --- /dev/null +++ b/modules/volume/README.md @@ -0,0 +1,44 @@ +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.5.0 | +| [openstack](#requirement\_openstack) | 1.53.0 | +| [random](#requirement\_random) | >= 3.3.2 | + +## Providers + +| Name | Version | +|------|---------| +| [openstack](#provider\_openstack) | 1.53.0 | +| [random](#provider\_random) | >= 3.3.2 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [openstack_blockstorage_volume_v3.volume_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/resources/blockstorage_volume_v3) | resource | +| [random_string.random](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/string) | resource | +| [openstack_images_image_v2.image_1](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/1.53.0/docs/data-sources/images_image_v2) | data source | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [image\_name](#input\_image\_name) | Root image name | `string` | `"Ubuntu 20.04 LTS 64-bit"` | no | +| [image\_visibility](#input\_image\_visibility) | Image visibility | `string` | `"public"` | no | +| [os\_zone](#input\_os\_zone) | OS zone to be used | `string` | n/a | yes | +| [server\_root\_disk\_gb](#input\_server\_root\_disk\_gb) | Root disk size | `number` | `40` | no | +| [server\_volume\_type](#input\_server\_volume\_type) | Disk type to be used | `string` | `"fast"` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [image\_id](#output\_image\_id) | ID of image used | +| [volume\_id](#output\_volume\_id) | Created volume ID | +| [volume\_name](#output\_volume\_name) | Name of created volume | diff --git a/modules/volume/main.tf b/modules/volume/main.tf new file mode 100644 index 0000000..1d4c53d --- /dev/null +++ b/modules/volume/main.tf @@ -0,0 +1,22 @@ +data "openstack_images_image_v2" "image_1" { + name = var.image_name + visibility = var.image_visibility + most_recent = true +} + +resource "random_string" "random" { + length = 16 + special = false +} + +resource "openstack_blockstorage_volume_v3" "volume_1" { + name = random_string.random.result + size = var.server_root_disk_gb + image_id = data.openstack_images_image_v2.image_1.id + volume_type = "${var.server_volume_type}.${var.os_zone}" + availability_zone = var.os_zone + + lifecycle { + ignore_changes = [image_id] + } +} diff --git a/modules/volume/output.tf b/modules/volume/output.tf new file mode 100644 index 0000000..6f45760 --- /dev/null +++ b/modules/volume/output.tf @@ -0,0 +1,14 @@ +output "image_id" { + value = data.openstack_images_image_v2.image_1.id + description = "ID of image used" +} + +output "volume_id" { + value = openstack_blockstorage_volume_v3.volume_1.id + description = "Created volume ID" +} + +output "volume_name" { + value = random_string.random.result + description = "Name of created volume" +} \ No newline at end of file diff --git a/modules/volume/vars.tf b/modules/volume/vars.tf new file mode 100644 index 0000000..185f45a --- /dev/null +++ b/modules/volume/vars.tf @@ -0,0 +1,29 @@ +variable "image_name" { + type = string + description = "Root image name" + default = "Ubuntu 20.04 LTS 64-bit" +} + +variable "image_visibility" { + type = string + description = "Image visibility" + default = "public" +} + +variable "server_volume_type" { + type = string + default = "fast" + description = "Disk type to be used" +} + +variable "server_root_disk_gb" { + type = number + default = 40 + description = "Root disk size" +} + +variable "os_zone" { + type = string + description = "OS zone to be used" +} + diff --git a/modules/volume/versions.tf b/modules/volume/versions.tf new file mode 100644 index 0000000..8bab211 --- /dev/null +++ b/modules/volume/versions.tf @@ -0,0 +1,13 @@ +terraform { + required_providers { + openstack = { + source = "terraform-provider-openstack/openstack" + version = "1.53.0" + } + random = { + source = "hashicorp/random" + version = ">= 3.3.2" + } + } + required_version = ">= 1.5.0" +} diff --git a/providers.tf b/providers.tf new file mode 100644 index 0000000..3a08017 --- /dev/null +++ b/providers.tf @@ -0,0 +1,15 @@ +provider "selectel" { + domain_name = var.selectel_domain_name + username = var.selectel_user_admin_user + password = var.selectel_user_admin_password +} + +provider "openstack" { + auth_url = var.os_auth_url + user_name = module.project-with-user.user_name + tenant_id = module.project-with-user.project_id + password = module.project-with-user.user_password + project_domain_name = var.selectel_domain_name + user_domain_name = var.selectel_domain_name + region = "ru-9" +} diff --git a/vars.tf b/vars.tf new file mode 100644 index 0000000..08f8bfd --- /dev/null +++ b/vars.tf @@ -0,0 +1,22 @@ +# Selectel provider vars +variable "selectel_domain_name" { + type = string + description = "ID Selectel аккаунта" +} + +variable "selectel_user_admin_user" { + type = string + description = "Имя сервисного пользователя, необходимо создать через панель my.selectel" +} + +variable "selectel_user_admin_password" { + type = string + description = "Пароль от сервисного пользователя" +} + +# Openstack provider vars +variable "os_auth_url" { + type = string + default = "https://cloud.api.selcloud.ru/identity/v3" + description = "URL до openstack api" +} diff --git a/versions.tf b/versions.tf new file mode 100644 index 0000000..242775e --- /dev/null +++ b/versions.tf @@ -0,0 +1,13 @@ +terraform { + required_providers { + selectel = { + source = "selectel/selectel" + version = "4.0.2" + } + openstack = { + source = "terraform-provider-openstack/openstack" + version = "1.53.0" + } + } + required_version = ">= 1.0.0" +}