Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_hdinsight_*: fix endless password diff #4387

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion azurerm/data_source_hdinsight_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func dataSourceArmHDInsightClusterRead(d *schema.ResourceData, meta interface{})
if kind := def.Kind; kind != nil {
d.Set("kind", strings.ToLower(*kind))
}
if err := d.Set("gateway", azure.FlattenHDInsightsConfigurations(configuration.Value)); err != nil {
if err := d.Set("gateway", azure.FlattenHDInsightsConfigurations(d, configuration.Value)); err != nil {
return fmt.Errorf("Error flattening `gateway`: %+v", err)
}
}
Expand Down
7 changes: 4 additions & 3 deletions azurerm/helpers/azure/hdinsight.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func ExpandHDInsightsConfigurations(input []interface{}) map[string]interface{}
}
}

func FlattenHDInsightsConfigurations(input map[string]*string) []interface{} {
func FlattenHDInsightsConfigurations(d *schema.ResourceData, input map[string]*string) []interface{} {
enabled := false
if v, exists := input["restAuthCredential.isEnabled"]; exists && v != nil {
e, err := strconv.ParseBool(*v)
Expand All @@ -131,9 +131,10 @@ func FlattenHDInsightsConfigurations(input map[string]*string) []interface{} {
username = *v
}

// password is returned as `****` so let's look it up
password := ""
if v, exists := input["restAuthCredential.password"]; exists && v != nil {
password = *v
if v, ok := d.GetOk("gateway.0.password"); ok {
password = v.(string)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this won't be available at import time (and thus'll be empty, which won't be captured during a test) does this require a new resource after importing/a state migration?


return []interface{}{
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_hdinsight_hadoop_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func resourceArmHDInsightHadoopClusterRead(d *schema.ResourceData, meta interfac
return fmt.Errorf("Error flattening `component_version`: %+v", err)
}

if err := d.Set("gateway", azure.FlattenHDInsightsConfigurations(configuration.Value)); err != nil {
if err := d.Set("gateway", azure.FlattenHDInsightsConfigurations(d, configuration.Value)); err != nil {
return fmt.Errorf("Error flattening `gateway`: %+v", err)
}
}
Expand Down
5 changes: 5 additions & 0 deletions azurerm/resource_arm_hdinsight_hadoop_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func TestAccAzureRMHDInsightHadoopCluster_basic(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down Expand Up @@ -105,6 +106,7 @@ func TestAccAzureRMHDInsightHadoopCluster_update(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand All @@ -127,6 +129,7 @@ func TestAccAzureRMHDInsightHadoopCluster_update(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down Expand Up @@ -201,6 +204,7 @@ func TestAccAzureRMHDInsightHadoopCluster_virtualNetwork(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down Expand Up @@ -238,6 +242,7 @@ func TestAccAzureRMHDInsightHadoopCluster_complete(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_hdinsight_hbase_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func resourceArmHDInsightHBaseClusterRead(d *schema.ResourceData, meta interface
return fmt.Errorf("Error flattening `component_version`: %+v", err)
}

if err := d.Set("gateway", azure.FlattenHDInsightsConfigurations(configuration.Value)); err != nil {
if err := d.Set("gateway", azure.FlattenHDInsightsConfigurations(d, configuration.Value)); err != nil {
return fmt.Errorf("Error flattening `gateway`: %+v", err)
}
}
Expand Down
5 changes: 5 additions & 0 deletions azurerm/resource_arm_hdinsight_hbase_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func TestAccAzureRMHDInsightHBaseCluster_basic(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down Expand Up @@ -105,6 +106,7 @@ func TestAccAzureRMHDInsightHBaseCluster_update(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand All @@ -127,6 +129,7 @@ func TestAccAzureRMHDInsightHBaseCluster_update(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down Expand Up @@ -201,6 +204,7 @@ func TestAccAzureRMHDInsightHBaseCluster_virtualNetwork(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down Expand Up @@ -238,6 +242,7 @@ func TestAccAzureRMHDInsightHBaseCluster_complete(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func resourceArmHDInsightInteractiveQueryClusterRead(d *schema.ResourceData, met
return fmt.Errorf("Error flattening `component_version`: %+v", err)
}

if err := d.Set("gateway", azure.FlattenHDInsightsConfigurations(configuration.Value)); err != nil {
if err := d.Set("gateway", azure.FlattenHDInsightsConfigurations(d, configuration.Value)); err != nil {
return fmt.Errorf("Error flattening `gateway`: %+v", err)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func TestAccAzureRMHDInsightInteractiveQueryCluster_basic(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down Expand Up @@ -105,6 +106,7 @@ func TestAccAzureRMHDInsightInteractiveQueryCluster_update(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand All @@ -127,6 +129,7 @@ func TestAccAzureRMHDInsightInteractiveQueryCluster_update(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down Expand Up @@ -201,6 +204,7 @@ func TestAccAzureRMHDInsightInteractiveQueryCluster_virtualNetwork(t *testing.T)
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down Expand Up @@ -238,6 +242,7 @@ func TestAccAzureRMHDInsightInteractiveQueryCluster_complete(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_hdinsight_kafka_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func resourceArmHDInsightKafkaClusterRead(d *schema.ResourceData, meta interface
return fmt.Errorf("Error flattening `component_version`: %+v", err)
}

if err := d.Set("gateway", azure.FlattenHDInsightsConfigurations(configuration.Value)); err != nil {
if err := d.Set("gateway", azure.FlattenHDInsightsConfigurations(d, configuration.Value)); err != nil {
return fmt.Errorf("Error flattening `gateway`: %+v", err)
}
}
Expand Down
5 changes: 5 additions & 0 deletions azurerm/resource_arm_hdinsight_kafka_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func TestAccAzureRMHDInsightKafkaCluster_basic(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down Expand Up @@ -105,6 +106,7 @@ func TestAccAzureRMHDInsightKafkaCluster_update(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand All @@ -127,6 +129,7 @@ func TestAccAzureRMHDInsightKafkaCluster_update(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down Expand Up @@ -201,6 +204,7 @@ func TestAccAzureRMHDInsightKafkaCluster_virtualNetwork(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down Expand Up @@ -238,6 +242,7 @@ func TestAccAzureRMHDInsightKafkaCluster_complete(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_hdinsight_ml_services_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ func resourceArmHDInsightMLServicesClusterRead(d *schema.ResourceData, meta inte
d.Set("tier", string(props.Tier))

if def := props.ClusterDefinition; def != nil {
if err := d.Set("gateway", azure.FlattenHDInsightsConfigurations(configuration.Value)); err != nil {
if err := d.Set("gateway", azure.FlattenHDInsightsConfigurations(d, configuration.Value)); err != nil {
return fmt.Errorf("Error flattening `gateway`: %+v", err)
}

Expand Down
5 changes: 5 additions & 0 deletions azurerm/resource_arm_hdinsight_ml_services_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func TestAccAzureRMHDInsightMLServicesCluster_basic(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down Expand Up @@ -110,6 +111,7 @@ func TestAccAzureRMHDInsightMLServicesCluster_update(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand All @@ -135,6 +137,7 @@ func TestAccAzureRMHDInsightMLServicesCluster_update(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down Expand Up @@ -215,6 +218,7 @@ func TestAccAzureRMHDInsightMLServicesCluster_virtualNetwork(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down Expand Up @@ -255,6 +259,7 @@ func TestAccAzureRMHDInsightMLServicesCluster_complete(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_hdinsight_rserver_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ func resourceArmHDInsightRServerClusterRead(d *schema.ResourceData, meta interfa
d.Set("tier", string(props.Tier))

if def := props.ClusterDefinition; def != nil {
if err := d.Set("gateway", azure.FlattenHDInsightsConfigurations(configuration.Value)); err != nil {
if err := d.Set("gateway", azure.FlattenHDInsightsConfigurations(d, configuration.Value)); err != nil {
return fmt.Errorf("Error flattening `gateway`: %+v", err)
}

Expand Down
5 changes: 5 additions & 0 deletions azurerm/resource_arm_hdinsight_rserver_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func TestAccAzureRMHDInsightRServerCluster_basic(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down Expand Up @@ -110,6 +111,7 @@ func TestAccAzureRMHDInsightRServerCluster_update(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand All @@ -135,6 +137,7 @@ func TestAccAzureRMHDInsightRServerCluster_update(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down Expand Up @@ -215,6 +218,7 @@ func TestAccAzureRMHDInsightRServerCluster_virtualNetwork(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down Expand Up @@ -255,6 +259,7 @@ func TestAccAzureRMHDInsightRServerCluster_complete(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_hdinsight_spark_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func resourceArmHDInsightSparkClusterRead(d *schema.ResourceData, meta interface
return fmt.Errorf("Error flattening `component_version`: %+v", err)
}

if err := d.Set("gateway", azure.FlattenHDInsightsConfigurations(configuration.Value)); err != nil {
if err := d.Set("gateway", azure.FlattenHDInsightsConfigurations(d, configuration.Value)); err != nil {
return fmt.Errorf("Error flattening `gateway`: %+v", err)
}
}
Expand Down
5 changes: 5 additions & 0 deletions azurerm/resource_arm_hdinsight_spark_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func TestAccAzureRMHDInsightSparkCluster_basic(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down Expand Up @@ -105,6 +106,7 @@ func TestAccAzureRMHDInsightSparkCluster_update(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand All @@ -127,6 +129,7 @@ func TestAccAzureRMHDInsightSparkCluster_update(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down Expand Up @@ -201,6 +204,7 @@ func TestAccAzureRMHDInsightSparkCluster_virtualNetwork(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down Expand Up @@ -238,6 +242,7 @@ func TestAccAzureRMHDInsightSparkCluster_complete(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"roles.0.head_node.0.password",
"gateway.0.password",
"roles.0.head_node.0.vm_size",
"roles.0.worker_node.0.password",
"roles.0.worker_node.0.vm_size",
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_hdinsight_storm_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func resourceArmHDInsightStormClusterRead(d *schema.ResourceData, meta interface
return fmt.Errorf("Error flattening `component_version`: %+v", err)
}

if err := d.Set("gateway", azure.FlattenHDInsightsConfigurations(configuration.Value)); err != nil {
if err := d.Set("gateway", azure.FlattenHDInsightsConfigurations(d, configuration.Value)); err != nil {
return fmt.Errorf("Error flattening `gateway`: %+v", err)
}
}
Expand Down
Loading