Skip to content

Commit

Permalink
Merge pull request #35225 from EttoreFoti/f-aws_iot_indexing_configur…
Browse files Browse the repository at this point in the history
…ation_reserved_shadow_regex

chore(iot_indexing_configuration): fix reserved shadow regex
  • Loading branch information
ewbankkit committed Jan 10, 2024
2 parents ff2e1af + 11c3e6a commit b4cfc37
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .changelog/35225.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_iot_indexing_configuration: Correct plan-time validation of `thing_indexing_configuration.filter.named_shadow_names`
```
2 changes: 1 addition & 1 deletion internal/service/iot/indexing_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func ResourceIndexingConfiguration() *schema.Resource {
Type: schema.TypeString,
ValidateFunc: validation.All(
validation.StringLenBetween(1, 64),
validation.StringMatch(regexache.MustCompile(`^[a-zA-Z0-9:_-]+`), "must contain only alphanumeric characters, underscores, colons, and hyphens"),
validation.StringMatch(regexache.MustCompile(`^[$a-zA-Z0-9:_-]+`), "must contain only alphanumeric characters, underscores, colons, and hyphens (^[$a-zA-Z0-9:_-]+)"),
),
},
},
Expand Down
7 changes: 4 additions & 3 deletions internal/service/iot/indexing_configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ func testAccIndexingConfiguration_allAttributes(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "thing_indexing_configuration.0.named_shadow_indexing_mode", "ON"),
resource.TestCheckResourceAttr(resourceName, "thing_indexing_configuration.0.thing_connectivity_indexing_mode", "STATUS"),
resource.TestCheckResourceAttr(resourceName, "thing_indexing_configuration.0.thing_indexing_mode", "REGISTRY_AND_SHADOW"),
resource.TestCheckResourceAttr(resourceName, "thing_indexing_configuration.0.filter.0.named_shadow_names.#", "1"),
resource.TestCheckResourceAttr(resourceName, "thing_indexing_configuration.0.filter.0.named_shadow_names.0", "thing1shadow"),
resource.TestCheckResourceAttr(resourceName, "thing_indexing_configuration.0.filter.0.named_shadow_names.#", "2"),
resource.TestCheckTypeSetElemAttr(resourceName, "thing_indexing_configuration.0.filter.0.named_shadow_names.*", "thing1shadow"),
resource.TestCheckTypeSetElemAttr(resourceName, "thing_indexing_configuration.0.filter.0.named_shadow_names.*", "$package"),
),
},
{
Expand Down Expand Up @@ -131,7 +132,7 @@ resource "aws_iot_indexing_configuration" "test" {
named_shadow_indexing_mode = "ON"
filter {
named_shadow_names = ["thing1shadow"]
named_shadow_names = ["thing1shadow", "$package"]
}
custom_field {
Expand Down

0 comments on commit b4cfc37

Please sign in to comment.