Skip to content

Commit

Permalink
Update tags and default_tags related documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
frousselet committed Aug 15, 2023
1 parent 6e5e265 commit e7bacdf
Show file tree
Hide file tree
Showing 15 changed files with 76 additions and 57 deletions.
87 changes: 51 additions & 36 deletions website/docs/index.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -38,37 +38,39 @@ resource "opennebula_group" "group" {

The configuration of the OpenNebula Provider can be set by the `provider` block attributes or by the environment variables.

### Provider configuration
### Provider attributes

* `endpoint` - (Required) The URL of OpenNebula XML-RPC Endpoint API (for example, `http://example.com:2633/RPC2`).
* `flow_endpoint` - (Optional) The OneFlow HTTP Endpoint API (for example, `http://example.com:2474/RPC2`).
* `username` - (Required) The OpenNebula username.
* `password` - (Required) The Opennebula password matching the username.
* `insecure` - (Optional) Allow insecure connexion (skip TLS verification).
* `default_tags` - (Optional) Apply default custom tags to created resources: group, image, security_group, template, vm_group, user, virtual_machine, virtual_network, virtual_router, virtual_router_instance. Theses tags could be overriden in the tag section of the resource. See [Default Tags parameters](#default-tags-parameters) below for details.
* `default_tags` - (Optional) Apply default custom tags to resources supporting `tags`. Theses tags can be overriden in the `tags` section of the resource. See [Using tags](#using-tags) below for more details.

#### Default Tags parameters
!> **Warning:** Hard-coded credentials are not recommended in any Terraform configuration file and should not be commited in a public repository you might prefer [Environment variables instead](#environment-variables).

`default_tags` supports the following arguments:
### Environment variables

* `tags` - (Optional) Map of tags.
The provider can also read the following environment variables if no value is set in the the `provider` block attributes:

#### Example
* `OPENNEBULA_ENDPOINT`
* `OPENNEBULA_FLOW_ENDPOINT`
* `OPENNEBULA_USERNAME`
* `OPENNEBULA_PASSWORD`
* `OPENNEBULA_INSECURE`

```hcl
provider "opennebula" {
endpoint = "https://example.com:2633/RPC2"
flow_endpoint = "https://example.com:2474/RPC2"
username = "me"
password = "p@s5w0rD"
insecure = true
### Example

default_tags {
tags = {
environment = "default"
}
}
}
```bash
export OPENNEBULA_ENDPOINT="https://example.com:2633/RPC2"
export OPENNEBULA_FLOW_ENDPOINT="https://example.com:2474/RPC2"
export OPENNEBULA_USERNAME="me"
export OPENNEBULA_PASSWORD="p@s5w0rD"
export OPENNEBULA_INSECURE="true"
```

```hcl
provider "opennebula" {}
resource "opennebula_group" "group" {
# ...
Expand All @@ -80,32 +82,45 @@ terraform init
terraform plan
```

!> **Warning:** Hard-coded credentials are not recommended in any Terraform configuration file and should not be commited in a public repository.
## Using tags

### Environment variables
### Resource tags

The provider can also read the following environment variables if no value is set in the the `provider` block attributes:
Some resources can support the `tags` attribute. In consists of a map of key-value elements. In the OpenNebula language, these are called 'attributes'.

* `OPENNEBULA_ENDPOINT`
* `OPENNEBULA_FLOW_ENDPOINT`
* `OPENNEBULA_USERNAME`
* `OPENNEBULA_PASSWORD`
* `OPENNEBULA_INSECURE`
```hcl
tags = {
environment = "production"
}
```

#### Example
### Default tags

```bash
export OPENNEBULA_ENDPOINT="https://example.com:2633/RPC2"
export OPENNEBULA_FLOW_ENDPOINT="https://example.com:2474/RPC2"
export OPENNEBULA_USERNAME="me"
export OPENNEBULA_PASSWORD="p@s5w0rD"
export OPENNEBULA_INSECURE="true"
```
The provider's `default_tags` attribute allows to set default tags for all resources supporting tags.

`default_tags` supports the following arguments:

* `tags` - (Optional) Map of tags.

When a tag is added to a resource, it overrides the one present in `default_tags` from the provider block if the key matches. In the example bellow, the resource will have `environment = "production"` and `deployment_method = "terraform"` tags.

```hcl
provider "opennebula" {}
provider "opennebula" {
endpoint = "https://example.com:2633/RPC2"
default_tags {
tags = {
environment = "default"
deployment_mode = "terraform"
}
}
}
resource "opennebula_group" "group" {
# ...
tags = {
environment = "production"
}
}
```
5 changes: 4 additions & 1 deletion website/docs/r/cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ resource "opennebula_cluster" "example" {
The following arguments are supported:

* `name` - (Required) The name of the cluster.
* `tags` - (Optional) Cluster tags (Key = value)
* `tags` - (Optional) Map of tags (`key=value`) assigned to the resource. Override matching tags present in the `default_tags` atribute when configured in the `provider` block. See [tags usage related documentation](https://registry.terraform.io/providers/OpenNebula/opennebula/latest/docs#using-tags) for more information.
* `template_section` - (Optional) Allow to add a custom vector. See [Template section parameters](#template-section-parameters)

### Template section parameters
Expand Down Expand Up @@ -63,3 +63,6 @@ The following attribute is exported:
```shell
terraform import opennebula_cluster.example 123
```

<https://registry.terraform.io/docs/providers/aws/r/iam_service_linked_role.html>
/docs/providers/aws/r/iam_service_linked_role.html
2 changes: 1 addition & 1 deletion website/docs/r/datastore.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The following arguments are supported:
* `compatible_system_datastore` - (Optional) Specify the compatible system datastores.
* `ceph` - (Optional) See [Ceph](#ceph) section for details.
* `custom` - (Optional) See [Custom](#custom) section for details.
* `tags` - (Optional) Datastore tags (Key = value).
* `tags` - (Optional) Map of tags (`key=value`) assigned to the resource. Override matching tags present in the `default_tags` atribute when configured in the `provider` block. See [tags usage related documentation](https://registry.terraform.io/providers/OpenNebula/opennebula/latest/docs#using-tags) for more information.

### Ceph

Expand Down
10 changes: 5 additions & 5 deletions website/docs/r/group.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ resource "opennebula_group" "example" {
}
lifecycle {
ignore_changes = [
"quotas"
]
}
ignore_changes = [
"quotas"
]
}
}
resource "opennebula_group_quotas" "example" {
Expand Down Expand Up @@ -78,7 +78,7 @@ The following arguments are supported:
* `quotas` - (Deprecated) See [Quotas parameters](#quotas-parameters) below for details. Use `resource_opennebula_group_quotas` instead.
* `sunstone` - (Optional) Allow users and group admins to access specific views. See [Sunstone parameters](#sunstone-parameters) below for details
* `opennebula` - (Optional) OpenNebula core configuration. See [Opennebula parameters](#opennebula-parameters) below for details
* `tags` - (Optional) Group tags (Key = value)
* `tags` - (Optional) Map of tags (`key=value`) assigned to the resource. Override matching tags present in the `default_tags` atribute when configured in the `provider` block. See [tags usage related documentation](https://registry.terraform.io/providers/OpenNebula/opennebula/latest/docs#using-tags) for more information.
* `template_section` - (Optional) Allow to add a custom vector. See [Template section parameters](#template-section-parameters)

### Quotas parameters
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/host.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ The following arguments are supported:
* `cluster_id` - (Optional) ID of the cluster the host is part of.
* `custom` - (Optional) If `type="custom"` this section should be defined, see [Custom](#custom) section for details.
* `overcommit` - (Optional) This section allow to increase the allocatable capacity of the host. See [Overcommit](#overcommit)
* `tags` - (Optional) Host tags (Key = value)
* `tags` - (Optional) Map of tags (`key=value`) assigned to the resource. Override matching tags present in the `default_tags` atribute when configured in the `provider` block. See [tags usage related documentation](https://registry.terraform.io/providers/OpenNebula/opennebula/latest/docs#using-tags) for more information.

### Custom

Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/image.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ The following arguments are supported:
* `driver` - (Optional) OpenNebula Driver to use.
* `format` - (Optional) Image format. Example: `raw`, `qcow2`.
* `group` - (Optional) Name of the group which owns the image. Defaults to the caller primary group.
* `tags` - (Optional) Image tags (Key = value)
* `tags` - (Optional) Map of tags (`key=value`) assigned to the resource. Override matching tags present in the `default_tags` atribute when configured in the `provider` block. See [tags usage related documentation](https://registry.terraform.io/providers/OpenNebula/opennebula/latest/docs#using-tags) for more information.
* `timeout` - (Deprecated) Timeout (in Minutes) for Image availability. Defaults to 10 minutes.
* `template_section` - (Optional) Allow to add a custom vector. See [Template section parameters](#template-section-parameters)

Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/security_group.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ The following arguments are supported:
* `commit` - (Optional) Flag to commit changes on Virtual Machine on security group update. Defaults to `true`.
* `rule` - (Required) List of rules. See [Rule parameters](#rule-parameters) below for details
* `group` - (Optional) Name of the group which owns the security group. Defaults to the caller primary group.
* `tags` - (Optional) Security group tags (Key = Value).
* `tags` - (Optional) Map of tags (`key=value`) assigned to the resource. Override matching tags present in the `default_tags` atribute when configured in the `provider` block. See [tags usage related documentation](https://registry.terraform.io/providers/OpenNebula/opennebula/latest/docs#using-tags) for more information.
* `template_section` - (Optional) Allow to add a custom vector. See [Template section parameters](#template-section-parameters)

### Rule parameters
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/template.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ The following arguments are supported:
* `user_inputs` - (Optional) Ask the user instantiating the template to define the values described.
* `sched_requirements` - (Optional) Scheduling requirements to deploy the resource following specific rule
* `sched_ds_requirements` - (Optional) Storage placement requirements to deploy the resource following specific rule.
* `tags` - (Optional) Template tags (Key = Value).
* `tags` - (Optional) Map of tags (`key=value`) assigned to the resource. Override matching tags present in the `default_tags` atribute when configured in the `provider` block. See [tags usage related documentation](https://registry.terraform.io/providers/OpenNebula/opennebula/latest/docs#using-tags) for more information.
* `template` - (Deprecated) Text describing the OpenNebula template object, in Opennebula's XML string format.
* `lock` - (Optional) Lock the template with a specific lock level. Supported values: `USE`, `MANAGE`, `ADMIN`, `ALL` or `UNLOCK`.
* `template_section` - (Optional) Allow to add a custom vector. See [Template section parameters](#template-section-parameters)
Expand Down
10 changes: 5 additions & 5 deletions website/docs/r/user.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ resource "opennebula_user" "example" {
}
lifecycle {
ignore_changes = [
"quotas"
]
}
ignore_changes = [
"quotas"
]
}
}
resource "opennebula_user_quotas" "example" {
Expand Down Expand Up @@ -84,7 +84,7 @@ The following arguments are supported:
* `groups` - (Optional) List of secondary groups ID of the user.
* `quotas` - (Deprecated) See [Quotas parameters](#quotas-parameters) below for details. Use `resource_opennebula_user_quotas` instead.
* `ssh_public_key` - (Optional) SSH public key.
* `tags` - (Optional) Group tags (Key = value)
* `tags` - (Optional) Map of tags (`key=value`) assigned to the resource. Override matching tags present in the `default_tags` atribute when configured in the `provider` block. See [tags usage related documentation](https://registry.terraform.io/providers/OpenNebula/opennebula/latest/docs#using-tags) for more information.
* `template_section` - (Optional) Allow to add a custom vector. See [Template section parameters](#template-section-parameters)

### Quotas parameters
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/virtual_machine.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ The following arguments are supported:
* `raw` - (Optional) Allow to pass hypervisor level tuning content. See [Raw parameters](#raw-parameters) below for details.
* `sched_requirements` - (Optional) Scheduling requirements to deploy the resource following specific rule.
* `sched_ds_requirements` - (Optional) Storage placement requirements to deploy the resource following specific rule.
* `tags` - (Optional) Virtual Machine tags (Key = Value).
* `tags` - (Optional) Map of tags (`key=value`) assigned to the resource. Override matching tags present in the `default_tags` atribute when configured in the `provider` block. See [tags usage related documentation](https://registry.terraform.io/providers/OpenNebula/opennebula/latest/docs#using-tags) for more information.
* `timeout` - (Deprecated) Timeout (in Minutes) for VM availability. Defaults to 3 minutes.
* `lock` - (Optional) Lock the VM with a specific lock level. Supported values: `USE`, `MANAGE`, `ADMIN`, `ALL` or `UNLOCK`.
* `on_disk_change` - (Optional) Select the behavior for changing disk images. Supported values: `RECREATE` or `SWAP` (default). `RECREATE` forces recreation of the vm and `SWAP` adopts the standard behavior of hot-swapping the disks. NOTE: This property does not affect the behavior of adding new disks.
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/virtual_machine_group.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The following arguments are supported:
* `permissions` - (Optional) Permissions applied on virtual machine group. Defaults to the UMASK in OpenNebula (in UNIX Format: owner-group-other => Use-Manage-Admin.
* `role` - (Required) List of roles. See [Role parameters](#role-parameters) below for details.
* `group` - (Optional) Name of the group which owns the virtual machine group. Defaults to the caller primary group.
* `tags` - (Optional) Virtual Machine group tags.
* `tags` - (Optional) Map of tags (`key=value`) assigned to the resource. Override matching tags present in the `default_tags` atribute when configured in the `provider` block. See [tags usage related documentation](https://registry.terraform.io/providers/OpenNebula/opennebula/latest/docs#using-tags) for more information.
* `template_section` - (Optional) Allow to add a custom vector. See [Template section parameters](#template-section-parameters)

### Role parameters
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/virtual_network.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ The following arguments are supported:
* `ar` - (Deprecated) List of address ranges. See [Address Range Parameters](#address-range-parameters) below for more details. Conflicts with `reservation_vnet` and `reservation_size`.
* `hold_ips` - (Deprecated) Hold Ips from any Address Range of the Virtual Network. The IP must be available to be held`. Conflicts with`reservation_vnet` and `reservation_size`.
* `group` - (Optional) Name of the group which owns the virtual network. Defaults to the caller primary group.
* `tags` - (Optional) Virtual Network tags (Key = Value).
* `tags` - (Optional) Map of tags (`key=value`) assigned to the resource. Override matching tags present in the `default_tags` atribute when configured in the `provider` block. See [tags usage related documentation](https://registry.terraform.io/providers/OpenNebula/opennebula/latest/docs#using-tags) for more information.
* `lock` - (Optional) Lock the virtual network with a specific lock level. Supported values: `USE`, `MANAGE`, `ADMIN`, `ALL` or `UNLOCK`.
* `template_section` - (Optional) Allow to add a custom vector. See [Template section parameters](#template-section-parameters)

Expand Down
1 change: 1 addition & 0 deletions website/docs/r/virtual_router.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ The following arguments are supported:
* `description` - (Optional) Description of the virtual router.
* `lock` - (Optional) Lock the VM with a specific lock level. Supported values: `USE`, `MANAGE`, `ADMIN`, `ALL` or `UNLOCK`.
* `template_section` - (Optional) Allow to add a custom vector. See [Template section parameters](#template-section-parameters)
* `tags` - (Optional) Map of tags (`key=value`) assigned to the resource. Override matching tags present in the `default_tags` atribute when configured in the `provider` block. See [tags usage related documentation](https://registry.terraform.io/providers/OpenNebula/opennebula/latest/docs#using-tags) for more information.

### Template section parameters

Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/virtual_router_instance.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ The following arguments are supported:
* `group` - (Optional) Name of the group which owns the virtual router instance. Defaults to the caller primary group.
* `sched_requirements` - (Optional) Scheduling requirements to deploy the resource following specific rule.
* `sched_ds_requirements` - (Optional) Storage placement requirements to deploy the resource following specific rule.
* `tags` - (Optional) virtual router instance tags (Key = Value).
* `tags` - (Optional) Map of tags (`key=value`) assigned to the resource. Override matching tags present in the `default_tags` atribute when configured in the `provider` block. See [tags usage related documentation](https://registry.terraform.io/providers/OpenNebula/opennebula/latest/docs#using-tags) for more information.
* `lock` - (Optional) Lock the VM with a specific lock level. Supported values: `USE`, `MANAGE`, `ADMIN`, `ALL` or `UNLOCK`.
* `on_disk_change` - (Optional) Select the behavior for changing disk images. Supported values: `RECREATE` or `SWAP` (default). `RECREATE` forces recreation of the vm and `SWAP` adopts the standard behavior of hot-swapping the disks. NOTE: This property does not affect the behavior of adding new disks.

Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/virtual_router_instance_template.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ resource "opennebula_virtual_router_instance_template" "example" {
* `user_inputs` - (Optional) Ask the user instantiating the template to define the values described.
* `sched_requirements` - (Optional) Scheduling requirements to deploy the resource following specific rule
* `sched_ds_requirements` - (Optional) Storage placement requirements to deploy the resource following specific rule.
* `tags` - (Optional) Template tags (Key = Value).
* `tags` - (Optional) Map of tags (`key=value`) assigned to the resource. Override matching tags present in the `default_tags` atribute when configured in the `provider` block. See [tags usage related documentation](https://registry.terraform.io/providers/OpenNebula/opennebula/latest/docs#using-tags) for more information.
* `lock` - (Optional) Lock the template with a specific lock level. Supported values: `USE`, `MANAGE`, `ADMIN`, `ALL` or `UNLOCK`.
* `template_section` - (Optional) Allow to add a custom vector. See [Template section parameters](#template-section-parameters)

Expand Down

0 comments on commit e7bacdf

Please sign in to comment.