-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
azurerm_app_service
ip_restriction
- support for name
& priority
#6705
Merged
jackofallops
merged 10 commits into
hashicorp:master
from
aqche:app_service_ip_restriction_name_and_priority
May 7, 2020
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
27e5d73
add name and priority to ip_restriction for app_service
aqche 88f3786
make priority computed
aqche 1270e90
changes for review feedback
aqche b3c16f4
update max allowed priority
aqche c3da179
make dfault explicit
aqche f1caf09
address review
aqche 581e48e
formatting
aqche 4c3ce82
formatting
aqche fc209f9
formatting
aqche a6362e4
fix broken test param for remoteDebugging
jackofallops File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -514,6 +514,53 @@ func TestAccAzureRMAppService_oneIpRestriction(t *testing.T) { | |
}) | ||
} | ||
|
||
func TestAccAzureRMAppService_completeIpRestriction(t *testing.T) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we have an additional test that updates an app_service by adding, then removing, a 2nd |
||
data := acceptance.BuildTestData(t, "azurerm_app_service", "test") | ||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { acceptance.PreCheck(t) }, | ||
Providers: acceptance.SupportedProviders, | ||
CheckDestroy: testCheckAzureRMAppServiceDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccAzureRMAppService_completeIpRestriction(data), | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMAppServiceExists(data.ResourceName), | ||
resource.TestCheckResourceAttr(data.ResourceName, "site_config.0.ip_restriction.#", "1"), | ||
resource.TestCheckResourceAttr(data.ResourceName, "site_config.0.ip_restriction.0.ip_address", "10.10.10.10/32"), | ||
resource.TestCheckResourceAttr(data.ResourceName, "site_config.0.ip_restriction.0.name", "test-restriction"), | ||
resource.TestCheckResourceAttr(data.ResourceName, "site_config.0.ip_restriction.0.priority", "123"), | ||
), | ||
}, | ||
data.ImportStep(), | ||
{ | ||
Config: testAccAzureRMAppService_manyCompleteIpRestrictions(data), | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMAppServiceExists(data.ResourceName), | ||
resource.TestCheckResourceAttr(data.ResourceName, "site_config.0.ip_restriction.#", "2"), | ||
resource.TestCheckResourceAttr(data.ResourceName, "site_config.0.ip_restriction.0.ip_address", "10.10.10.10/32"), | ||
resource.TestCheckResourceAttr(data.ResourceName, "site_config.0.ip_restriction.0.name", "test-restriction"), | ||
resource.TestCheckResourceAttr(data.ResourceName, "site_config.0.ip_restriction.0.priority", "123"), | ||
resource.TestCheckResourceAttr(data.ResourceName, "site_config.0.ip_restriction.1.ip_address", "20.20.20.0/24"), | ||
resource.TestCheckResourceAttr(data.ResourceName, "site_config.0.ip_restriction.1.name", "test-restriction-2"), | ||
resource.TestCheckResourceAttr(data.ResourceName, "site_config.0.ip_restriction.1.priority", "1234"), | ||
), | ||
}, | ||
data.ImportStep(), | ||
{ | ||
Config: testAccAzureRMAppService_completeIpRestriction(data), | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMAppServiceExists(data.ResourceName), | ||
resource.TestCheckResourceAttr(data.ResourceName, "site_config.0.ip_restriction.#", "1"), | ||
resource.TestCheckResourceAttr(data.ResourceName, "site_config.0.ip_restriction.0.ip_address", "10.10.10.10/32"), | ||
resource.TestCheckResourceAttr(data.ResourceName, "site_config.0.ip_restriction.0.name", "test-restriction"), | ||
resource.TestCheckResourceAttr(data.ResourceName, "site_config.0.ip_restriction.0.priority", "123"), | ||
), | ||
}, | ||
data.ImportStep(), | ||
}, | ||
}) | ||
} | ||
|
||
func TestAccAzureRMAppService_oneVNetSubnetIpRestriction(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azurerm_app_service", "test") | ||
resource.ParallelTest(t, resource.TestCase{ | ||
|
@@ -2582,6 +2629,90 @@ resource "azurerm_app_service" "test" { | |
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger) | ||
} | ||
|
||
func testAccAzureRMAppService_completeIpRestriction(data acceptance.TestData) string { | ||
return fmt.Sprintf(` | ||
provider "azurerm" { | ||
features {} | ||
} | ||
|
||
resource "azurerm_resource_group" "test" { | ||
name = "acctestRG-%d" | ||
location = "%s" | ||
} | ||
|
||
resource "azurerm_app_service_plan" "test" { | ||
name = "acctestASP-%d" | ||
location = azurerm_resource_group.test.location | ||
resource_group_name = azurerm_resource_group.test.name | ||
|
||
sku { | ||
tier = "Standard" | ||
size = "S1" | ||
} | ||
} | ||
|
||
resource "azurerm_app_service" "test" { | ||
name = "acctestAS-%d" | ||
location = azurerm_resource_group.test.location | ||
resource_group_name = azurerm_resource_group.test.name | ||
app_service_plan_id = azurerm_app_service_plan.test.id | ||
|
||
site_config { | ||
ip_restriction { | ||
ip_address = "10.10.10.10/32" | ||
name = "test-restriction" | ||
priority = 123 | ||
} | ||
} | ||
} | ||
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger) | ||
} | ||
|
||
func testAccAzureRMAppService_manyCompleteIpRestrictions(data acceptance.TestData) string { | ||
return fmt.Sprintf(` | ||
provider "azurerm" { | ||
features {} | ||
} | ||
|
||
resource "azurerm_resource_group" "test" { | ||
name = "acctestRG-%d" | ||
location = "%s" | ||
} | ||
|
||
resource "azurerm_app_service_plan" "test" { | ||
name = "acctestASP-%d" | ||
location = azurerm_resource_group.test.location | ||
resource_group_name = azurerm_resource_group.test.name | ||
|
||
sku { | ||
tier = "Standard" | ||
size = "S1" | ||
} | ||
} | ||
|
||
resource "azurerm_app_service" "test" { | ||
name = "acctestAS-%d" | ||
location = azurerm_resource_group.test.location | ||
resource_group_name = azurerm_resource_group.test.name | ||
app_service_plan_id = azurerm_app_service_plan.test.id | ||
|
||
site_config { | ||
ip_restriction { | ||
ip_address = "10.10.10.10/32" | ||
name = "test-restriction" | ||
priority = 123 | ||
} | ||
|
||
ip_restriction { | ||
ip_address = "20.20.20.0/24" | ||
name = "test-restriction-2" | ||
priority = 1234 | ||
} | ||
} | ||
} | ||
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger) | ||
} | ||
|
||
func testAccAzureRMAppService_oneVNetSubnetIpRestriction(data acceptance.TestData) string { | ||
return fmt.Sprintf(` | ||
provider "azurerm" { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as @sebader noted, priority defaults to 65000 when not provided. Should we make that an explicit default or let it be computed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure where the default of 65000 is injected in this case. Might be in the Go SDK? Since in CLI, Powershell and the portal the parameter must be manually specified, there is no default there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So might actually be better so explicitly set it?!