Skip to content

Commit

Permalink
Patch for use_instance_metadata_hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane Riddell committed Jan 26, 2024
1 parent b9044fc commit b7deb31
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build: validate
@sh -c "'$(CURDIR)/scripts/gobuild.sh'"

docker-build:
@sh -c "'$(CURDIR)/scripts/gobuild_docker.sh'"
@sh -c "'CROSS=1 $(CURDIR)/scripts/gobuild_docker.sh'"

build-rancher: validate-rancher
@sh -c "'$(CURDIR)/scripts/gobuild.sh'"
Expand Down
1 change: 1 addition & 0 deletions docs/resources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,7 @@ The following attributes are exported:
* `name` - (Optional) RKE Cloud Provider name (string)
* `openstack_cloud_provider` - (Optional/Computed) RKE Openstack Cloud Provider config for Cloud Provider [rke-openstack-cloud-provider](https://rancher.com/docs/rke/latest/en/config-options/cloud-providers/openstack/) (list maxitems:1)
* `vsphere_cloud_provider` - (Optional/Computed) RKE Vsphere Cloud Provider config for Cloud Provider [rke-vsphere-cloud-provider](https://rancher.com/docs/rke/latest/en/config-options/cloud-providers/vsphere/) Extra argument `name` is required on `virtual_center` configuration. (list maxitems:1)
* `use_instance_metadata_hostname` - (Optional/Computed) (bool)

##### `aws_cloud_provider`

Expand Down
5 changes: 5 additions & 0 deletions rancher2/schema_cluster_rke_config_cloud_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ func clusterRKEConfigCloudProviderFields() map[string]*schema.Schema {
Schema: clusterRKEConfigCloudProviderVsphereFields(),
},
},
"use_instance_metadata_hostname": {
Type: schema.TypeBool,
Optional: true,
Computed: true,
},
}
return s
}
8 changes: 8 additions & 0 deletions rancher2/structure_cluster_rke_config_cloud_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ func flattenClusterRKEConfigCloudProvider(in *managementClient.CloudProvider, p
obj["vsphere_cloud_provider"] = vsphereProvider
}

if in.UseInstanceMetadataHostname != nil {
obj["use_instance_metadata_hostname"] = *in.UseInstanceMetadataHostname
}

return []interface{}{obj}, nil
}

Expand Down Expand Up @@ -122,5 +126,9 @@ func expandClusterRKEConfigCloudProvider(p []interface{}) (*managementClient.Clo
obj.VsphereCloudProvider = vsphereProvider
}

if v, ok := in["use_instance_metadata_hostname"].(bool); ok {
obj.UseInstanceMetadataHostname = &v
}

return obj, nil
}
10 changes: 6 additions & 4 deletions rancher2/structure_cluster_rke_config_cloud_provider_z_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@ func init() {
},
}
testClusterRKEConfigCloudProviderConf = &managementClient.CloudProvider{
CustomCloudProvider: "XXXXXXXXXXXX",
Name: "test",
CustomCloudProvider: "XXXXXXXXXXXX",
Name: "test",
UseInstanceMetadataHostname: newTrue(),
}
testClusterRKEConfigCloudProviderInterface = []interface{}{
map[string]interface{}{
"custom_cloud_provider": "XXXXXXXXXXXX",
"name": "test",
"custom_cloud_provider": "XXXXXXXXXXXX",
"name": "test",
"use_instance_metadata_hostname": true,
},
}
}
Expand Down

0 comments on commit b7deb31

Please sign in to comment.