Skip to content

Commit

Permalink
Merge pull request #32593 from hashicorp/b-d/aws_mq_broker.replicatio…
Browse files Browse the repository at this point in the history
…n_user

d/aws_mq_broker: Add `user.replication_user`
  • Loading branch information
ewbankkit committed Jul 19, 2023
2 parents c706d95 + 75ede86 commit 39769c6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 62 deletions.
3 changes: 3 additions & 0 deletions .changelog/32593.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
data-source/aws_mq_broker: Fix `setting user: Invalid address to set` errors
```
7 changes: 5 additions & 2 deletions internal/service/mq/broker_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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,
},
},
},
Expand Down
61 changes: 2 additions & 59 deletions internal/service/mq/broker_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -176,7 +119,7 @@ resource "aws_mq_broker" "test" {
depends_on = [aws_internet_gateway.test]
}
`, rName)
`, rName))
}

func testAccBrokerDataSourceConfig_byID(rName string) string {
Expand Down
6 changes: 5 additions & 1 deletion internal/service/mq/broker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 39769c6

Please sign in to comment.