Skip to content

Commit

Permalink
fix: missing vds info with r/cluster import
Browse files Browse the repository at this point in the history
Address missing `vds` info with `r/cluster` import.

Signed-off-by: Jared Burns <jared.burns@broadcom.com>
  • Loading branch information
burnsjared0415 authored and tenthirtyam committed Oct 9, 2024
1 parent 41f0fc9 commit f5a2527
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
7 changes: 1 addition & 6 deletions internal/cluster/cluster_operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ func FlattenCluster(ctx context.Context, clusterObj *models.Cluster, apiClient *
if err != nil {
return nil, err
}

result["host"] = flattenedHostSpecs

return &result, nil
Expand All @@ -400,15 +401,9 @@ func ImportCluster(ctx context.Context, data *schema.ResourceData, apiClient *cl
_ = data.Set("is_default", clusterObj.IsDefault)
_ = data.Set("is_stretched", clusterObj.IsStretched)
flattenedVdsSpecs := getFlattenedVdsSpecsForRefs(clusterObj.VdsSpecs)
if err != nil {
return nil, err
}
_ = data.Set("vds", flattenedVdsSpecs)

flattenedHostSpecs, err := getFlattenedHostSpecsForRefs(ctx, clusterObj.Hosts, apiClient)

Check failure on line 406 in internal/cluster/cluster_operations.go

View workflow job for this annotation

GitHub Actions / Build

ineffectual assignment to err (ineffassign)
if err != nil {
return nil, err
}
_ = data.Set("host", flattenedHostSpecs)

//get all domains and find our cluster to set the "domain_id" attribute, because
Expand Down
1 change: 1 addition & 0 deletions internal/provider/data_source_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func TestAccDataSourceVcfCluster(t *testing.T) {
resource.TestCheckResourceAttrSet("data.vcf_cluster.cluster1", "primary_datastore_type"),
resource.TestCheckResourceAttrSet("data.vcf_cluster.cluster1", "is_default"),
resource.TestCheckResourceAttrSet("data.vcf_cluster.cluster1", "is_stretched"),
resource.TestCheckResourceAttrSet("data.vcf_cluster.cluster1", "vds"),
resource.TestCheckResourceAttrSet("data.vcf_cluster.cluster1", "host.0.id"),
resource.TestCheckResourceAttrSet("data.vcf_cluster.cluster1", "host.0.host_name"),
resource.TestCheckResourceAttrSet("data.vcf_cluster.cluster1", "host.0.ip_address"),
Expand Down
4 changes: 4 additions & 0 deletions internal/provider/resource_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func TestAccResourceVcfClusterCreate(t *testing.T) {
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "primary_datastore_type"),
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "is_default"),
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "is_stretched"),
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "vds"),
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "host.0.id"),
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "host.1.id"),
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "host.2.id"),
Expand Down Expand Up @@ -117,6 +118,7 @@ func TestAccResourceVcfClusterFull(t *testing.T) {
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "primary_datastore_type"),
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "is_default"),
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "is_stretched"),
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "vds"),
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "host.0.id"),
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "host.1.id"),
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "host.2.id"),
Expand Down Expand Up @@ -152,6 +154,7 @@ func TestAccResourceVcfClusterFull(t *testing.T) {
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "primary_datastore_type"),
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "is_default"),
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "is_stretched"),
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "vds"),
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "host.0.id"),
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "host.1.id"),
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "host.2.id"),
Expand Down Expand Up @@ -181,6 +184,7 @@ func TestAccResourceVcfClusterFull(t *testing.T) {
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "primary_datastore_type"),
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "is_default"),
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "is_stretched"),
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "vds"),
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "host.0.id"),
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "host.1.id"),
resource.TestCheckResourceAttrSet("vcf_cluster.cluster1", "host.2.id"),
Expand Down

0 comments on commit f5a2527

Please sign in to comment.