diff --git a/.changelog/32593.txt b/.changelog/32593.txt new file mode 100644 index 000000000000..d44e5cdc76bf --- /dev/null +++ b/.changelog/32593.txt @@ -0,0 +1,3 @@ +```release-note:bug +data-source/aws_mq_broker: Fix `setting user: Invalid address to set` errors +``` \ No newline at end of file diff --git a/internal/service/mq/broker_data_source.go b/internal/service/mq/broker_data_source.go index 2eafd5d12773..212409a2634d 100644 --- a/internal/service/mq/broker_data_source.go +++ b/internal/service/mq/broker_data_source.go @@ -225,7 +225,6 @@ func DataSourceBroker() *schema.Resource { "user": { Type: schema.TypeSet, Computed: true, - Set: resourceUserHash, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "console_access": { @@ -237,9 +236,13 @@ func DataSourceBroker() *schema.Resource { Elem: &schema.Schema{Type: schema.TypeString}, Computed: true, }, + "replication_user": { + Type: schema.TypeBool, + Computed: true, + }, "username": { Type: schema.TypeString, - Required: true, + Computed: true, }, }, }, diff --git a/internal/service/mq/broker_data_source_test.go b/internal/service/mq/broker_data_source_test.go index fa5bdcb4dd78..62c12e6425cd 100644 --- a/internal/service/mq/broker_data_source_test.go +++ b/internal/service/mq/broker_data_source_test.go @@ -67,64 +67,7 @@ func TestAccMQBrokerDataSource_basic(t *testing.T) { } func testAccBrokerDataSourceConfig_base(rName string) string { - return fmt.Sprintf(` -data "aws_availability_zones" "available" { - state = "available" - - filter { - name = "opt-in-status" - values = ["opt-in-not-required"] - } -} - -resource "aws_vpc" "test" { - cidr_block = "10.0.0.0/16" - - tags = { - Name = %[1]q - } -} - -resource "aws_internet_gateway" "test" { - vpc_id = aws_vpc.test.id -} - -resource "aws_route_table" "test" { - vpc_id = aws_vpc.test.id - - route { - cidr_block = "0.0.0.0/0" - gateway_id = aws_internet_gateway.test.id - } -} - -resource "aws_subnet" "test" { - count = 2 - cidr_block = "10.0.${count.index}.0/24" - availability_zone = data.aws_availability_zones.available.names[count.index] - vpc_id = aws_vpc.test.id - - tags = { - Name = %[1]q - } -} - -resource "aws_route_table_association" "test" { - count = 2 - subnet_id = aws_subnet.test[count.index].id - route_table_id = aws_route_table.test.id -} - -resource "aws_security_group" "test" { - count = 2 - - vpc_id = aws_vpc.test.id - - tags = { - Name = %[1]q - } -} - + return acctest.ConfigCompose(testAccBrokerConfig_baseCustomVPC(rName), fmt.Sprintf(` resource "aws_mq_configuration" "test" { name = %[1]q engine_type = "ActiveMQ" @@ -176,7 +119,7 @@ resource "aws_mq_broker" "test" { depends_on = [aws_internet_gateway.test] } -`, rName) +`, rName)) } func testAccBrokerDataSourceConfig_byID(rName string) string { diff --git a/internal/service/mq/broker_test.go b/internal/service/mq/broker_test.go index baa026a53750..a5746d90fc47 100644 --- a/internal/service/mq/broker_test.go +++ b/internal/service/mq/broker_test.go @@ -1551,7 +1551,7 @@ resource "aws_mq_broker" "test" { `, rName, version, cfgName, cfgBody) } -func testAccBrokerConfig_allFieldsCustomVPC(rName, version, cfgName, cfgBody, tz string) string { +func testAccBrokerConfig_baseCustomVPC(rName string) string { return acctest.ConfigCompose(acctest.ConfigVPCWithSubnets(rName, 2), fmt.Sprintf(` resource "aws_internet_gateway" "test" { vpc_id = aws_vpc.test.id @@ -1591,7 +1591,11 @@ resource "aws_security_group" "test" { Name = %[1]q } } +`, rName)) +} +func testAccBrokerConfig_allFieldsCustomVPC(rName, version, cfgName, cfgBody, tz string) string { + return acctest.ConfigCompose(testAccBrokerConfig_baseCustomVPC(rName), fmt.Sprintf(` resource "aws_mq_configuration" "test" { name = %[3]q engine_type = "ActiveMQ"