|
| 1 | +=============================== |
| 2 | +OpenTofu Vast Manila User Guide |
| 3 | +=============================== |
| 4 | + |
| 5 | +OpenTofu Vast Manila allows you to manage your Vast resources using Terraform. |
| 6 | +This guide will provide you with example templated for available resources. |
| 7 | +A full list of variables available for each resource can be found in `variables.tf`_ |
| 8 | +with a description and type. |
| 9 | + |
| 10 | +Currently, this module requires `Tofu OpenStack Config`_ support for networks, |
| 11 | +subnets and project. See `integration section`_ for more details. |
| 12 | + |
| 13 | +It is recommend for easy readibility to separate your resources in ``main.tf`` |
| 14 | +as follows: |
| 15 | + |
| 16 | +.. code-block:: console |
| 17 | +
|
| 18 | + module "vast" { |
| 19 | + source = |
| 20 | +
|
| 21 | + # vast credentials need to be accessible to the module |
| 22 | + username = |
| 23 | + password = |
| 24 | +
|
| 25 | + vippools = local.vippool-config |
| 26 | + vast_tenants = local.vast-tenant-config |
| 27 | + ... |
| 28 | + } |
| 29 | +
|
| 30 | +The config for each resource can then be written into separate files, suggested |
| 31 | +format is ``<resource>-config.tf``, for example: |
| 32 | + |
| 33 | +- ``vippool-config.tf`` |
| 34 | +- ``vast-tenant-config.tf`` |
| 35 | + |
| 36 | +Vippools |
| 37 | +-------- |
| 38 | + |
| 39 | +To create a vippool, add config to ``vippool-config.tf``. |
| 40 | + |
| 41 | +Template: |
| 42 | + |
| 43 | +.. code-block:: console |
| 44 | +
|
| 45 | + locals { |
| 46 | + vippool-config = { |
| 47 | + ## start of template |
| 48 | + "<your-tofu-vippool-name" = { |
| 49 | + name = # optional, if network provided name is templated from given network segmetation_id for format openstack_vlan_<segmentation_id> |
| 50 | + subnet_cidr = |
| 51 | + network = "<your-tofu-network-name>" |
| 52 | + project = |
| 53 | +
|
| 54 | + vip_ranges = [ |
| 55 | + { subnet = |
| 56 | + start = |
| 57 | + end = |
| 58 | + }, # vip_ranges must be separated by a comma (,) |
| 59 | + { ... } |
| 60 | + ] |
| 61 | + } |
| 62 | + ## end of template |
| 63 | + } |
| 64 | + } |
| 65 | +
|
| 66 | +Vast Tenants |
| 67 | +------------ |
| 68 | + |
| 69 | +To create a Vast tenant, add config to ``vast-tenant-config``. |
| 70 | + |
| 71 | +Template: |
| 72 | + |
| 73 | +.. code-block:: console |
| 74 | +
|
| 75 | + locals { |
| 76 | + vast-tenant-config = { |
| 77 | + ## start of template |
| 78 | + "<your-vast-tenant-name>" = { |
| 79 | + allow_locked_users = |
| 80 | + allow_disabled_users = |
| 81 | +
|
| 82 | + client_ranges = [ |
| 83 | + { |
| 84 | + subnet = "<tofu-subnet-name>" |
| 85 | + start = |
| 86 | + end = |
| 87 | + }, #client_ranges must be separated by a comma (,) |
| 88 | + { ... } |
| 89 | + ] |
| 90 | + # or |
| 91 | + client_ip_ranges = [ |
| 92 | + { ... }, #client_ip_ranges must be separated by a comma (,) |
| 93 | + { ... } |
| 94 | + ] |
| 95 | + } |
| 96 | + ## end of template |
| 97 | + } |
| 98 | + } |
| 99 | +
|
| 100 | +
|
| 101 | +.. _integration section: |
| 102 | + |
| 103 | +================================== |
| 104 | +Tofu OpenStack Config Integration |
| 105 | +================================== |
| 106 | + |
| 107 | +To access the ``projects``, ``networks`` and ``subnets`` resources from `Tofu OpenStack Config`_ |
| 108 | +module, you need to provide the ``vast`` mpdule with the ``openstack`` resources. |
| 109 | +This can be done by including the following in your ``main.tf``: |
| 110 | + |
| 111 | +.. code-block:: console |
| 112 | +
|
| 113 | + ##main.tf |
| 114 | + module "vast" { |
| 115 | + source = "github.com/stackhpc/opentofu-vast-manila?ref=main" |
| 116 | + # this lines takes the resources from the module "openstack" into the vast module |
| 117 | + projects = module.openstack.projects |
| 118 | + networks = module.openstack.networks |
| 119 | + subnets = module.openstack.subnets |
| 120 | + ... |
| 121 | + } |
| 122 | +
|
| 123 | + module "openstack" { |
| 124 | + source = "github.com/stackhpc/tofu-openstack-config?ref=main" |
| 125 | +
|
| 126 | + projects = |
| 127 | + networks = |
| 128 | + subnets = |
| 129 | + ... |
| 130 | + } |
| 131 | +
|
| 132 | +.. _variables.tf: https://github.com/stackhpc/opentofu-vast-manila/blob/main/variables.tf |
| 133 | +.. _Tofu OpenStack Config: https://github.com/stackhpc/tofu-openstack-config |
0 commit comments