diff --git a/docs/resources/cluster.md b/docs/resources/cluster.md index 0a61c6af..034e3e16 100644 --- a/docs/resources/cluster.md +++ b/docs/resources/cluster.md @@ -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` diff --git a/rancher2/schema_cluster_rke_config_cloud_provider.go b/rancher2/schema_cluster_rke_config_cloud_provider.go index d2c25749..71f36036 100644 --- a/rancher2/schema_cluster_rke_config_cloud_provider.go +++ b/rancher2/schema_cluster_rke_config_cloud_provider.go @@ -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 } diff --git a/rancher2/structure_cluster_rke_config_cloud_provider.go b/rancher2/structure_cluster_rke_config_cloud_provider.go index 123e341f..6b3d4d09 100644 --- a/rancher2/structure_cluster_rke_config_cloud_provider.go +++ b/rancher2/structure_cluster_rke_config_cloud_provider.go @@ -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 } @@ -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 } diff --git a/rancher2/structure_cluster_rke_config_cloud_provider_z_test.go b/rancher2/structure_cluster_rke_config_cloud_provider_z_test.go index f8a90274..aeba2a2c 100644 --- a/rancher2/structure_cluster_rke_config_cloud_provider_z_test.go +++ b/rancher2/structure_cluster_rke_config_cloud_provider_z_test.go @@ -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, }, } }