Skip to content

Commit

Permalink
Merge pull request #3 from ionutbalutoiu/development
Browse files Browse the repository at this point in the history
More managed resources, code improvements, and docs updated
  • Loading branch information
ionutbalutoiu committed Jul 7, 2021
2 parents b8bea94 + a495604 commit 81bcd52
Show file tree
Hide file tree
Showing 51 changed files with 2,991 additions and 1,021 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ website/node_modules
*.backup
./*.tfstate
.terraform.tfstate.lock.info
.terraform.lock.hcl
.terraform/
*.log
*.bak
Expand Down
29 changes: 19 additions & 10 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,25 @@

## Data Sources

* [maas_fabric](/docs/data_sources/maas_fabric.md)
* [maas_vlan](/docs/data_sources/maas_vlan.md)
* [maas_subnet](/docs/data_sources/maas_subnet.md)
1. [maas_fabric](/docs/data_sources/maas_fabric.md)
1. [maas_vlan](/docs/data_sources/maas_vlan.md)
1. [maas_subnet](/docs/data_sources/maas_subnet.md)

## Resources

* [maas_tag](/docs/resources/maas_tag.md)
* [maas_vm_host](/docs/resources/maas_vm_host.md)
* [maas_vm_host_machine](/docs/resources/maas_vm_host_machine.md)
* [maas_machine](/docs/resources/maas_machine.md)
* [maas_network_interface_physical](/docs/resources/maas_network_interface_physical.md)
* [maas_network_interface_link](/docs/resources/maas_network_interface_link.md)
* [maas_instance](/docs/resources/maas_instance.md)
1. [maas_instance](/docs/resources/maas_instance.md)
1. [maas_vm_host](/docs/resources/maas_vm_host.md)
1. [maas_vm_host_machine](/docs/resources/maas_vm_host_machine.md)
1. [maas_machine](/docs/resources/maas_machine.md)
1. [maas_network_interface_physical](/docs/resources/maas_network_interface_physical.md)
1. [maas_network_interface_link](/docs/resources/maas_network_interface_link.md)
1. [maas_fabric](/docs/resources/maas_fabric.md)
1. [maas_vlan](/docs/resources/maas_vlan.md)
1. [maas_subnet](/docs/resources/maas_subnet.md)
1. [maas_subnet_ip_range](/docs/resources/maas_subnet_ip_range.md)
1. [maas_dns_domain](/docs/resources/maas_dns_domain.md)
1. [maas_dns_record](/docs/resources/maas_dns_record.md)
1. [maas_space](/docs/resources/maas_space.md)
1. [maas_block_device](/docs/resources/maas_block_device.md)
1. [maas_tag](/docs/resources/maas_tag.md)
1. [maas_user](/docs/resources/maas_user.md)
22 changes: 14 additions & 8 deletions docs/data_sources/maas_fabric.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
# `maas_fabric`
# Data Source: maas_fabric

Get an existing MAAS fabric.
Provides details about an existing MAAS network fabric.

Example:
## Example Usage

```hcl
```terraform
data "maas_fabric" "default" {
name = "maas"
}
```

Parameters:
## Argument Reference

| Name | Type | Required | Description
| ---- | ---- | -------- | -----------
| `name` | `string` | `true` | The fabric name.
The following arguments are supported:

* `name` - (Required) The fabric name.

## Attributes Reference

In addition to all arguments above, the following attributes are exported:

* `id` - The fabric ID.
46 changes: 26 additions & 20 deletions docs/data_sources/maas_subnet.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
# `maas_subnet`
# Data Source: maas_subnet

Fetches details about an existing MAAS subnet.
Provides details about an existing MAAS network subnet.

Example:
## Example Usage

```hcl
data "maas_fabric" "default" {
name = "maas"
```terraform
data "maas_subnet" "vid10" {
cidr = "10.10.0.0/16"
}
```

data "maas_vlan" "default" {
fabric_id = data.maas_fabric.default.id
vid = 0
}
## Argument Reference

data "maas_subnet" "pxe" {
cidr = "10.121.0.0/16"
vlan_id = data.maas_vlan.default.id
}
```
The following arguments are supported:

* `cidr` - (Requried) The subnet CIDR.

## Attributes Reference

Parameters:
In addition to all arguments above, the following attributes are exported:

| Name | Type | Required | Description
| ---- | ---- | -------- | -----------
| `cidr` | `string` | `true` | The network CIDR for this subnet.
| `vlan_id` | `int` | `false` | The ID of the VLAN this subnet belongs to. This is the unique identifier set by MAAS for the VLAN resource, not the actual VLAN traffic segregation ID.
* `id` - The subnet ID.
* `fabric` - The subnet fabric.
* `vid` - The subnet VLAN traffic segregation ID.
* `name` - The subnet name.
* `rdns_mode` - How reverse DNS is handled for this subnet. It can have one of the following values:
* `0` - Disabled, no reverse zone is created.
* `1` - Enabled, generate reverse zone.
* `2` - RFC2317, extends `1` to create the necessary parent zone with the appropriate CNAME resource records for the network, if the network is small enough to require the support described in RFC2317.
* `allow_dns` - Boolean value that indicates if the MAAS DNS resolution is enabled for this subnet.
* `allow_proxy` - Boolean value that indicates if `maas-proxy` allows requests from this subnet.
* `gateway_ip` - Gateway IP address for the subnet.
* `dns_servers` - List of IP addresses set as DNS servers for the subnet.
37 changes: 21 additions & 16 deletions docs/data_sources/maas_vlan.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
# `maas_vlan`
# Data Source: maas_vlan

Get an existing MAAS VLAN.
Provides details about an existing MAAS VLAN.

Example:
## Example Usage

```hcl
data "maas_fabric" "default" {
name = "maas"
}
data "maas_vlan" "default" {
fabric_id = data.maas_fabric.default.id
vid = 0
```terraform
data "maas_vlan" "vid10" {
fabric = data.maas_fabric.default.id
vlan = 10
}
```

Parameters:
## Argument Reference

The following arguments are supported:

* `fabric` - (Required) The fabric identifier (ID or name) for the VLAN.
* `vlan` - (Required) The VLAN identifier (ID or traffic segregation ID).

## Attributes Reference

In addition to all arguments above, the following attributes are exported:

| Name | Type | Required | Description
| ---- | ---- | -------- | -----------
| `fabric_id` | `int` | `true` | The ID of the fabric containing the VLAN.
| `vid` | `int` | `true` | The VLAN traffic segregation ID.
* `mtu` - The MTU used on the VLAN.
* `dhcp_on` - Boolean value indicating if DHCP is enabled on the VLAN.
* `name` - The VLAN name.
* `space` - The VLAN space.
72 changes: 72 additions & 0 deletions docs/resources/maas_block_device.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@

# Resource: maas_block_device

Provides a resource to manage MAAS machines' block devices.

## Example Usage

```terraform
resource "maas_block_device" "vdb" {
machine = maas_machine.virsh_vm2.id
name = "vdb"
id_path = "/dev/vdb"
size_gigabytes = 27
tags = [
"ssd",
]
partitions {
size_gigabytes = 10
fs_type = "ext4"
label = "media"
mount_point = "/media"
}
partitions {
size_gigabytes = 15
fs_type = "ext4"
mount_point = "/storage"
}
}
```

## Argument Reference

The following arguments are supported:

* `machine` - (Required) The machine identifier (system ID, hostname, or FQDN) that owns the block device.
* `name` - (Required) The block device name.
* `size_gigabytes` - (Required) The size of the block device (given in GB).
* `block_size` - (Optional) The block size of the block device. Defaults to `512`.
* `is_boot_device` - (Optional) Boolean value indicating if the block device is set as the boot device.
* `partitions` - (Optional) List of partition resources created for the new block device. Parameters defined below. This argument is processed in [attribute-as-blocks mode](https://www.terraform.io/docs/configuration/attr-as-blocks.html). And, it is computed if it's not given.
* `model` - (Optional) Model of the block device. Used in conjunction with `serial` argument. Conflicts with `id_path`. This argument is computed if it's not given.
* `serial` - (Optional) Serial number of the block device. Used in conjunction with `model` argument. Conflicts with `id_path`. This argument is computed if it's not given.
* `id_path` - (Optional) Only used if `model` and `serial` cannot be provided. This should be a path that is fixed and doesn't change depending on the boot order or kernel version. This argument is computed if it's not given.
* `tags` - (Optional) A set of tag names assigned to the new block device. This argument is computed if it's not given.

### partitions

* `size_gigabytes` - (Required) The partition size (given in GB).
* `bootable` - (Optional) Boolean value indicating if the partition is set as bootable.
* `tags` - (Optional) The tags assigned to the new block device partition.
* `fs_type` - (Optional) The file system type (e.g. `ext4`). If this is not set, the partition is unformatted.
* `label` - (Optional) The label assigned if the partition is formatted.
* `mount_point` - (Optional) The mount point used. If this is not set, the partition is not mounted. This is used only the partition is formatted.
* `mount_options` - (Optional) The options used for the partition mount.

## Attributes Reference

In addition to all arguments above, the following attributes are exported:

* `id` - Block device ID.
* `uuid` - Block device UUID.
* `path` - Block device path.

## Import

Block devices can be imported with the machine identifier (system ID, hostname, or FQDN) and the block device identifier (ID or name). e.g.

```shell
terraform import maas_block_device.vdb machine-06:vdb
```
37 changes: 37 additions & 0 deletions docs/resources/maas_dns_domain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

# Resource: maas_dns_domain

Provides a resource to manage MAAS DNS domains.

## Example Usage

```terraform
resource "maas_dns_domain" "cloudbase" {
name = "cloudbase"
ttl = 3600
authoritative = true
}
```

## Argument Reference

The following arguments are supported:

* `name` - (Required) The name of the new DNS domain.
* `ttl` - (Optional) The default TTL for the new DNS domain.
* `authoritative` - (Optional) Boolean value indicating if the new DNS domain is authoritative. Defaults to `false`.
* `is_default` - (Optional) Boolean value indicating if the new DNS domain will be set as the default in the MAAS environment. Defaults to `false`.

## Attributes Reference

In addition to all arguments above, the following attributes are exported:

* `id` - The DNS domain ID.

## Import

DNS domains can be imported using their ID or name. e.g.

```shell
terraform import maas_dns_domain.cloudbase cloudbase
```
39 changes: 39 additions & 0 deletions docs/resources/maas_dns_record.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

# Resource: maas_dns_record

Provides a resource to manage MAAS DNS domain records.

## Example Usage

```terraform
resource "maas_dns_record" "test_a" {
type = "A/AAAA"
data = "10.99.11.33"
fqdn = "test-a.${maas_dns_domain.cloudbase.name}"
}
```

## Argument Reference

The following arguments are supported:

* `type` - (Required) The DNS record type. Valid options are: `A/AAAA`, `CNAME`, `MX`, `NS`, `SRV`, `SSHFP`, `TXT`.
* `data` - (Required) The data set for the new DNS record.
* `name` - (Optional) The new DNS record resource name. Used in conjunction with `domain`. It conflicts with `fqdn` argument.
* `domain` - (Optional) The domain of the new DNS record. Used in conjunction with `name`. It conflicts with `fqdn` argument.
* `fqdn` - (Optional) The fully qualified domain name of the new DNS record. This contains the name and the domain of the new DNS record. It conflicts with `name` and `domain` arguments.
* `ttl` - (Optional) The TTL of the new DNS record.

## Attributes Reference

In addition to all arguments above, the following attributes are exported:

* `id` - The DNS record ID.

## Import

DNS records can be imported using the type and the identifier (ID or FQDN). e.g.

```shell
terraform import maas_dns_record.test_a A/AAAA:test-a.cloudbase
```
32 changes: 32 additions & 0 deletions docs/resources/maas_fabric.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

# Resource: maas_fabric

Provides a resource to manage MAAS network fabrics.

## Example Usage

```terraform
resource "maas_fabric" "tf_fabric" {
name = "tf-fabric"
}
```

## Argument Reference

The following arguments are supported:

* `name` - (Required) The fabric name.

## Attributes Reference

In addition to all arguments above, the following attributes are exported:

* `id` - The fabric ID.

## Import

An existing network fabric can be imported using its name or ID. e.g.

```shell
terraform import maas_fabric.tf_fabric tf-fabric
```
Loading

0 comments on commit 81bcd52

Please sign in to comment.