Skip to content

Commit

Permalink
azurerm_iothub_dps - fix casing of possible values for `ip_filter_r…
Browse files Browse the repository at this point in the history
…ule.target`
  • Loading branch information
myc2h6o committed Aug 10, 2023
1 parent a4d278a commit 8afca8d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions internal/services/iothub/iothub_dps_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ func resourceIotHubDPS() *pluginsdk.Resource {
Type: pluginsdk.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{
azure.TitleCase(string(iotdpsresource.IPFilterTargetTypeAll)),
azure.TitleCase(string(iotdpsresource.IPFilterTargetTypeServiceApi)),
azure.TitleCase(string(iotdpsresource.IPFilterTargetTypeDeviceApi)),
string(iotdpsresource.IPFilterTargetTypeAll),
string(iotdpsresource.IPFilterTargetTypeServiceApi),
string(iotdpsresource.IPFilterTargetTypeDeviceApi),
}, false),
},
},
Expand Down Expand Up @@ -513,7 +513,7 @@ func expandDpsIPFilterRules(d *pluginsdk.ResourceData) *[]iotdpsresource.IPFilte

for _, r := range ipFilterRuleList {
rawRule := r.(map[string]interface{})
ipFilterTargetType := iotdpsresource.IPFilterTargetType(azure.TitleCase(rawRule["target"].(string)))
ipFilterTargetType := iotdpsresource.IPFilterTargetType(rawRule["target"].(string))
rule := &iotdpsresource.IPFilterRule{
FilterName: rawRule["name"].(string),
Action: iotdpsresource.IPFilterActionType(rawRule["action"].(string)),
Expand Down
16 changes: 8 additions & 8 deletions internal/services/iothub/iothub_dps_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ func TestAccIotHubDPS_ipFilterRules(t *testing.T) {
check.That(data.ResourceName).Key("ip_filter_rule.0.name").HasValue("test"),
check.That(data.ResourceName).Key("ip_filter_rule.0.ip_mask").HasValue("10.0.0.0/31"),
check.That(data.ResourceName).Key("ip_filter_rule.0.action").HasValue("Accept"),
check.That(data.ResourceName).Key("ip_filter_rule.0.target").HasValue("All"),
check.That(data.ResourceName).Key("ip_filter_rule.0.target").HasValue("all"),
check.That(data.ResourceName).Key("ip_filter_rule.1.name").HasValue("test2"),
check.That(data.ResourceName).Key("ip_filter_rule.1.ip_mask").HasValue("10.0.2.0/31"),
check.That(data.ResourceName).Key("ip_filter_rule.1.action").HasValue("Accept"),
check.That(data.ResourceName).Key("ip_filter_rule.1.target").HasValue("ServiceApi"),
check.That(data.ResourceName).Key("ip_filter_rule.1.target").HasValue("serviceApi"),
),
},
{
Expand All @@ -149,11 +149,11 @@ func TestAccIotHubDPS_ipFilterRules(t *testing.T) {
check.That(data.ResourceName).Key("ip_filter_rule.0.name").HasValue("test"),
check.That(data.ResourceName).Key("ip_filter_rule.0.ip_mask").HasValue("10.0.0.0/31"),
check.That(data.ResourceName).Key("ip_filter_rule.0.action").HasValue("Reject"),
check.That(data.ResourceName).Key("ip_filter_rule.0.target").HasValue("All"),
check.That(data.ResourceName).Key("ip_filter_rule.0.target").HasValue("all"),
check.That(data.ResourceName).Key("ip_filter_rule.1.name").HasValue("test2"),
check.That(data.ResourceName).Key("ip_filter_rule.1.ip_mask").HasValue("10.0.2.0/31"),
check.That(data.ResourceName).Key("ip_filter_rule.1.action").HasValue("Reject"),
check.That(data.ResourceName).Key("ip_filter_rule.1.target").HasValue("DeviceApi"),
check.That(data.ResourceName).Key("ip_filter_rule.1.target").HasValue("deviceApi"),
check.That(data.ResourceName).Key("public_network_access_enabled").HasValue("false"),
),
},
Expand Down Expand Up @@ -414,14 +414,14 @@ resource "azurerm_iothub_dps" "test" {
name = "test"
ip_mask = "10.0.0.0/31"
action = "Accept"
target = "All"
target = "all"
}
ip_filter_rule {
name = "test2"
ip_mask = "10.0.2.0/31"
action = "Accept"
target = "ServiceApi"
target = "serviceApi"
}
ip_filter_rule {
Expand Down Expand Up @@ -459,14 +459,14 @@ resource "azurerm_iothub_dps" "test" {
name = "test"
ip_mask = "10.0.0.0/31"
action = "Reject"
target = "All"
target = "all"
}
ip_filter_rule {
name = "test2"
ip_mask = "10.0.2.0/31"
action = "Reject"
target = "DeviceApi"
target = "deviceApi"
}
ip_filter_rule {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/iothub_dps.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ An `ip_filter_rule` block supports the following:

* `action` - (Required) The desired action for requests captured by this rule. Possible values are `Accept`, `Reject`

* `target` - (Optional) Target for requests captured by this rule. Possible values are `All`, `DeviceApi` and `ServiceApi`.
* `target` - (Optional) Target for requests captured by this rule. Possible values are `all`, `deviceApi` and `serviceApi`.

## Attributes Reference

Expand Down

0 comments on commit 8afca8d

Please sign in to comment.