Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 35 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,65 +100,6 @@ The "Import?" column refers to support for [importing existing openstack configu
| Image elements | No | N/A | Considered out of scope |
| Ratings | No | N/A | |

## Network config example
The following is an example config for how to use the new network support. A single
project is defined which contains a single subnet.

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.


```
module "openstack" {
source = "github.com/stackhpc/tofu-openstack-config?ref=main"
projects = {
"demo-project" = {
compute_quota = {
}
network_quota = {
}
blockstorage_quota = {
}
}
}

networks = {
"demo-network:demo-project" = { # unique tofu resource name
name = "demo-network" # openstack network name
project = "demo-project"

subnets = {
"demo-subnet:demo-project" = { # unique tofu resource name
name = "demo-subnet" # openstack subnet name
cidr = "10.0.0.0/24"
}
}
}
}

routers = {
"demo-router:demo-project" = { # unique tofu resource name
name = "demo-router" # openstack router name
project = "demo-project"
external_network = "demo-network:demo-project" # unique tofu resource name of network
external_fixed_ips = [{
subnet = "demo-subnet:demo-project" # unique tofu resource name of subnet
}]
interfaces = [
{ subnet = "demo-subnet:demo-project" } # unique tofu resource name of subnet
]
}
}

}
```

## Current Issues

Expand Down Expand Up @@ -267,3 +208,38 @@ committed, it does not matter.
- Changes to the `src/` files are picked up when running `tofu-os-cfg`.
- Note that the `--output` argument can be used to determine where files are
generated.

## VAST Support

Support for resources:
- `vastdata_vip_pool`
- `vastdata_tenant`

To use the VAST resources, you'll need a `provider.tf` file in your `tofu/` dir containing
the required config:

```shell
terraform {
required_providers {
vastdata = {
source = "vast-data/vastdata"
version = "2.1.1"
}
}
}

provider "vastdata" {
username = #string
port = #number
password = var.vast_password #string
host = #string
skip_ssl_verify = true
}

variable "vast_password" {
sensitive = true
}
```

Filling in the missing variables in the `provider "vastdata"` block. More infomation
on the vastdata provider config can be found in the [HashiCorp Terrafrom docs](https://registry.terraform.io/providers/vast-data/vastdata/latest/docs#example-usage).
36 changes: 36 additions & 0 deletions docs/flavors.md
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.
28 changes: 28 additions & 0 deletions docs/guide.md
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/).
Loading