Skip to content

Commit

Permalink
Merge pull request #1236 from thatmidwesterncoder/backport_7527894
Browse files Browse the repository at this point in the history
[Backport release/v3] Revert "Remove OpenStack keypair_name references"
  • Loading branch information
thatmidwesterncoder authored Sep 26, 2023
2 parents a9770ee + f59cc95 commit d94d5b6
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/resources/machine_config_v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ The following attributes are exported:
* `image_name` - (Required+) OpenStack image name to use for the instance. Conflicts with `image_id` (string)
* `insecure` - (Optional) Disable TLS credential checking. Default `false` (bool)
* `ip_version` - (Optional) OpenStack version of IP address assigned for the machine Default `4` (string)
* `keypair_name` - (Optional) OpenStack keypair to use to SSH to the instance (string)
* `net_id` - (Required+) OpenStack network id the machine will be connected on. Conflicts with `net_name` (string)
* `net_name` - (Required+) OpenStack network name the machine will be connected on. Conflicts with `net_id` (string)
* `nova_network` - (Optional) Use the nova networking services instead of neutron (string)
Expand All @@ -291,6 +292,7 @@ The following attributes are exported:
* `volume_device_path` - (Optional) OpenStack volume device path (attaching). Applicable only when `boot_from_volume` is `true`. Omit for auto `/dev/vdb`. (string)
> **Note:**: `Required+` denotes that either the _name or _id is required but you cannot use both.
> **Note:**: `Required++` denotes that either the _name or _id is required unless `application_credential_id` is defined.
> **Note for OpenStack users:**: `keypair_name` is required to be in the schema even if there are no references in rancher itself
### `vsphere_config`

Expand Down
3 changes: 3 additions & 0 deletions docs/resources/node_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ The following attributes are exported:
* `image_name` - (Required*) OpenStack image name to use for the instance. Conflicts with `image_id` (string)
* `insecure` - (Optional) Disable TLS credential checking. Default `false` (bool)
* `ip_version` - (Optional) OpenStack version of IP address assigned for the machine Default `4` (string)
* `keypair_name` - (Optional) OpenStack keypair to use to SSH to the instance (string)
* `net_id` - (Required*) OpenStack network id the machine will be connected on. Conflicts with `net_name` (string)
* `net_name` - (Required*) OpenStack network name the machine will be connected on. Conflicts with `net_id` (string)
* `nova_network` - (Optional) Use the nova networking services instead of neutron (string)
Expand All @@ -410,6 +411,8 @@ The following attributes are exported:
> **Note:**: `Required**` denotes that either the _name or _id is required unless `application_credential_id` is defined.
> **Note for OpenStack users:**: `keypair_name` is required to be in the schema even if there are no references in rancher itself
### `vsphere_config`

#### Arguments
Expand Down
4 changes: 4 additions & 0 deletions rancher2/schema_machine_config_v2_openstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ func machineConfigV2OpenstackFields() map[string]*schema.Schema {
Optional: true,
Default: "4",
},
"keypair_name": {
Type: schema.TypeString,
Optional: true,
},
"net_id": {
Type: schema.TypeString,
Optional: true,
Expand Down
4 changes: 4 additions & 0 deletions rancher2/schema_node_template_openstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ func openstackConfigFields() map[string]*schema.Schema {
Optional: true,
Default: "4",
},
"keypair_name": {
Type: schema.TypeString,
Optional: true,
},
"net_id": {
Type: schema.TypeString,
Optional: true,
Expand Down
4 changes: 4 additions & 0 deletions rancher2/structure_machine_config_v2_openstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func flattenMachineConfigV2Openstack(in *MachineConfigV2Openstack) []interface{}
obj["image_name"] = in.ImageName
obj["insecure"] = in.Insecure
obj["ip_version"] = in.IPVersion
obj["keypair_name"] = in.KeypairName
obj["net_id"] = in.NetID
obj["net_name"] = in.NetName
obj["nova_network"] = in.NovaNetwork
Expand Down Expand Up @@ -186,6 +187,9 @@ func expandMachineConfigV2Openstack(p []interface{}, source *MachineConfigV2) *M
if v, ok := in["ip_version"].(string); ok && len(v) > 0 {
obj.IPVersion = v
}
if v, ok := in["keypair_name"].(string); ok && len(v) > 0 {
obj.KeypairName = v
}
if v, ok := in["net_id"].(string); ok && len(v) > 0 {
obj.NetID = v
}
Expand Down
4 changes: 4 additions & 0 deletions rancher2/structure_node_template_openstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func flattenOpenstackConfig(in *openstackConfig) []interface{} {
obj["image_name"] = in.ImageName
obj["insecure"] = in.Insecure
obj["ip_version"] = in.IPVersion
obj["keypair_name"] = in.KeypairName
obj["net_id"] = in.NetID
obj["net_name"] = in.NetName
obj["nova_network"] = in.NovaNetwork
Expand Down Expand Up @@ -106,6 +107,9 @@ func expandOpenstackConfig(p []interface{}) *openstackConfig {
if v, ok := in["ip_version"].(string); ok && len(v) > 0 {
obj.IPVersion = v
}
if v, ok := in["keypair_name"].(string); ok && len(v) > 0 {
obj.KeypairName = v
}
if v, ok := in["net_id"].(string); ok && len(v) > 0 {
obj.NetID = v
}
Expand Down

0 comments on commit d94d5b6

Please sign in to comment.