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

Add ip_address property to aws_mq_broker instances list #6103

Merged
merged 5 commits into from
Oct 10, 2018
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions aws/resource_aws_mq_broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ func resourceAwsMqBroker() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"ip_address": {
Type: schema.TypeString,
Computed: true,
},
"endpoints": {
Type: schema.TypeList,
Computed: true,
Expand Down
10 changes: 10 additions & 0 deletions aws/resource_aws_mq_broker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ func TestAccAWSMqBroker_basic(t *testing.T) {
resource.TestCheckResourceAttr("aws_mq_broker.test", "instances.#", "1"),
resource.TestMatchResourceAttr("aws_mq_broker.test", "instances.0.console_url",
regexp.MustCompile(`^https://[a-f0-9-]+\.mq.[a-z0-9-]+.amazonaws.com:8162$`)),
resource.TestMatchResourceAttr("aws_mq_broker.test", "instances.0.ip_address",
regexp.MustCompile(`^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$`)),
resource.TestCheckResourceAttr("aws_mq_broker.test", "instances.0.endpoints.#", "5"),
resource.TestMatchResourceAttr("aws_mq_broker.test", "instances.0.endpoints.0", regexp.MustCompile(`^ssl://[a-z0-9-\.]+:61617$`)),
resource.TestMatchResourceAttr("aws_mq_broker.test", "instances.0.endpoints.1", regexp.MustCompile(`^amqp\+ssl://[a-z0-9-\.]+:5671$`)),
Expand Down Expand Up @@ -348,6 +350,8 @@ func TestAccAWSMqBroker_allFieldsDefaultVpc(t *testing.T) {
resource.TestCheckResourceAttr("aws_mq_broker.test", "instances.#", "2"),
resource.TestMatchResourceAttr("aws_mq_broker.test", "instances.0.console_url",
regexp.MustCompile(`^https://[a-f0-9-]+\.mq.[a-z0-9-]+.amazonaws.com:8162$`)),
resource.TestMatchResourceAttr("aws_mq_broker.test", "instances.0.ip_address",
regexp.MustCompile(`^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$`)),
resource.TestCheckResourceAttr("aws_mq_broker.test", "instances.0.endpoints.#", "5"),
resource.TestMatchResourceAttr("aws_mq_broker.test", "instances.0.endpoints.0", regexp.MustCompile(`^ssl://[a-z0-9-\.]+:61617$`)),
resource.TestMatchResourceAttr("aws_mq_broker.test", "instances.0.endpoints.1", regexp.MustCompile(`^amqp\+ssl://[a-z0-9-\.]+:5671$`)),
Expand All @@ -356,6 +360,8 @@ func TestAccAWSMqBroker_allFieldsDefaultVpc(t *testing.T) {
resource.TestMatchResourceAttr("aws_mq_broker.test", "instances.0.endpoints.4", regexp.MustCompile(`^wss://[a-z0-9-\.]+:61619$`)),
resource.TestMatchResourceAttr("aws_mq_broker.test", "instances.1.console_url",
regexp.MustCompile(`^https://[a-f0-9-]+\.mq.[a-z0-9-]+.amazonaws.com:8162$`)),
resource.TestMatchResourceAttr("aws_mq_broker.test", "instances.1.ip_address",
regexp.MustCompile(`^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$`)),
resource.TestCheckResourceAttr("aws_mq_broker.test", "instances.1.endpoints.#", "5"),
resource.TestMatchResourceAttr("aws_mq_broker.test", "instances.1.endpoints.0", regexp.MustCompile(`^ssl://[a-z0-9-\.]+:61617$`)),
resource.TestMatchResourceAttr("aws_mq_broker.test", "instances.1.endpoints.1", regexp.MustCompile(`^amqp\+ssl://[a-z0-9-\.]+:5671$`)),
Expand Down Expand Up @@ -450,6 +456,8 @@ func TestAccAWSMqBroker_allFieldsCustomVpc(t *testing.T) {
resource.TestCheckResourceAttr("aws_mq_broker.test", "instances.#", "2"),
resource.TestMatchResourceAttr("aws_mq_broker.test", "instances.0.console_url",
regexp.MustCompile(`^https://[a-f0-9-]+\.mq.[a-z0-9-]+.amazonaws.com:8162$`)),
resource.TestMatchResourceAttr("aws_mq_broker.test", "instances.0.ip_address",
regexp.MustCompile(`^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$`)),
resource.TestCheckResourceAttr("aws_mq_broker.test", "instances.0.endpoints.#", "5"),
resource.TestMatchResourceAttr("aws_mq_broker.test", "instances.0.endpoints.0", regexp.MustCompile(`^ssl://[a-z0-9-\.]+:61617$`)),
resource.TestMatchResourceAttr("aws_mq_broker.test", "instances.0.endpoints.1", regexp.MustCompile(`^amqp\+ssl://[a-z0-9-\.]+:5671$`)),
Expand All @@ -458,6 +466,8 @@ func TestAccAWSMqBroker_allFieldsCustomVpc(t *testing.T) {
resource.TestMatchResourceAttr("aws_mq_broker.test", "instances.0.endpoints.4", regexp.MustCompile(`^wss://[a-z0-9-\.]+:61619$`)),
resource.TestMatchResourceAttr("aws_mq_broker.test", "instances.1.console_url",
regexp.MustCompile(`^https://[a-f0-9-]+\.mq.[a-z0-9-]+.amazonaws.com:8162$`)),
resource.TestMatchResourceAttr("aws_mq_broker.test", "instances.1.ip_address",
regexp.MustCompile(`^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$`)),
resource.TestCheckResourceAttr("aws_mq_broker.test", "instances.1.endpoints.#", "5"),
resource.TestMatchResourceAttr("aws_mq_broker.test", "instances.1.endpoints.0", regexp.MustCompile(`^ssl://[a-z0-9-\.]+:61617$`)),
resource.TestMatchResourceAttr("aws_mq_broker.test", "instances.1.endpoints.1", regexp.MustCompile(`^amqp\+ssl://[a-z0-9-\.]+:5671$`)),
Expand Down
3 changes: 3 additions & 0 deletions aws/structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -3965,6 +3965,9 @@ func flattenMqBrokerInstances(instances []*mq.BrokerInstance) []interface{} {
if len(instance.Endpoints) > 0 {
m["endpoints"] = aws.StringValueSlice(instance.Endpoints)
}
if instance.IpAddress != nil {
m["ip_address"] = *instance.IpAddress
}
l[i] = m
}

Expand Down
3 changes: 2 additions & 1 deletion website/docs/r/mq_broker.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ The following arguments are supported:
* `configuration` - (Optional) Configuration of the broker. See below.
* `deployment_mode` - (Optional) The deployment mode of the broker. Supported: `SINGLE_INSTANCE` and `ACTIVE_STANDBY_MULTI_AZ`. Defaults to `SINGLE_INSTANCE`.
* `engine_type` - (Required) The type of broker engine. Currently, Amazon MQ supports only `ActiveMQ`.
* `engine_version` - (Required) The version of the broker engine. Currently, Amazon MQ supports only `5.15.0`.
* `engine_version` - (Required) The version of the broker engine. Currently, Amazon MQ supports only `5.15.0` or `5.15.6`.
* `host_instance_type` - (Required) The broker's instance type. e.g. `mq.t2.micro` or `mq.m4.large`
* `publicly_accessible` - (Optional) Whether to enable connections from applications outside of the VPC that hosts the broker's subnets.
* `security_groups` - (Required) The list of security group IDs assigned to the broker.
Expand Down Expand Up @@ -92,6 +92,7 @@ In addition to all arguments above, the following attributes are exported:
* `arn` - The ARN of the broker.
* `instances` - A list of information about allocated brokers (both active & standby).
* `instances.0.console_url` - The URL of the broker's [ActiveMQ Web Console](http://activemq.apache.org/web-console.html).
* `instances.0.ip_address` - The IP Address of the broker.
* `instances.0.endpoints` - The broker's wire-level protocol endpoints in the following order & format referenceable e.g. as `instances.0.endpoints.0` (SSL):
* `ssl://broker-id.mq.us-west-2.amazonaws.com:61617`
* `amqp+ssl://broker-id.mq.us-west-2.amazonaws.com:5671`
Expand Down