From b074d0ef3677335b54f8db6fbcd57e43ebf95922 Mon Sep 17 00:00:00 2001 From: Magnus Niemann Date: Tue, 16 Jun 2020 13:44:45 +0200 Subject: [PATCH 01/13] Merged build files. --- azure-pipelines.yml | 95 +++++++++++++++++++++++++++++++++++++++++++++ version/version.go | 2 +- 2 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 000000000000..44267a3b6ecd --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,95 @@ +trigger: +- master +- feature/* +- release/* +- fix/* + +variables: +- name: repo + value: terraform.providers.azurerm +- name: release_branch + value: v2.14.0 +- name: GO111MODULE + value: on +- name: GOPATH + value: '$(system.defaultWorkingDirectory)/build' # Path to the module's code +- name: GOBIN + value: '$(GOPATH)/bin' # Path to the module's code +- name: module_path + value: '$(GOPATH)/src/github.com/$(repo)' # Path to the module's code + + +name: $(Date:yyyyMMddHHss).$(Build.SourceBranchName).$(Build.SourceVersion) + +pool: + name: custom-build-agents-dev + +stages: +- stage: 'terraform_providers_azurerm' + jobs: + - job: terraform_providers_azurerm_CheckSkip + steps: + - checkout: self + - checkout: git://CIAM-Authorization/authz.tools.pipelines + - bash: ../authz.tools.pipelines/pipelines/$(repo)/check_autocommit.sh + displayName: Check autocommit skip + workingDirectory: $(repo) + name: CheckSkip + - job: 'terraform_providers_azurerm_buildAndPublish' + dependsOn: terraform_providers_azurerm_CheckSkip + condition: eq(dependencies.terraform_providers_azurerm_CheckSkip.outputs['CheckSkip.SKIP_PIPELINE'], 'false') + steps: + - checkout: self + persistCredentials: true + - checkout: git://CIAM-Authorization/authz.tools.pipelines + - bash: ../authz.tools.pipelines/pipelines/$(repo)/get_tag.sh $(release_branch) + displayName: Generate tagname + workingDirectory: $(repo) + - bash: ../authz.tools.pipelines/pipelines/$(repo)/update_terraform_provider_revision.sh $(tagname) + displayName: Version bumping + workingDirectory: $(repo) + - script: | + if [ ! -z "$(GOPATH)" ] && [ -d "$(GOPATH)" ] # Our agents keep using the same folders for different runs... + then + rm -r $(GOPATH) + fi + mkdir -p '$(GOPATH)/bin $(GOPATH)/pkg' + mkdir -p '$(module_path)' + shopt -s extglob + shopt -s dotglob + cp -pr $(repo) '$(module_path)'/.. + echo '##vso[task.prependpath]$(GOPATH)/bin' + echo '##vso[task.prependpath]$(GOROOT)/bin' + displayName: 'Set up the Go workspace' + - script: | + go version + go build -v + displayName: 'Get dependencies, then build' + workingDirectory: '$(module_path)' + - script: | + go test -v -timeout 1800s $(module_path)/azurerm -run TestAccAzureRMApplicationGateway_sslPolicy_policyType_predefined + displayName: Test + workingDirectory: '$(module_path)' + - bash: find $(module_path) + - script: | + mkdir artifacts + rm -f artifacts/* # Our agents keep using the same folders for different runs... + cp $(module_path)/terraform-provider-azurerm artifacts/terraform-provider-azurerm_v$(tagname)_x4 + displayName: Generate artifact + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: 'artifacts' + displayName: 'Publish artifacts' + - bash: git tag $(tagname) + condition: and(succeeded(), eq(variables['Build.SourceBranchName'], variables['release_branch'])) + displayName: Set Git tag + workingDirectory: $(repo) + - bash: git push origin HEAD:$(Build.SourceBranch) + condition: and(succeeded(), eq(variables['Build.SourceBranchName'], variables['release_branch'])) + displayName: Push version bumped commit + workingDirectory: $(repo) + - bash: git push origin $(tagname) + condition: and(succeeded(), eq(variables['Build.SourceBranchName'], variables['release_branch'])) + displayName: Push Git tag + workingDirectory: $(repo) + diff --git a/version/version.go b/version/version.go index b2d946a5d206..8ae914c87da9 100644 --- a/version/version.go +++ b/version/version.go @@ -2,5 +2,5 @@ package version var ( // ProviderVersion is set during the release process to the release version of the binary - ProviderVersion = "dev" + ProviderVersion = "2.14.0-v0" ) From be657a4c2d15385ea82ccb14ab3801a3cdcba870 Mon Sep 17 00:00:00 2001 From: Magnus Niemann Date: Tue, 16 Jun 2020 15:52:16 +0200 Subject: [PATCH 02/13] Added three attributes to waf_policy --- .../application_gateway_resource_test.go | 3 ++ ...plication_firewall_policy_resource_test.go | 14 ++++++++- ...eb_application_firewall_policy_resource.go | 30 +++++++++++++++++-- ..._application_firewall_policy.html.markdown | 13 ++++++-- 4 files changed, 55 insertions(+), 5 deletions(-) diff --git a/azurerm/internal/services/network/tests/application_gateway_resource_test.go b/azurerm/internal/services/network/tests/application_gateway_resource_test.go index 39af394f3fdc..69f074121f53 100644 --- a/azurerm/internal/services/network/tests/application_gateway_resource_test.go +++ b/azurerm/internal/services/network/tests/application_gateway_resource_test.go @@ -2046,6 +2046,9 @@ resource "azurerm_web_application_firewall_policy" "testfwp" { policy_settings { enabled = true mode = "Prevention" + file_upload_limit_in_mb = 100 + max_request_body_size_in_kb = 100 + request_body_check = "true" } managed_rules { diff --git a/azurerm/internal/services/network/tests/web_application_firewall_policy_resource_test.go b/azurerm/internal/services/network/tests/web_application_firewall_policy_resource_test.go index 8df8d533dd92..73c3da6f32e4 100644 --- a/azurerm/internal/services/network/tests/web_application_firewall_policy_resource_test.go +++ b/azurerm/internal/services/network/tests/web_application_firewall_policy_resource_test.go @@ -92,6 +92,9 @@ func TestAccAzureRMWebApplicationFirewallPolicy_complete(t *testing.T) { resource.TestCheckResourceAttr(data.ResourceName, "policy_settings.#", "1"), resource.TestCheckResourceAttr(data.ResourceName, "policy_settings.0.enabled", "true"), resource.TestCheckResourceAttr(data.ResourceName, "policy_settings.0.mode", "Prevention"), + resource.TestCheckResourceAttr(data.ResourceName, "policy_settings.0.request_body_check", "true"), + resource.TestCheckResourceAttr(data.ResourceName, "policy_settings.0.file_upload_limit_in_mb", "100"), + resource.TestCheckResourceAttr(data.ResourceName, "policy_settings.0.max_request_body_size_in_kb", "128"), ), }, data.ImportStep(), @@ -167,6 +170,9 @@ func TestAccAzureRMWebApplicationFirewallPolicy_update(t *testing.T) { resource.TestCheckResourceAttr(data.ResourceName, "policy_settings.#", "1"), resource.TestCheckResourceAttr(data.ResourceName, "policy_settings.0.enabled", "true"), resource.TestCheckResourceAttr(data.ResourceName, "policy_settings.0.mode", "Prevention"), + resource.TestCheckResourceAttr(data.ResourceName, "policy_settings.0.request_body_check", "true"), + resource.TestCheckResourceAttr(data.ResourceName, "policy_settings.0.file_upload_limit_in_mb", "100"), + resource.TestCheckResourceAttr(data.ResourceName, "policy_settings.0.max_request_body_size_in_kb", "128"), ), }, data.ImportStep(), @@ -247,7 +253,10 @@ resource "azurerm_web_application_firewall_policy" "test" { policy_settings { enabled = true - mode = "Detection" + mode = "Detection" + request_body_check = true + file_upload_limit_in_mb = 100 + max_request_body_size_in_kb = 128 } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) @@ -346,6 +355,9 @@ resource "azurerm_web_application_firewall_policy" "test" { policy_settings { enabled = true mode = "Prevention" + request_body_check = true + file_upload_limit_in_mb = 100 + max_request_body_size_in_kb = 128 } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) diff --git a/azurerm/internal/services/network/web_application_firewall_policy_resource.go b/azurerm/internal/services/network/web_application_firewall_policy_resource.go index e11c013d391c..0d59bbed6607 100644 --- a/azurerm/internal/services/network/web_application_firewall_policy_resource.go +++ b/azurerm/internal/services/network/web_application_firewall_policy_resource.go @@ -247,6 +247,23 @@ func resourceArmWebApplicationFirewallPolicy() *schema.Resource { }, false), Default: string(network.Prevention), }, + "request_body_check": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, + "file_upload_limit_in_mb": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(1, 500), + Default: 100, + }, + "max_request_body_size_in_kb": { + Type: schema.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(1, 128), + Default: 128, + }, }, }, }, @@ -416,10 +433,16 @@ func expandArmWebApplicationFirewallPolicyPolicySettings(input []interface{}) *n enabled = network.WebApplicationFirewallEnabledStateEnabled } mode := v["mode"].(string) + requestBodyCheck := v["request_body_check"].(bool) + maxRequestBodySizeInKb := v["max_request_body_size_in_kb"].(int) + fileUploadLimitInMb := v["file_upload_limit_in_mb"].(int) result := network.PolicySettings{ - State: enabled, - Mode: network.WebApplicationFirewallMode(mode), + State: enabled, + Mode: network.WebApplicationFirewallMode(mode), + RequestBodyCheck: utils.Bool(requestBodyCheck), + MaxRequestBodySizeInKb: utils.Int32(int32(maxRequestBodySizeInKb)), + FileUploadLimitInMb: utils.Int32(int32(fileUploadLimitInMb)), } return &result } @@ -586,6 +609,9 @@ func flattenArmWebApplicationFirewallPolicyPolicySettings(input *network.PolicyS result["enabled"] = input.State == network.WebApplicationFirewallEnabledStateEnabled result["mode"] = string(input.Mode) + result["request_body_check"] = input.RequestBodyCheck + result["max_request_body_size_in_kb"] = int(*input.MaxRequestBodySizeInKb) + result["file_upload_limit_in_mb"] = int(*input.FileUploadLimitInMb) return []interface{}{result} } diff --git a/website/docs/r/web_application_firewall_policy.html.markdown b/website/docs/r/web_application_firewall_policy.html.markdown index 4c5d17f2d59b..861c3d2c9e98 100644 --- a/website/docs/r/web_application_firewall_policy.html.markdown +++ b/website/docs/r/web_application_firewall_policy.html.markdown @@ -73,6 +73,9 @@ resource "azurerm_web_application_firewall_policy" "example" { policy_settings { enabled = true mode = "Prevention" + request_body_check = true + file_upload_limit_in_mb = 100 + max_request_body_size_in_kb = 128 } managed_rules { @@ -159,9 +162,15 @@ The `match_variables` block supports the following: The `policy_settings` block supports the following: -* `enabled` - (Optional) Describes if the policy is in enabled state or disabled state Defaults to `Enabled`. +* `enabled` - (Optional) Describes if the policy is in enabled state or disabled state. Defaults to `Enabled`. -* `mode` - (Optional) Describes if it is in detection mode or prevention mode at the policy level Defaults to `Prevention`. +* `mode` - (Optional) Describes if it is in detection mode or prevention mode at the policy level. Defaults to `Prevention`. + +* `file_upload_limit_mb` - (Optional) The File Upload Limit in MB. Accepted values are in the range `1`MB to `500`MB. Defaults to `100`MB. + +* `request_body_check` - (Optional) Is Request Body Inspection enabled? Defaults to `true`. + +* `max_request_body_size_kb` - (Optional) The Maximum Request Body Size in KB. Accepted values are in the range `1`KB to `128`KB. Defaults to `128`KB. --- From b6883f146fb7551ce95a2c651a1a26ea9b8951cc Mon Sep 17 00:00:00 2001 From: Magnus Niemann Date: Tue, 16 Jun 2020 17:23:08 +0200 Subject: [PATCH 03/13] Removed local build stuff. --- azure-pipelines.yml | 95 --------------------------------------------- version/version.go | 2 +- 2 files changed, 1 insertion(+), 96 deletions(-) delete mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 44267a3b6ecd..000000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,95 +0,0 @@ -trigger: -- master -- feature/* -- release/* -- fix/* - -variables: -- name: repo - value: terraform.providers.azurerm -- name: release_branch - value: v2.14.0 -- name: GO111MODULE - value: on -- name: GOPATH - value: '$(system.defaultWorkingDirectory)/build' # Path to the module's code -- name: GOBIN - value: '$(GOPATH)/bin' # Path to the module's code -- name: module_path - value: '$(GOPATH)/src/github.com/$(repo)' # Path to the module's code - - -name: $(Date:yyyyMMddHHss).$(Build.SourceBranchName).$(Build.SourceVersion) - -pool: - name: custom-build-agents-dev - -stages: -- stage: 'terraform_providers_azurerm' - jobs: - - job: terraform_providers_azurerm_CheckSkip - steps: - - checkout: self - - checkout: git://CIAM-Authorization/authz.tools.pipelines - - bash: ../authz.tools.pipelines/pipelines/$(repo)/check_autocommit.sh - displayName: Check autocommit skip - workingDirectory: $(repo) - name: CheckSkip - - job: 'terraform_providers_azurerm_buildAndPublish' - dependsOn: terraform_providers_azurerm_CheckSkip - condition: eq(dependencies.terraform_providers_azurerm_CheckSkip.outputs['CheckSkip.SKIP_PIPELINE'], 'false') - steps: - - checkout: self - persistCredentials: true - - checkout: git://CIAM-Authorization/authz.tools.pipelines - - bash: ../authz.tools.pipelines/pipelines/$(repo)/get_tag.sh $(release_branch) - displayName: Generate tagname - workingDirectory: $(repo) - - bash: ../authz.tools.pipelines/pipelines/$(repo)/update_terraform_provider_revision.sh $(tagname) - displayName: Version bumping - workingDirectory: $(repo) - - script: | - if [ ! -z "$(GOPATH)" ] && [ -d "$(GOPATH)" ] # Our agents keep using the same folders for different runs... - then - rm -r $(GOPATH) - fi - mkdir -p '$(GOPATH)/bin $(GOPATH)/pkg' - mkdir -p '$(module_path)' - shopt -s extglob - shopt -s dotglob - cp -pr $(repo) '$(module_path)'/.. - echo '##vso[task.prependpath]$(GOPATH)/bin' - echo '##vso[task.prependpath]$(GOROOT)/bin' - displayName: 'Set up the Go workspace' - - script: | - go version - go build -v - displayName: 'Get dependencies, then build' - workingDirectory: '$(module_path)' - - script: | - go test -v -timeout 1800s $(module_path)/azurerm -run TestAccAzureRMApplicationGateway_sslPolicy_policyType_predefined - displayName: Test - workingDirectory: '$(module_path)' - - bash: find $(module_path) - - script: | - mkdir artifacts - rm -f artifacts/* # Our agents keep using the same folders for different runs... - cp $(module_path)/terraform-provider-azurerm artifacts/terraform-provider-azurerm_v$(tagname)_x4 - displayName: Generate artifact - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: 'artifacts' - displayName: 'Publish artifacts' - - bash: git tag $(tagname) - condition: and(succeeded(), eq(variables['Build.SourceBranchName'], variables['release_branch'])) - displayName: Set Git tag - workingDirectory: $(repo) - - bash: git push origin HEAD:$(Build.SourceBranch) - condition: and(succeeded(), eq(variables['Build.SourceBranchName'], variables['release_branch'])) - displayName: Push version bumped commit - workingDirectory: $(repo) - - bash: git push origin $(tagname) - condition: and(succeeded(), eq(variables['Build.SourceBranchName'], variables['release_branch'])) - displayName: Push Git tag - workingDirectory: $(repo) - diff --git a/version/version.go b/version/version.go index 8ae914c87da9..b2d946a5d206 100644 --- a/version/version.go +++ b/version/version.go @@ -2,5 +2,5 @@ package version var ( // ProviderVersion is set during the release process to the release version of the binary - ProviderVersion = "2.14.0-v0" + ProviderVersion = "dev" ) From d4c0b5220dbdba9d0c327a7e1058372ef95f8a52 Mon Sep 17 00:00:00 2001 From: Magnus Niemann Date: Tue, 16 Jun 2020 17:28:56 +0200 Subject: [PATCH 04/13] Indentation. --- ..._application_firewall_policy_resource_test.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/azurerm/internal/services/network/tests/web_application_firewall_policy_resource_test.go b/azurerm/internal/services/network/tests/web_application_firewall_policy_resource_test.go index 73c3da6f32e4..86955702481f 100644 --- a/azurerm/internal/services/network/tests/web_application_firewall_policy_resource_test.go +++ b/azurerm/internal/services/network/tests/web_application_firewall_policy_resource_test.go @@ -252,10 +252,10 @@ resource "azurerm_web_application_firewall_policy" "test" { } policy_settings { - enabled = true - mode = "Detection" - request_body_check = true - file_upload_limit_in_mb = 100 + enabled = true + mode = "Detection" + request_body_check = true + file_upload_limit_in_mb = 100 max_request_body_size_in_kb = 128 } } @@ -353,10 +353,10 @@ resource "azurerm_web_application_firewall_policy" "test" { } policy_settings { - enabled = true - mode = "Prevention" - request_body_check = true - file_upload_limit_in_mb = 100 + enabled = true + mode = "Prevention" + request_body_check = true + file_upload_limit_in_mb = 100 max_request_body_size_in_kb = 128 } } From 4ea2acd88a1f1bbbacc4559f7734b33b6ffc3085 Mon Sep 17 00:00:00 2001 From: Magnus Niemann Date: Tue, 16 Jun 2020 17:31:06 +0200 Subject: [PATCH 05/13] Tabs2spaces. --- .../tests/web_application_firewall_policy_resource_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azurerm/internal/services/network/tests/web_application_firewall_policy_resource_test.go b/azurerm/internal/services/network/tests/web_application_firewall_policy_resource_test.go index 86955702481f..0fa4901101e0 100644 --- a/azurerm/internal/services/network/tests/web_application_firewall_policy_resource_test.go +++ b/azurerm/internal/services/network/tests/web_application_firewall_policy_resource_test.go @@ -253,7 +253,7 @@ resource "azurerm_web_application_firewall_policy" "test" { policy_settings { enabled = true - mode = "Detection" + mode = "Detection" request_body_check = true file_upload_limit_in_mb = 100 max_request_body_size_in_kb = 128 From 50867889ed13af95428805e03ce411321d406130 Mon Sep 17 00:00:00 2001 From: Magnus Niemann Date: Fri, 19 Jun 2020 10:45:47 +0200 Subject: [PATCH 06/13] Formatted files. --- .../network/tests/application_gateway_resource_test.go | 8 ++++---- .../web_application_firewall_policy_resource_test.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/azurerm/internal/services/network/tests/application_gateway_resource_test.go b/azurerm/internal/services/network/tests/application_gateway_resource_test.go index 69f074121f53..52cbdc53cb09 100644 --- a/azurerm/internal/services/network/tests/application_gateway_resource_test.go +++ b/azurerm/internal/services/network/tests/application_gateway_resource_test.go @@ -2044,11 +2044,11 @@ resource "azurerm_web_application_firewall_policy" "testfwp" { location = azurerm_resource_group.test.location policy_settings { - enabled = true - mode = "Prevention" - file_upload_limit_in_mb = 100 + enabled = true + mode = "Prevention" + file_upload_limit_in_mb = 100 max_request_body_size_in_kb = 100 - request_body_check = "true" + request_body_check = "true" } managed_rules { diff --git a/azurerm/internal/services/network/tests/web_application_firewall_policy_resource_test.go b/azurerm/internal/services/network/tests/web_application_firewall_policy_resource_test.go index 0fa4901101e0..632785c222ca 100644 --- a/azurerm/internal/services/network/tests/web_application_firewall_policy_resource_test.go +++ b/azurerm/internal/services/network/tests/web_application_firewall_policy_resource_test.go @@ -256,7 +256,7 @@ resource "azurerm_web_application_firewall_policy" "test" { mode = "Detection" request_body_check = true file_upload_limit_in_mb = 100 - max_request_body_size_in_kb = 128 + max_request_body_size_in_kb = 128 } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) From b7aa5cb9064fd70d789d9af686a71cbeeef7644b Mon Sep 17 00:00:00 2001 From: Magnus Niemann Date: Fri, 19 Jun 2020 10:47:56 +0200 Subject: [PATCH 07/13] Formatted doc. --- .../docs/r/web_application_firewall_policy.html.markdown | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/website/docs/r/web_application_firewall_policy.html.markdown b/website/docs/r/web_application_firewall_policy.html.markdown index 861c3d2c9e98..39122c843df6 100644 --- a/website/docs/r/web_application_firewall_policy.html.markdown +++ b/website/docs/r/web_application_firewall_policy.html.markdown @@ -71,10 +71,10 @@ resource "azurerm_web_application_firewall_policy" "example" { } policy_settings { - enabled = true - mode = "Prevention" - request_body_check = true - file_upload_limit_in_mb = 100 + enabled = true + mode = "Prevention" + request_body_check = true + file_upload_limit_in_mb = 100 max_request_body_size_in_kb = 128 } From cc88ac5dd3d1edaabdc68d3e04b8f7f1ba6877bc Mon Sep 17 00:00:00 2001 From: Magnus Niemann <43843131+boschcrank@users.noreply.github.com> Date: Wed, 24 Jun 2020 07:14:38 +0200 Subject: [PATCH 08/13] Update website/docs/r/web_application_firewall_policy.html.markdown Co-authored-by: Steve <11830746+jackofallops@users.noreply.github.com> --- website/docs/r/web_application_firewall_policy.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/web_application_firewall_policy.html.markdown b/website/docs/r/web_application_firewall_policy.html.markdown index 39122c843df6..b9a1e2b102a5 100644 --- a/website/docs/r/web_application_firewall_policy.html.markdown +++ b/website/docs/r/web_application_firewall_policy.html.markdown @@ -166,7 +166,7 @@ The `policy_settings` block supports the following: * `mode` - (Optional) Describes if it is in detection mode or prevention mode at the policy level. Defaults to `Prevention`. -* `file_upload_limit_mb` - (Optional) The File Upload Limit in MB. Accepted values are in the range `1`MB to `500`MB. Defaults to `100`MB. +* `file_upload_limit_mb` - (Optional) The File Upload Limit in MB. Accepted values are in the range `1` to `750`. Defaults to `100`. * `request_body_check` - (Optional) Is Request Body Inspection enabled? Defaults to `true`. From 493df504d5f2880d4b725fdebce1c3ffae847a96 Mon Sep 17 00:00:00 2001 From: Magnus Niemann Date: Tue, 30 Jun 2020 14:45:39 +0200 Subject: [PATCH 09/13] Changed intervals for validation. --- .../network/web_application_firewall_policy_resource.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azurerm/internal/services/network/web_application_firewall_policy_resource.go b/azurerm/internal/services/network/web_application_firewall_policy_resource.go index 0d59bbed6607..c547536ed48a 100644 --- a/azurerm/internal/services/network/web_application_firewall_policy_resource.go +++ b/azurerm/internal/services/network/web_application_firewall_policy_resource.go @@ -255,13 +255,13 @@ func resourceArmWebApplicationFirewallPolicy() *schema.Resource { "file_upload_limit_in_mb": { Type: schema.TypeInt, Optional: true, - ValidateFunc: validation.IntBetween(1, 500), + ValidateFunc: validation.IntBetween(1, 750), Default: 100, }, "max_request_body_size_in_kb": { Type: schema.TypeInt, Optional: true, - ValidateFunc: validation.IntBetween(1, 128), + ValidateFunc: validation.IntBetween(8, 128), Default: 128, }, }, From 5f42dfc152b25a0f97950b0387d8dda57f915ee8 Mon Sep 17 00:00:00 2001 From: Magnus Niemann Date: Tue, 30 Jun 2020 14:49:56 +0200 Subject: [PATCH 10/13] Removed settings values. --- .../tests/web_application_firewall_policy_resource_test.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/azurerm/internal/services/network/tests/web_application_firewall_policy_resource_test.go b/azurerm/internal/services/network/tests/web_application_firewall_policy_resource_test.go index 632785c222ca..7b54f3932593 100644 --- a/azurerm/internal/services/network/tests/web_application_firewall_policy_resource_test.go +++ b/azurerm/internal/services/network/tests/web_application_firewall_policy_resource_test.go @@ -254,9 +254,6 @@ resource "azurerm_web_application_firewall_policy" "test" { policy_settings { enabled = true mode = "Detection" - request_body_check = true - file_upload_limit_in_mb = 100 - max_request_body_size_in_kb = 128 } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) @@ -355,9 +352,6 @@ resource "azurerm_web_application_firewall_policy" "test" { policy_settings { enabled = true mode = "Prevention" - request_body_check = true - file_upload_limit_in_mb = 100 - max_request_body_size_in_kb = 128 } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) From 3c5b947e03767864a3352448cda64f71253ed560 Mon Sep 17 00:00:00 2001 From: Magnus Niemann <43843131+boschcrank@users.noreply.github.com> Date: Tue, 30 Jun 2020 14:53:30 +0200 Subject: [PATCH 11/13] Update website/docs/r/web_application_firewall_policy.html.markdown Co-authored-by: Steve <11830746+jackofallops@users.noreply.github.com> --- website/docs/r/web_application_firewall_policy.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/web_application_firewall_policy.html.markdown b/website/docs/r/web_application_firewall_policy.html.markdown index b9a1e2b102a5..acd459972934 100644 --- a/website/docs/r/web_application_firewall_policy.html.markdown +++ b/website/docs/r/web_application_firewall_policy.html.markdown @@ -164,7 +164,7 @@ The `policy_settings` block supports the following: * `enabled` - (Optional) Describes if the policy is in enabled state or disabled state. Defaults to `Enabled`. -* `mode` - (Optional) Describes if it is in detection mode or prevention mode at the policy level. Defaults to `Prevention`. +* `mode` - (Optional) Describes if it is in detection mode or prevention mode at the policy level. Defaults to `Prevention`. * `file_upload_limit_mb` - (Optional) The File Upload Limit in MB. Accepted values are in the range `1` to `750`. Defaults to `100`. From 93919049293cfb93200c8bda2da781f2a0e22a7d Mon Sep 17 00:00:00 2001 From: Magnus Niemann <43843131+boschcrank@users.noreply.github.com> Date: Tue, 30 Jun 2020 14:53:48 +0200 Subject: [PATCH 12/13] Update website/docs/r/web_application_firewall_policy.html.markdown Co-authored-by: Steve <11830746+jackofallops@users.noreply.github.com> --- website/docs/r/web_application_firewall_policy.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/web_application_firewall_policy.html.markdown b/website/docs/r/web_application_firewall_policy.html.markdown index acd459972934..050a409a1af6 100644 --- a/website/docs/r/web_application_firewall_policy.html.markdown +++ b/website/docs/r/web_application_firewall_policy.html.markdown @@ -170,7 +170,7 @@ The `policy_settings` block supports the following: * `request_body_check` - (Optional) Is Request Body Inspection enabled? Defaults to `true`. -* `max_request_body_size_kb` - (Optional) The Maximum Request Body Size in KB. Accepted values are in the range `1`KB to `128`KB. Defaults to `128`KB. +* `max_request_body_size_kb` - (Optional) The Maximum Request Body Size in KB. Accepted values are in the range `8` to `128`. Defaults to `128`. --- From c7ffa1ff1d07776d492944eac1cfdf17fd74e07e Mon Sep 17 00:00:00 2001 From: Magnus Niemann Date: Tue, 30 Jun 2020 15:45:45 +0200 Subject: [PATCH 13/13] Indentation. --- .../web_application_firewall_policy_resource_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/azurerm/internal/services/network/tests/web_application_firewall_policy_resource_test.go b/azurerm/internal/services/network/tests/web_application_firewall_policy_resource_test.go index 7b54f3932593..e50e04014ba2 100644 --- a/azurerm/internal/services/network/tests/web_application_firewall_policy_resource_test.go +++ b/azurerm/internal/services/network/tests/web_application_firewall_policy_resource_test.go @@ -252,8 +252,8 @@ resource "azurerm_web_application_firewall_policy" "test" { } policy_settings { - enabled = true - mode = "Detection" + enabled = true + mode = "Detection" } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) @@ -350,8 +350,8 @@ resource "azurerm_web_application_firewall_policy" "test" { } policy_settings { - enabled = true - mode = "Prevention" + enabled = true + mode = "Prevention" } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger)