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_cosmosdb_cassandra_datacenter - expose seed_node_ip_addresses property #24076

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@ func resourceCassandraDatacenter() *pluginsdk.Resource {
Optional: true,
Default: true,
},

"seed_node_ip_addresses": {
Type: pluginsdk.TypeList,
Computed: true,
Elem: &pluginsdk.Schema{
Type: pluginsdk.TypeString,
ValidateFunc: validation.IsIPv4Address,
Copy link
Member

Choose a reason for hiding this comment

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

since this is computed we don't need to validate this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

},
},
},
}

Expand Down Expand Up @@ -226,6 +235,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
Expand Down Expand Up @@ -319,3 +332,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
}
2 changes: 2 additions & 0 deletions website/docs/r/cosmosdb_cassandra_datacenter.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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_address` - A list of IP Address for the seed nodes in this Cassandra Datacenter.
Copy link
Member

@catriona-m catriona-m Nov 30, 2023

Choose a reason for hiding this comment

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

Suggested change
* `seed_node_ip_address` - A list of IP Address for the seed nodes in this Cassandra Datacenter.
* `seed_node_ip_addresses` - A list of IP Address for the seed nodes in this Cassandra Datacenter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated


## Timeouts

The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions:
Expand Down
Loading