diff --git a/internal/services/cosmos/cosmosdb_cassandra_datacenter_resource.go b/internal/services/cosmos/cosmosdb_cassandra_datacenter_resource.go index 2eeacd8682b5..829a90858194 100644 --- a/internal/services/cosmos/cosmosdb_cassandra_datacenter_resource.go +++ b/internal/services/cosmos/cosmosdb_cassandra_datacenter_resource.go @@ -109,6 +109,14 @@ func resourceCassandraDatacenter() *pluginsdk.Resource { Optional: true, Default: true, }, + + "seed_node_ip_addresses": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, }, } @@ -226,6 +234,10 @@ func resourceCassandraDatacenterRead(d *pluginsdk.ResourceData, meta interface{} d.Set("disk_sku", props.DiskSku) d.Set("sku_name", props.Sku) d.Set("availability_zones_enabled", props.AvailabilityZone) + + if err := d.Set("seed_node_ip_addresses", flattenCassandraDatacenterSeedNodes(props.SeedNodes)); err != nil { + return fmt.Errorf("setting `seed_node_ip_addresses`: %+v", err) + } } } return nil @@ -319,3 +331,18 @@ func cassandraDatacenterStateRefreshFunc(ctx context.Context, client *managedcas return nil, "", fmt.Errorf("unable to read provisioning state") } } + +func flattenCassandraDatacenterSeedNodes(input *[]managedcassandras.SeedNode) []interface{} { + results := make([]interface{}, 0) + if input == nil { + return results + } + + for _, item := range *input { + if item.IPAddress != nil { + results = append(results, item.IPAddress) + } + } + + return results +} diff --git a/internal/services/cosmos/cosmosdb_cassandra_datacenter_resource_test.go b/internal/services/cosmos/cosmosdb_cassandra_datacenter_resource_test.go index c23b0597b5e9..124caa4c6e4e 100644 --- a/internal/services/cosmos/cosmosdb_cassandra_datacenter_resource_test.go +++ b/internal/services/cosmos/cosmosdb_cassandra_datacenter_resource_test.go @@ -29,6 +29,7 @@ func testAccCassandraDatacenter_basic(t *testing.T) { Check: acceptance.ComposeAggregateTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), check.That(data.ResourceName).Key("sku_name").IsNotEmpty(), + check.That(data.ResourceName).Key("seed_node_ip_addresses.#").HasValue("3"), ), }, data.ImportStep(), diff --git a/website/docs/r/cosmosdb_cassandra_datacenter.html.markdown b/website/docs/r/cosmosdb_cassandra_datacenter.html.markdown index e2549b332d90..a57504a87056 100644 --- a/website/docs/r/cosmosdb_cassandra_datacenter.html.markdown +++ b/website/docs/r/cosmosdb_cassandra_datacenter.html.markdown @@ -112,6 +112,8 @@ In addition to the Arguments listed above - the following Attributes are exporte * `id` - The ID of the Cassandra Datacenter. +* `seed_node_ip_addresses` - A list of IP Address for the seed nodes in this Cassandra Datacenter. + ## Timeouts The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: