-
Notifications
You must be signed in to change notification settings - Fork 0
Guide for tofu openstack config usage #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
claudia-lola
wants to merge
12
commits into
main
Choose a base branch
from
example-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
6171886
Guide for tofu openstack config usage
claudia-lola b10027d
Fix capitalisation
claudia-lola ccdfb0b
add routers, flavors and images to guide
claudia-lola 6de2a52
Fix typos
claudia-lola 9901492
Fix capitalization and wording in user guide
claudia-lola bf57e0d
Convert to markdown
claudia-lola 9729d76
Separation of docs into different files. Adding argument references a…
claudia-lola 28a8488
removing shares
claudia-lola 420475d
Adding vast provider to readme, warning for sharetype resources
claudia-lola 5ecf864
vast_vippool_name optional update
claudia-lola c3f7e3a
Delete guide.rst, README edits, move vast support info
claudia-lola 7be371f
Update to VAST information
claudia-lola File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| ## Flavors | ||
|
|
||
| To create a flavor, | ||
|
|
||
| Example usage: | ||
|
|
||
| ```console | ||
| flavors = { | ||
| "test-flavour" = { | ||
| ram = 4096 | ||
| vcpus = 1 | ||
| disk = 50 | ||
| ephemeral = 0 | ||
| swap = 0 | ||
| rx_tx_factor = 1.0 | ||
| is_public = true | ||
| extra_specs = { | ||
| } | ||
| projects = [ | ||
| "client", "client-other-project" | ||
| ] | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Argument reference: | ||
| - `ram` (Required) number. Value in megabytes. Changing this creates a new flavor. | ||
| - `vcpus` (Required) number. Changing this creates a new flavor. | ||
| - `disk` (Required) number. Value in GiB. Changing this creates a new flavor. | ||
| - `ephemral` (Optional) number. Changing this creates a new flavor. | ||
| - `swap` (Optional) number. The amount of disk space in megabytes to use. Changing this creates a new flavor. | ||
| - `rx_tx_factor` (Optional) number. Changing this creates a new flavor. | ||
| - `is_public` (Optional) bool, default true. If "projects" is non-empty this is ignored and set false. Changing this creates a new flavor. | ||
| - `flavor_id` (Optional) string. Changing this creates a new flavor access | ||
| - `extra_specs` (Optional) map of strings | ||
| - `projects` (Optional) list of strings. Project names to have access to the flavor. Changing this creates a new flavor access. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| ## Tofu OpenStack Config User Guide | ||
|
|
||
| Tofu OpenStack Config allows you to manage your Openstack config using Terraform. | ||
| This guide will provide you with example templates for available resources. A full | ||
| list of variables available for each resource can be found in [variables.tf](https://github.com/stackhpc/tofu-openstack-config/blob/main/variables.tf), | ||
| with a description and type. | ||
|
|
||
| It is recommended for easy readibility to separate your resources in `main.tf` | ||
| as follows: | ||
|
|
||
| ```console | ||
| module "openstack" { | ||
| source = | ||
|
|
||
| projects = local.project-config | ||
| networks = local.network-config | ||
| ... | ||
| } | ||
| ``` | ||
|
|
||
| The config for each resource can then be written into separate files, suggested | ||
| format is `<resource>-config.tf`, for example: | ||
|
|
||
| - project-config.tf | ||
| - network-config.tf | ||
| - router-config.tf | ||
|
|
||
| For information on how local values work, see this [opentofu.org website](https://opentofu.org/docs/language/values/locals/). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| ## Users | ||
|
|
||
| To create a new user, | ||
|
|
||
| Example usage: | ||
|
|
||
| ```console | ||
| users = { | ||
| "<username>" = { | ||
| name = "bob" | ||
| default_project = "client" | ||
| email = "bob@client.com" | ||
| description = "Bob from client" | ||
| groups = [ | ||
| "admin:client", | ||
| "member:client-other-project" | ||
| ] | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Argument reference: | ||
| - `description` (Optional) string | ||
| - `email` (Optional) string | ||
| - `groups` (Optional) string | ||
| - `password` (Optional) string | ||
| - `default_project` (Optional) string. Project name. | ||
|
|
||
| For users to have access to projects - groups and role assignments need to be created then | ||
| users are assigned the corresponding groups that match their `role:project` needs. | ||
|
|
||
| ## Groups | ||
|
|
||
| To create a group, add config to `group-config.tf`. | ||
|
|
||
| Template: | ||
|
|
||
| ```console | ||
| group-config = { | ||
| "admin:client" = "Admins of client project" | ||
| "member:client" = "Members of client project" | ||
| ... | ||
| } | ||
| ``` | ||
|
|
||
| Argument reference: | ||
| - `description` (Optional) string | ||
|
|
||
| ## Role assignment | ||
|
|
||
| To create a role, | ||
|
|
||
| Available roles can be seen by running `openstack role list` | ||
|
|
||
| Example usage: | ||
|
|
||
| ```console | ||
| role_assignments = [ | ||
| { | ||
| role = "admin" | ||
| group = "admin:client" | ||
| project = "client" | ||
| }, | ||
| { | ||
| role = "member" | ||
| group = "member:client-other-project" | ||
| project = "client-other-project" | ||
| }, | ||
| ... | ||
| ] | ||
| ``` | ||
|
|
||
| Argument reference: | ||
| - `role` (Required) string. Role name, available roles found by running `openstack role list`. | ||
| - `group` (Required) string. Group name. | ||
| - `project` (Required) string. Project name. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| ## Images | ||
|
|
||
| To create an image, | ||
|
|
||
| Example usage: | ||
|
|
||
| ```console | ||
| images = { | ||
| "Ubuntu-24.04-20260323-noble-server-cloudimg-amd64" = { | ||
| image_source_url = "https://cloud-images.ubuntu.com/noble/20260323/noble-server-cloudimg-amd64.img" | ||
| container_format = "bare" | ||
| disk_format = "qcow2" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Argument reference: | ||
| - `container_format` (Required) string. Must be one of "bare", "ovf", "aki", "ari", "ami", "ova", "docker", "compressed". | ||
| - `disk_format` (Required) string. Must be one of "raw", "vhd", "vhdx", "vmdk", "vdi", "iso", "ploop", "qcow2", "aki", "ari", "ami". | ||
| - `image_cache_path` (Optional) string. | ||
| - `image_source_url` (Optional) string. | ||
| - `image_id` (Optional) string. | ||
| - `min_disk_gb` (Optional) number, default 0. | ||
| - `min_ram_mb` (Optional) number, default 0. | ||
| - `protected` (Optional) bool, default false. | ||
| - `hidden` (Optional) bool, default false. | ||
| - `web_download` (Optional) bool, default false. | ||
| - `properties` (Optional) list of strings. | ||
| - `visibility` (Optional) string. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| ## Networking config | ||
|
|
||
| Note that: | ||
|
|
||
| - Networks (and their subnets) and routers do not necessarily have to be associated with a project. If they are this association can be made with the project's name (if the project is controllled by this config) or by a project/tenant id from OpenStack (if it is not). | ||
| - The names in OpenStack for networks, subnets and routers are not necessarily unique across projects. Therefore these resources have a tofu resource name which must be unique across projects, which can be used to refer to them for other resources. It is suggested that a convention of using $NAME:$PROJECT_NAME is used. | ||
|
|
||
|
|
||
| ## Networks | ||
|
|
||
| To create a network, | ||
|
|
||
| Example usage: | ||
|
|
||
| ```console | ||
| network = { | ||
| "client_net_data:client" = { | ||
| name = "client-net-data" | ||
| project = "client" | ||
| admin_state_up = true | ||
| external = false | ||
| mtu = 9000 | ||
| port_security_enabled = false | ||
|
|
||
| segments = [{ | ||
| network_type = "vlan" | ||
| physical_network = "physnet1" | ||
| }] | ||
|
|
||
| subnets = { | ||
| "client_subnet_data:client" = { | ||
| name = "client-subnet-data" | ||
| ip_version = 4 | ||
| no_gateway = true | ||
|
|
||
| #project-nets | ||
| subnetpool_id = "..." | ||
| prefix_length = 24 | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Argument reference: | ||
| - `name` (Required) string. | ||
| - `region` (Optional) string. Changing this creates a new network. | ||
| - `shared` (Optional) bool, default false. | ||
| - `external` (Optional) bool, default false. | ||
| - `admin_state_up` (Optional) bool, default false. | ||
| - `project` (Optional) string. Project name, overrides `tenant_id`. Changing this creates a new network. | ||
| - `tenant_id` (Optional) string. Openstack project id, overriden by `project`. Changing this creates a new network. | ||
| - `mtu` (Optional) number. | ||
| - `port_sercuirty_enabled` (Optional) bool, default false. | ||
| - `tags` (Optional) list. | ||
| - `segments` (Optional) list of objects, block supports: | ||
| - `physical_network` (Optional) string. | ||
| - `network_type` (Optonal) string. | ||
| - `segmentation_id` (Optional) string. | ||
| - `subnets` (Optional) list of maps, block supports: | ||
| - `key` (Required) string. | ||
| - `name` (Required) string. | ||
| - `region` (Optional) string. Changing this creates a new subnet. | ||
| - `cidr` (Optional) string. Can omit option if creating subnet from a subnet pool (using `subnetpool_id` ). | ||
| - `ip_version` (Optional) number, default 4. Changing this creates a new subnet. | ||
| - `gateway_ip` (Optional) string. | ||
| - `enable_dhcp` (Optional) bool, default true. | ||
| - `dns_nameserver` (Optional) list. | ||
| - `dns_publish_fixed_ips` (Optional) bool, default false. | ||
| - `service_type` (Optional) list | ||
| - `subnetpool_id` (Optional) string | ||
| - `prefix_length` (Optional) number | ||
| - `no_gateway` (Optional) bool | ||
| - `tags` (Optional) list | ||
| - `allocation_pool` (Optional) list, block supports: | ||
| - `start` (Required) string. | ||
| - `end` (Required) string. | ||
|
|
||
|
|
||
| ## Routers | ||
|
|
||
| To create a router, | ||
|
|
||
| Example usage: | ||
|
|
||
| ```console | ||
| routers = { | ||
| "internal:admin" = { | ||
| name = "internal" | ||
| external_network = "internal-net:admin" # tofu resource name of network | ||
| project = "admin" | ||
|
|
||
| external_fixed_ips = [ | ||
| { subnet = "internal-net:admin" } | ||
| ] | ||
|
|
||
| interfaces = [ | ||
| { subnet = "internal-net:admin" } | ||
| ] | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Arguments referenece: | ||
| - `name` (Required) string. Openstack router name. | ||
| - `region` (Optional) string. Changing this creates a new router. | ||
| - `external_network` (Optional) string. Tofu resource name of network. | ||
| - `external_network_id` (Optional) string. Openstack network id. | ||
| - `admin_state_up` (Optional) bool. | ||
| - `project` (Optional) string. Project name, overrides `tenant_id`. Changing this creates a new router. | ||
| - `tenant_id` (Optional) string. Openstack project id, overriden by `project`. Changing this creates a new router. | ||
| - `tags` (Optional) list. | ||
| - `external_fixed_ip` (Optional) list of maps, block supports: | ||
| - `subnet` (Optional) string. Tofu resource name of subnet. | ||
| - `subnet_id` (Optional) string. Openstack subnet id. | ||
| - `ip_address` (Optional) string. | ||
| - `interfaces` (Optional) list of maps, block supports: | ||
| - `region` (Optional) string. Changing this creates a new router interface. | ||
| - `subnet` (Optional) string. Tofu resource name of subnet, overrides `subnet_id`. Changing this creates a new router interface. | ||
| - `subnet_id` (Optional) string. Openstack subnet id, overriden by `subnet`. Changing this creates a new router interface. | ||
| - `port_id` (Optional) string. Openstack port id. Changing this creates a new router interface. | ||
| - `force_destroy` (Optional) bool, default false. | ||
|
|
||
| ## Network RBAC | ||
| To create a network RBAC (role based access control), | ||
|
|
||
| Example usage: | ||
|
|
||
| ```console | ||
| network_rbac = { | ||
|
|
||
| } | ||
| ``` | ||
|
|
||
| Argument reference: | ||
| - `network` (Required) string. Changing this creates a new routing entry. | ||
| - `projects` (Required) list of strings. Project names. | ||
| - `access` (Required) string. Valid values are either `access_as_external` or `access_as_shared`. | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.