-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
New Data Source: aws_mq_broker #3163
Conversation
f51f8f0
to
7247957
Compare
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 for this @loivis! See below for some initial feedback.
aws/data_source_aws_mq_broker.go
Outdated
return resourceAwsMqBrokerRead(d, meta) | ||
} | ||
|
||
func getBrokerId(meta interface{}, name string) (id string) { |
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 return the err
from conn.ListBrokers()
👍 It might be easiest to just remove the indirection of this new function.
"github.com/hashicorp/terraform/helper/resource" | ||
) | ||
|
||
func TestAccDataSourceAWSMqBroker_basic(t *testing.T) { |
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.
=== RUN TestAccDataSourceAWSMqBroker_basic
--- FAIL: TestAccDataSourceAWSMqBroker_basic (1300.05s)
testing.go:518: Step 0 error: Check failed: 2 error(s) occurred:
* Check 3/28 error: data.aws_mq_broker.by_id: Attribute 'configuration.#' expected "2", got "1"
* Check 17/28 error: data.aws_mq_broker.by_name: Attribute 'configuration.#' expected "2", got "1"
FYI you might also want to check out resource.TestCheckResourceAttrPair()
to compare the resource attributes to the data source attributes, rather than trying to figure out values here.
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.
Nice 👍 I saw it once or twice but didn't check what it really does.
|
||
## Attributes Reference | ||
|
||
See the [MQ Broker](/docs/providers/aws/r/mq_broker.html) for details on the returned attributes. |
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.
Nitpick: Should probably change the link text to the below so its a little clearer where its going:
[`aws_mq_broker` resource](/docs/providers/aws/r/mq_broker.html)
aws/data_source_aws_mq_broker.go
Outdated
return "" | ||
} | ||
for _, broker := range out.BrokerSummaries { | ||
if *broker.BrokerName == 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.
To prevent potential panics, we should probably wrap these in aws.StringValue()
7247957
to
4718aad
Compare
776b4d5
to
0a7bf1d
Compare
0a7bf1d
to
7445c43
Compare
|
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.
Looks good, thanks! 🚀
1 test passed (all tests)
=== RUN TestAccDataSourceAWSMqBroker_basic
--- PASS: TestAccDataSourceAWSMqBroker_basic (1201.57s)
This has been released in version 1.17.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Fixes #2856