-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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_postgresql_cluster
: add server names information t…
#25240
Conversation
I also just noticed, that this stackoverflow mentions this problem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @reastyn. I left some comments around consistency, would you mind taking a look at those? Once they're addressed we can take another look through.
@@ -636,3 +659,19 @@ func flattenMaintenanceWindow(input *clusters.MaintenanceWindow) []MaintenanceWi | |||
}, | |||
} | |||
} | |||
|
|||
func formatServerNames(input *[]clusters.ServerNameItem) []ServerNameItem { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor but for consistency could we rename this to
func formatServerNames(input *[]clusters.ServerNameItem) []ServerNameItem { | |
func flattenServerNames(input *[]clusters.ServerNameItem) []ServerNameItem { |
if input == nil { | ||
return nil | ||
} | ||
|
||
var output []ServerNameItem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be setting an empty value into state instead of nil here
if input == nil { | |
return nil | |
} | |
var output []ServerNameItem | |
var output []ServerNameItem | |
if input == nil { | |
return output | |
} | |
@@ -304,6 +310,22 @@ func (r CosmosDbPostgreSQLClusterResource) Attributes() map[string]*pluginsdk.Sc | |||
Type: pluginsdk.TypeString, | |||
Computed: true, | |||
}, | |||
"server_names": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can shorten this to servers
, _names
is implicit and one of the attributes in the block is already called name
"server_names": { | |
"servers": { |
@@ -99,6 +99,8 @@ In addition to the Arguments listed above - the following Attributes are exporte | |||
|
|||
* `earliest_restore_time` - The earliest restore point time (ISO8601 format) for the Azure Cosmos DB for PostgreSQL Cluster. | |||
|
|||
* `server_names` - The name of the servers and its fully qualified domain name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a block it should be
* `server_names` - The name of the servers and its fully qualified domain name | |
* `servers` - A `servers` block as defined below. | |
--- | |
A `servers` block exports the following: | |
* `fqdn` - The Fully Qualified Domain Name of the server. | |
* `name` - The name of the server. |
Thanks a lot for taking a look, the issues you mentioned should be resolved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @reastyn LGTM 👍
Thank you @reastyn ! I am currently doing a hack/patch to get this very very basic property via
|
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
I have tried to deploy CosmosDB Postgres, but with some of the updates they added a random hexadecimal string to coordinator domain (from c-acctestcluster240313222245905652.postgres.cosmos.azure.com -> c-acctestcluster240313222245905652.efyg2q5iqomwly.postgres.cosmos.azure.com). When I wanted to use this domain to be passed to other modules I couldn't as I can derive the domain from the service name. Therefore I just propagated the server_names property to the attributes, which means it can be used as for example a output.
Testing Logs/Evidence
I added the attribute to the basic test as seen in internal/services/cosmos/cosmosdb_postgresql_cluster_resource_test.go and successfully ran test locally.
Change Log
azurerm_cosmosdb_postgresql_cluster
- add fully qualified domain name to attributesThis is a (please select all that apply):