diff --git a/docs/data-sources/foreman_subnet.md b/docs/data-sources/foreman_subnet.md index 3957e3f..dd2090a 100644 --- a/docs/data-sources/foreman_subnet.md +++ b/docs/data-sources/foreman_subnet.md @@ -40,11 +40,11 @@ The following attributes are exported: - `httpboot_id` - HTTPBoot Proxy ID to use within this subnet - `ipam` - IP address auto-suggestion for this subnet. Valid values include: `"DHCP"`, `"Internal DB"`, `"Random DB"`,`"None"`. - `mask` - Netmask for this subnet. -- `mtu` - MTU value for the subnet +- `mtu` - MTU value for the subnet. - `name` - Name of a subnetwork. - `network` - Subnet network. - `network_address` - The Subnets CIDR in the format 169.254.0.0/16 -- `network_type` - Type or protocol, IPv4 or IPv6, defaults to IPv4. +- `network_type` - Type or protocol, IPv4 or IPv6. - `template_id` - Template HTTP(S) Proxy ID to use within this subnet - `tftp_id` - TFTP Proxy ID to use within this subnet - `to` - Ending IP address for IP auto suggestion. diff --git a/docs/resources/foreman_subnet.md b/docs/resources/foreman_subnet.md index 66cbb79..15403b5 100644 --- a/docs/resources/foreman_subnet.md +++ b/docs/resources/foreman_subnet.md @@ -10,9 +10,13 @@ Foreman representation of a subnetwork. ``` # Autogenerated example with required keys resource "foreman_subnet" "example" { + boot_mode = "DHCP" + ipam = "DHCP" mask = "255.255.255.0" + mtu = "1500" name = "10.228.247.0 BO1" network = "10.228.247.0" + network_type = "IPv4" } ``` @@ -22,7 +26,7 @@ resource "foreman_subnet" "example" { The following arguments are supported: - `bmc_id` - (Optional) BMC Proxy ID to use within this subnet -- `boot_mode` - (Optional) Default boot mode for instances assigned to this subnet. Values include: `"Static"`, `"DHCP"`. +- `boot_mode` - (Required) Default boot mode for instances assigned to this subnet. Values include: `"Static"`, `"DHCP"`. - `description` - (Optional) Description of the subnet - `dhcp_id` - (Optional) DHCP Proxy ID to use within this subnet - `dns_primary` - (Optional) Primary DNS server for this subnet. @@ -31,13 +35,13 @@ The following arguments are supported: - `from` - (Optional) Start IP address for IP auto suggestion. - `gateway` - (Optional) Gateway server to use when connecting/communicating to anything not on the same network. - `httpboot_id` - (Optional) HTTPBoot Proxy ID to use within this subnet -- `ipam` - (Optional) IP address auto-suggestion for this subnet. Valid values include: `"DHCP"`, `"Internal DB"`, `"Random DB"`,`"None"`. +- `ipam` - (Required) IP address auto-suggestion for this subnet. Valid values include: `"DHCP"`, `"Internal DB"`, `"Random DB"`,`"None"`. - `mask` - (Required) Netmask for this subnet. -- `mtu` - (Optional) MTU value for the subnet +- `mtu` - (Required) MTU value for the subnet. - `name` - (Required) Subnet name. - `network` - (Required) Subnet network. - `network_address` - (Optional) The Subnets CIDR in the format 169.254.0.0/16 -- `network_type` - (Optional) Type or protocol, IPv4 or IPv6, defaults to IPv4. +- `network_type` - (Required) Type or protocol, IPv4 or IPv6. - `template_id` - (Optional) Template HTTP(S) Proxy ID to use within this subnet - `tftp_id` - (Optional) TFTP Proxy ID to use within this subnet - `to` - (Optional) Ending IP address for IP auto suggestion. @@ -60,11 +64,11 @@ The following attributes are exported: - `httpboot_id` - HTTPBoot Proxy ID to use within this subnet - `ipam` - IP address auto-suggestion for this subnet. Valid values include: `"DHCP"`, `"Internal DB"`, `"Random DB"`,`"None"`. - `mask` - Netmask for this subnet. -- `mtu` - MTU value for the subnet +- `mtu` - MTU value for the subnet. - `name` - Subnet name. - `network` - Subnet network. - `network_address` - The Subnets CIDR in the format 169.254.0.0/16 -- `network_type` - Type or protocol, IPv4 or IPv6, defaults to IPv4. +- `network_type` - Type or protocol, IPv4 or IPv6. - `template_id` - Template HTTP(S) Proxy ID to use within this subnet - `tftp_id` - TFTP Proxy ID to use within this subnet - `to` - Ending IP address for IP auto suggestion. diff --git a/foreman/resource_foreman_subnet.go b/foreman/resource_foreman_subnet.go index 8ef0c5b..61cd17f 100644 --- a/foreman/resource_foreman_subnet.go +++ b/foreman/resource_foreman_subnet.go @@ -92,7 +92,7 @@ func resourceForemanSubnet() *schema.Resource { "ipam": { Type: schema.TypeString, - Optional: true, + Required: true, ValidateFunc: validation.StringInSlice([]string{ "DHCP", "Internal DB", @@ -100,10 +100,13 @@ func resourceForemanSubnet() *schema.Resource { "None", // NOTE(ALL): false - do not ignore case when comparing values }, false), - Description: "IP address auto-suggestion for this subnet. Valid " + - "values include: `\"DHCP\"`, `\"Internal DB\"`, `\"Random DB\"`,`\"None\"`.", + Description: fmt.Sprintf( + "IP address auto-suggestion for this subnet. Valid "+ + "values include: `\"DHCP\"`, `\"Internal DB\"`, `\"Random DB\"`,`\"None\"`."+ + "%s \"DHCP\"", + autodoc.MetaExample, + ), }, - "from": { Type: schema.TypeString, Optional: true, @@ -120,14 +123,18 @@ func resourceForemanSubnet() *schema.Resource { "boot_mode": { Type: schema.TypeString, - Optional: true, + Required: true, ValidateFunc: validation.StringInSlice([]string{ "Static", "DHCP", // NOTE(ALL): false - do not ignore case when comparing values }, false), - Description: "Default boot mode for instances assigned to this subnet. " + - "Values include: `\"Static\"`, `\"DHCP\"`.", + Description: fmt.Sprintf( + "Default boot mode for instances assigned to this subnet. "+ + "Values include: `\"Static\"`, `\"DHCP\"`."+ + "%s \"DHCP\"", + autodoc.MetaExample, + ), }, "network_address": { Type: schema.TypeString, @@ -140,9 +147,13 @@ func resourceForemanSubnet() *schema.Resource { Description: "VLAN id that is in use in the subnet", }, "mtu": { - Type: schema.TypeInt, - Optional: true, - Description: "MTU value for the subnet", + Type: schema.TypeInt, + Required: true, + Description: fmt.Sprintf( + "MTU value for the subnet. "+ + "%s \"1500\"", + autodoc.MetaExample, + ), }, "template_id": { Type: schema.TypeInt, @@ -179,12 +190,16 @@ func resourceForemanSubnet() *schema.Resource { }, "network_type": { Type: schema.TypeString, - Optional: true, + Required: true, ValidateFunc: validation.StringInSlice([]string{ "IPv4", "IPv6", }, false), - Description: "Type or protocol, IPv4 or IPv6, defaults to IPv4.", + Description: fmt.Sprintf( + "Type or protocol, IPv4 or IPv6. "+ + "%s \"IPv4\"", + autodoc.MetaExample, + ), }, "description": { Type: schema.TypeString,