diff --git a/aws/resource_aws_mq_broker.go b/aws/resource_aws_mq_broker.go index cb0705b2506..0a2425916a4 100644 --- a/aws/resource_aws_mq_broker.go +++ b/aws/resource_aws_mq_broker.go @@ -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, diff --git a/aws/resource_aws_mq_broker_test.go b/aws/resource_aws_mq_broker_test.go index 8e46e1a9ab8..ed8b4c1314d 100644 --- a/aws/resource_aws_mq_broker_test.go +++ b/aws/resource_aws_mq_broker_test.go @@ -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$`)), @@ -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$`)), @@ -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$`)), @@ -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$`)), @@ -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$`)), diff --git a/aws/structure.go b/aws/structure.go index 5cd1b9c6578..7fc6e8f1ea1 100644 --- a/aws/structure.go +++ b/aws/structure.go @@ -3980,6 +3980,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 } diff --git a/website/docs/r/mq_broker.html.markdown b/website/docs/r/mq_broker.html.markdown index 700fac0f97c..0bbc1d6e543 100644 --- a/website/docs/r/mq_broker.html.markdown +++ b/website/docs/r/mq_broker.html.markdown @@ -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. @@ -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`