hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.81k stars 9.16k forks source link

[Docs]: data.aws_msk_bootstrap_brokers has wrong name in example and misleading attribute documentation #35748

Open cobbr2 opened 8 months ago

cobbr2 commented 8 months ago

Documentation Link

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/msk_bootstrap_brokers

Description

The example should read

data "aws_msk_bootstrap_brokers" "example" {

NOT: data "aws_msk_cluster" "example" {

All of the attribute descriptions that say "One or more DNS Names..." are false. I don't know what they return, but those attributes must allow for the fact that any of those lists can be empty; perhaps they return NULL in those cases, but that should be documented. Those lists should only be populated if the cluster actually supports that particular authentication method.

For serverless clusters, the only attributes that could have one or more entries would be bootstrap_brokers_sasl_iam , since that's the only type supported.

For provisioned clusters, any of them could be empty.

Furthermore:

And calling sort is required for the provisioned case -- the API will return the values in a randomized order which changes on every call. That means the data value is constantly changing, so will trigger spurious updates unless you sort the values. I think that's a minor bug in the data source code; I'd have it sort (and return real lists), though that will now have compatibility problems.

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 8 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

stefanfreitag commented 7 months ago

The documentation has already been updated in respect to data "aws_msk_bootstrap_brokers" "example" {. The fixed documentation is available here The relevant commit is this one

Concerning

All of the attribute descriptions that say "One or more DNS Names..." are false. I don't know what they return, but those attributes must allow for the fact that any of those lists can be empty; perhaps they return NULL in those cases, but that should be documented. Those lists should only be populated if the cluster actually supports that particular authentication method.

there is additional documentation on the resource, for example

One or more DNS names (or IP addresses) and SASL IAM port pairs. [...] This attribute will have a value if encryption_info.0.encryption_in_transit.0.client_broker is set to TLS_PLAINTEXT or TLS and client_authentication.0.sasl.0.iam is set to true.

Would it be already helpful to add the "This attribute will..." information, so that it is clear that not all fields will be populated?