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

New Data Source: aws_mq_broker #3163

Merged
merged 2 commits into from
Apr 30, 2018
Merged

Conversation

loivis
Copy link
Contributor

@loivis loivis commented Jan 28, 2018

Fixes #2856

@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Jan 28, 2018
@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Jan 28, 2018
@bflad bflad added new-data-source Introduces a new data source. service/mq Issues and PRs that pertain to the mq service. labels Jan 28, 2018
Copy link
Contributor

@bflad bflad left a 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.

return resourceAwsMqBrokerRead(d, meta)
}

func getBrokerId(meta interface{}, name string) (id string) {
Copy link
Contributor

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) {
Copy link
Contributor

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.

Copy link
Contributor Author

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.
Copy link
Contributor

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)

return ""
}
for _, broker := range out.BrokerSummaries {
if *broker.BrokerName == name {
Copy link
Contributor

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()

@bflad bflad added the waiting-response Maintainers are waiting on response from community or contributor. label Apr 26, 2018
@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Apr 26, 2018
@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Apr 27, 2018
@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Apr 27, 2018
@loivis
Copy link
Contributor Author

loivis commented Apr 27, 2018

⎇  make fmt; and echo > aws/debug.log ; and make testacc TEST=./aws TESTARGS='-run=TestAccDataSourceAWSMqBroker_basic'
gofmt -w $(find . -name '*.go' |grep -v vendor)
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccDataSourceAWSMqBroker_basic -timeout 120m
=== RUN   TestAccDataSourceAWSMqBroker_basic
--- PASS: TestAccDataSourceAWSMqBroker_basic (1298.40s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	1298.454s

Copy link
Contributor

@bflad bflad left a 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)

@bflad bflad removed the waiting-response Maintainers are waiting on response from community or contributor. label Apr 30, 2018
@bflad bflad added this to the v1.17.0 milestone Apr 30, 2018
@bflad bflad merged commit dd309e3 into hashicorp:master Apr 30, 2018
bflad added a commit that referenced this pull request Apr 30, 2018
@loivis loivis deleted the 2856-d-mq-broker branch May 1, 2018 14:15
@bflad
Copy link
Contributor

bflad commented May 2, 2018

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.

@ghost
Copy link

ghost commented Apr 6, 2020

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!

@ghost ghost locked and limited conversation to collaborators Apr 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-data-source Introduces a new data source. service/mq Issues and PRs that pertain to the mq service. size/L Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Please create the data source 'aws_mq_broker'
2 participants