imperva / terraform-provider-incapsula

This package is a plugin for Terraform, and is designed to be used to auto-provision sites in Incapsula via Incapsula’s API from the terraform cli/yaml configurations.
Mozilla Public License 2.0
44 stars 71 forks source link

Apply of incapsula_application_delivery fails when file_compression = false #352

Open bahelgerson opened 12 months ago

bahelgerson commented 12 months ago

Confirmation

Terraform and Imperva provider version

Terraform v1.5.7
on darwin_amd64
+ provider registry.terraform.io/imperva/incapsula v3.20.2

Affected resource(s)

Terraform configuration files

terraform {
  required_version = "~> 1.5.7"

  required_providers {
    incapsula = {
      source  = "imperva/incapsula"
      version = "3.20.2"
    }
  }
}

provider "incapsula" {
  api_id  = "REDACTED"
  api_key = "REDACTED"
}

resource "incapsula_site" "example_site" {
  domain = "www.example.com"
}

resource "incapsula_application_delivery" "example_site" {
  site_id          = incapsula_site.example_site.id
  file_compression = false
}

Debug output

2023-09-13T18:36:27.252-0500 [INFO]  Terraform version: 1.5.7
2023-09-13T18:36:27.252-0500 [DEBUG] using github.com/hashicorp/go-tfe v1.26.0
2023-09-13T18:36:27.252-0500 [DEBUG] using github.com/hashicorp/hcl/v2 v2.16.2
2023-09-13T18:36:27.252-0500 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.0
2023-09-13T18:36:27.252-0500 [DEBUG] using github.com/zclconf/go-cty v1.12.2
2023-09-13T18:36:27.252-0500 [INFO]  Go runtime version: go1.20.7
2023-09-13T18:36:27.252-0500 [INFO]  CLI args: []string{"terraform", "apply"}
2023-09-13T18:36:27.252-0500 [DEBUG] Attempting to open CLI config file: /Users/user/.terraformrc
2023-09-13T18:36:27.253-0500 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2023-09-13T18:36:27.253-0500 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2023-09-13T18:36:27.253-0500 [DEBUG] ignoring non-existing provider search directory /Users/user/.terraform.d/plugins
2023-09-13T18:36:27.253-0500 [DEBUG] ignoring non-existing provider search directory /Users/user/Library/Application Support/io.terraform/plugins
2023-09-13T18:36:27.253-0500 [DEBUG] ignoring non-existing provider search directory /Library/Application Support/io.terraform/plugins
2023-09-13T18:36:27.253-0500 [INFO]  CLI command args: []string{"apply"}
2023-09-13T18:36:27.255-0500 [DEBUG] New state was assigned lineage "65a19326-6af0-5b27-7f1e-d93319f6ad0b"
2023-09-13T18:36:27.329-0500 [DEBUG] checking for provisioner in "."
2023-09-13T18:36:27.329-0500 [DEBUG] checking for provisioner in "/usr/local/bin"
2023-09-13T18:36:27.330-0500 [INFO]  backend/local: starting Apply operation
2023-09-13T18:36:27.332-0500 [DEBUG] created provider logger: level=debug
2023-09-13T18:36:27.333-0500 [INFO]  provider: configuring client automatic mTLS
2023-09-13T18:36:27.362-0500 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/imperva/incapsula/3.20.2/darwin_amd64/terraform-provider-incapsula_v3.20.2 args=[.terraform/providers/registry.terraform.io/imperva/incapsula/3.20.2/darwin_amd64/terraform-provider-incapsula_v3.20.2]
2023-09-13T18:36:27.365-0500 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/imperva/incapsula/3.20.2/darwin_amd64/terraform-provider-incapsula_v3.20.2 pid=13461
2023-09-13T18:36:27.365-0500 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/imperva/incapsula/3.20.2/darwin_amd64/terraform-provider-incapsula_v3.20.2
2023-09-13T18:36:27.384-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: configuring server automatic mTLS: timestamp=2023-09-13T18:36:27.383-0500
2023-09-13T18:36:27.416-0500 [DEBUG] provider.terraform-provider-incapsula_v3.20.2: plugin address: address=/var/folders/_p/y4ffy6z96xg7y7880y1xx9gw0000gn/T/plugin3094682312 network=unix timestamp=2023-09-13T18:36:27.416-0500
2023-09-13T18:36:27.416-0500 [DEBUG] provider: using plugin: version=5
2023-09-13T18:36:27.446-0500 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2023-09-13T18:36:27.448-0500 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/imperva/incapsula/3.20.2/darwin_amd64/terraform-provider-incapsula_v3.20.2 pid=13461
2023-09-13T18:36:27.448-0500 [DEBUG] provider: plugin exited
2023-09-13T18:36:27.448-0500 [DEBUG] Building and walking validate graph
2023-09-13T18:36:27.448-0500 [DEBUG] ProviderTransformer: "incapsula_site.example_site" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/imperva/incapsula"]
2023-09-13T18:36:27.448-0500 [DEBUG] ProviderTransformer: "incapsula_application_delivery.example_site" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/imperva/incapsula"]
2023-09-13T18:36:27.448-0500 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/imperva/incapsula\"]" references: []
2023-09-13T18:36:27.449-0500 [DEBUG] ReferenceTransformer: "incapsula_site.example_site" references: []
2023-09-13T18:36:27.449-0500 [DEBUG] ReferenceTransformer: "incapsula_application_delivery.example_site" references: [incapsula_site.example_site]
2023-09-13T18:36:27.449-0500 [DEBUG] Starting graph walk: walkValidate
2023-09-13T18:36:27.449-0500 [DEBUG] created provider logger: level=debug
2023-09-13T18:36:27.449-0500 [INFO]  provider: configuring client automatic mTLS
2023-09-13T18:36:27.461-0500 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/imperva/incapsula/3.20.2/darwin_amd64/terraform-provider-incapsula_v3.20.2 args=[.terraform/providers/registry.terraform.io/imperva/incapsula/3.20.2/darwin_amd64/terraform-provider-incapsula_v3.20.2]
2023-09-13T18:36:27.464-0500 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/imperva/incapsula/3.20.2/darwin_amd64/terraform-provider-incapsula_v3.20.2 pid=13462
2023-09-13T18:36:27.464-0500 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/imperva/incapsula/3.20.2/darwin_amd64/terraform-provider-incapsula_v3.20.2
2023-09-13T18:36:27.482-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: configuring server automatic mTLS: timestamp=2023-09-13T18:36:27.482-0500
2023-09-13T18:36:27.514-0500 [DEBUG] provider.terraform-provider-incapsula_v3.20.2: plugin address: address=/var/folders/_p/y4ffy6z96xg7y7880y1xx9gw0000gn/T/plugin1327854458 network=unix timestamp=2023-09-13T18:36:27.514-0500
2023-09-13T18:36:27.514-0500 [DEBUG] provider: using plugin: version=5
2023-09-13T18:36:27.547-0500 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2023-09-13T18:36:27.549-0500 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/imperva/incapsula/3.20.2/darwin_amd64/terraform-provider-incapsula_v3.20.2 pid=13462
2023-09-13T18:36:27.549-0500 [DEBUG] provider: plugin exited
2023-09-13T18:36:27.549-0500 [INFO]  backend/local: apply calling Plan
2023-09-13T18:36:27.549-0500 [DEBUG] Building and walking plan graph for NormalMode
2023-09-13T18:36:27.549-0500 [DEBUG] ProviderTransformer: "incapsula_site.example_site (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/imperva/incapsula"]
2023-09-13T18:36:27.549-0500 [DEBUG] ProviderTransformer: "incapsula_application_delivery.example_site (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/imperva/incapsula"]
2023-09-13T18:36:27.549-0500 [DEBUG] ReferenceTransformer: "incapsula_site.example_site (expand)" references: []
2023-09-13T18:36:27.549-0500 [DEBUG] ReferenceTransformer: "incapsula_application_delivery.example_site (expand)" references: [incapsula_site.example_site (expand)]
2023-09-13T18:36:27.549-0500 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/imperva/incapsula\"]" references: []
2023-09-13T18:36:27.550-0500 [DEBUG] Starting graph walk: walkPlan
2023-09-13T18:36:27.550-0500 [DEBUG] created provider logger: level=debug
2023-09-13T18:36:27.550-0500 [INFO]  provider: configuring client automatic mTLS
2023-09-13T18:36:27.562-0500 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/imperva/incapsula/3.20.2/darwin_amd64/terraform-provider-incapsula_v3.20.2 args=[.terraform/providers/registry.terraform.io/imperva/incapsula/3.20.2/darwin_amd64/terraform-provider-incapsula_v3.20.2]
2023-09-13T18:36:27.566-0500 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/imperva/incapsula/3.20.2/darwin_amd64/terraform-provider-incapsula_v3.20.2 pid=13464
2023-09-13T18:36:27.566-0500 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/imperva/incapsula/3.20.2/darwin_amd64/terraform-provider-incapsula_v3.20.2
2023-09-13T18:36:27.586-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: configuring server automatic mTLS: timestamp=2023-09-13T18:36:27.585-0500
2023-09-13T18:36:27.617-0500 [DEBUG] provider.terraform-provider-incapsula_v3.20.2: plugin address: address=/var/folders/_p/y4ffy6z96xg7y7880y1xx9gw0000gn/T/plugin987631337 network=unix timestamp=2023-09-13T18:36:27.617-0500
2023-09-13T18:36:27.617-0500 [DEBUG] provider: using plugin: version=5
2023-09-13T18:36:27.648-0500 [WARN]  ValidateProviderConfig from "provider[\"registry.terraform.io/imperva/incapsula\"]" changed the config value, but that value is unused
2023-09-13T18:36:27.649-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:27 [INFO] Checking API credentials for client instantiation: timestamp=2023-09-13T18:36:27.649-0500
2023-09-13T18:36:27.649-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:27 [INFO] Checking API credentials against Incapsula API: timestamp=2023-09-13T18:36:27.649-0500
2023-09-13T18:36:28.045-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:28 [DEBUG] Incapsula account JSON response: REDACTED: timestamp=2023-09-13T18:36:28.045-0500
2023-09-13T18:36:28.046-0500 [DEBUG] ReferenceTransformer: "incapsula_site.example_site" references: []
incapsula_site.example_site: Refreshing state... [id=27746157]
2023-09-13T18:36:28.052-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:28 [INFO] Reading Incapsula site for domain: www.example.com: timestamp=2023-09-13T18:36:28.052-0500
2023-09-13T18:36:28.052-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:28 [INFO] Getting Incapsula site status for domain: www.example.com (site id: 27746157): timestamp=2023-09-13T18:36:28.052-0500
2023-09-13T18:36:28.052-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:28 [DEBUG] Waiting for state to become: [success]: timestamp=2023-09-13T18:36:28.052-0500
2023-09-13T18:36:28.407-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:28 [DEBUG] Incapsula site status JSON response: {"site_id":27746157,"statusEnum":"pending_ssl_select_approver","status":"pending-select-approver","domain":"www.example.com","account_id":REDACTED,"acceleration_level":"advanced","acceleration_level_raw":"aggressive","site_creation_date":1694648141000,"ips":["93.184.216.34"],"dns":[{"dns_record_name":"example.com","set_type_to":"A","set_data_to":["45.60.103.129","45.60.31.129"]},{"dns_record_name":"www.example.com","set_type_to":"CNAME","set_data_to":["qr4quua.impervadns.net"]}],"original_dns":[{"dns_record_name":"example.com","set_type_to":"A","set_data_to":["93.184.216.34"]},{"dns_record_name":"www.example.com","set_type_to":"A","set_data_to":["93.184.216.34"]}],"warnings":[],"active":"active","support_all_tls_versions":false,"use_wildcard_san_instead_of_full_domain_san":true,"add_naked_domain_san":true,"additionalErrors":[],"display_name":"www.example.com","security":{"waf":{"rules":[{"action":"api.threats.action.block_request","action_text":"Block Request","id":"api.threats.sql_injection","name":"SQL Injection"},{"action":"api.threats.action.alert","action_text":"Alert Only","id":"api.threats.cross_site_scripting","name":"Cross Site Scripting"},{"action":"api.threats.action.block_request","action_text":"Block Request","id":"api.threats.illegal_resource_access","name":"Illegal Resource Access"},{"block_bad_bots":true,"challenge_suspected_bots":false,"id":"api.threats.bot_access_control","name":"Bot Access Control"},{"action":"api.threats.action.disabled","action_text":"Ignore","id":"api.threats.sensitive_info_leakage","name":"Sensitive Info Leakage"},{"activation_mode":"api.threats.ddos.activation_mode.auto","activation_mode_text":"Auto","ddos_traffic_threshold":1000,"id":"api.threats.ddos","name":"DDoS"},{"action":"api.threats.action.quarantine_url","action_text":"Auto-Quarantine","id":"api.threats.backdoor","name":"Backdoor Protect"},{"action":"api.threats.action.block_request","action_text":"Block Request","id":"api.threats.remote_file_inclusion","name":"Remote File Inclusion"},{"action":"api.threats.action.disabled","action_text":"Ignore","id":"api.threats.customRule","name":"IncapRules"},{"action":"api.threats.action.block_request","action_text":"Block Request","id":"api.threats.api.specification.violation","name":"API Specification Violation"},{"action":"api.threats.action.disabled","action_text":"Ignore","id":"api.threats.account_take_over","name":"Account Takeover"},{"action":"api.threats.action.disabled","action_text":"Ignore","id":"api.threats.distil_bad_bots","name":"Advanced Bot Protection"}]}},"sealLocation":{"id":"api.seal_location.none","name":"No seal"},"ssl":{"origin_server":{"detected":true,"detectionStatus":"ok"},"custom_certificate":{"active":false},"generated_certificate":{"san":[]}},"siteDualFactorSettings":{"enabled":false,"customAreas":[],"customAreasExceptions":[],"allowAllUsers":true,"shouldSuggestApplicatons":true,"allowedMedia":["ga","sms"],"shouldSendLoginNotifications":true,"version":0},"login_protect":{"enabled":false,"specific_users_list":[],"send_lp_notifications":true,"allow_all_users":true,"authentication_methods":["ga","sms"],"urls":[],"url_patterns":[]},"performance_configuration":{"advanced_caching_rules":{"never_cache_resources":[],"always_cache_resources":[]},"acceleration_level":"advanced","acceleration_level_raw":"aggressive","async_validation":true,"minify_javascript":true,"minify_css":true,"minify_static_html":true,"compress_jpeg":true,"compress_jepg":true,"progressive_image_rendering":false,"aggressive_compression":false,"compress_png":true,"on_the_fly_compression":true,"tcp_pre_pooling":true,"comply_no_cache":false,"comply_vary":false,"use_shortest_caching":false,"perfer_last_modified":false,"prefer_last_modified":false,"disable_client_side_caching":false,"cache300x":false,"cache_headers":[]},"extended_ddos":1000000,"restricted_cname_reuse":false,"res":0,"res_message":"OK","debug_info":{"id-info":"999999"}}: timestamp=2023-09-13T18:36:28.407-0500
2023-09-13T18:36:28.408-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:28 [INFO] Getting Incapsula data storage region for site: 27746157: timestamp=2023-09-13T18:36:28.408-0500
2023-09-13T18:36:28.409-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:28 [DEBUG] Waiting for state to become: [success]: timestamp=2023-09-13T18:36:28.408-0500
2023-09-13T18:36:28.721-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:28 [DEBUG] Incapsula data storage region JSON response: {"region":"US","res":0,"res_message":"OK","debug_info":{"id-info":"999999"}}: timestamp=2023-09-13T18:36:28.721-0500
2023-09-13T18:36:28.721-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:28 [INFO] Getting Incapsula Masking Settings for Site ID 27746157: timestamp=2023-09-13T18:36:28.721-0500
2023-09-13T18:36:28.721-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:28 [DEBUG] Waiting for state to become: [success]: timestamp=2023-09-13T18:36:28.721-0500
2023-09-13T18:36:29.101-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:29 [DEBUG] Incapsula ReadMaskingSettings JSON response: {"hashing_enabled":false}: timestamp=2023-09-13T18:36:29.101-0500
2023-09-13T18:36:29.101-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:29 [INFO] Getting Incapsula Performance Settings for Site ID 27746157: timestamp=2023-09-13T18:36:29.101-0500
2023-09-13T18:36:29.101-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:29 [DEBUG] Waiting for state to become: [success]: timestamp=2023-09-13T18:36:29.101-0500
2023-09-13T18:36:29.438-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:29 [DEBUG] Incapsula Read Incap Performance Settings JSON response: {"mode":{"level":"smart","time":300,"https":"disabled"},"key":{"unite_naked_full_cache":false,"comply_vary":false},"response":{"stale_content":{"mode":"adaptive"},"cache_shield":true,"cache_response_header":{"mode":"custom","headers":[]},"cache_empty_responses":false,"cache_300x":false,"cache_http_10_responses":false,"cache_404":{"enabled":false}},"ttl":{"use_shortest_caching":false,"prefer_last_modified":false},"client_side":{"enable_client_side_caching":true,"comply_no_cache":false,"send_age_header":false}}: timestamp=2023-09-13T18:36:29.438-0500
2023-09-13T18:36:29.438-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:29 [INFO] Getting Data Centers configuration (site_id: 27746157): timestamp=2023-09-13T18:36:29.438-0500
2023-09-13T18:36:29.438-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:29 [DEBUG] Waiting for state to become: [success]: timestamp=2023-09-13T18:36:29.438-0500
2023-09-13T18:36:29.683-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:29 [DEBUG] Incapsula data centers JSON response: {"data":[{"lbAlgorithm":"BEST_CONNECTION_TIME","failOverRequiredMonitors":"MOST","dataCenterMode":"SINGLE_SERVER","minAvailableServersForDataCenterUp":1,"isPersistent":true,"dataCenters":[{"name":"New DC","id":2876944,"ipMode":"MULTIPLE_IP","lbAlgorithm":"LB_LEAST_PENDING_REQUESTS","isEnabled":true,"isActive":true,"isContent":false,"isRestOfTheWorld":false,"geoLocations":[],"servers":[{"address":"93.184.216.34","id":6385531,"isEnabled":true,"serverMode":"ACTIVE"}]}]}]}: timestamp=2023-09-13T18:36:29.683-0500
2023-09-13T18:36:29.683-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:29 [INFO] Finished reading Incapsula site for domain: www.example.com: timestamp=2023-09-13T18:36:29.683-0500
2023-09-13T18:36:29.690-0500 [WARN]  Provider "registry.terraform.io/imperva/incapsula" produced an invalid plan for incapsula_site.example_site, but we are tolerating it because it is using the legacy plugin SDK.
    The following problems may be the cause of any confusing errors from downstream operations:
      - .naked_domain_san: planned value cty.True for a non-computed attribute
      - .wildcard_san: planned value cty.True for a non-computed attribute
2023-09-13T18:36:29.692-0500 [DEBUG] Resource instance state not found for node "incapsula_application_delivery.example_site", instance incapsula_application_delivery.example_site
2023-09-13T18:36:29.692-0500 [DEBUG] ReferenceTransformer: "incapsula_application_delivery.example_site" references: []
2023-09-13T18:36:29.692-0500 [DEBUG] refresh: incapsula_application_delivery.example_site: no state, so not refreshing
2023-09-13T18:36:29.696-0500 [WARN]  Provider "registry.terraform.io/imperva/incapsula" produced an invalid plan for incapsula_application_delivery.example_site, but we are tolerating it because it is using the legacy plugin SDK.
    The following problems may be the cause of any confusing errors from downstream operations:
      - .redirect_naked_to_full: planned value cty.False for a non-computed attribute
      - .minify_js: planned value cty.True for a non-computed attribute
      - .ssl_port_to: planned value cty.NumberIntVal(443) for a non-computed attribute
      - .progressive_image_rendering: planned value cty.False for a non-computed attribute
      - .redirect_http_to_https: planned value cty.False for a non-computed attribute
      - .compress_jpeg: planned value cty.True for a non-computed attribute
      - .compress_png: planned value cty.True for a non-computed attribute
      - .compression_type: planned value cty.StringVal("GZIP") for a non-computed attribute
      - .support_non_sni_clients: planned value cty.True for a non-computed attribute
      - .aggressive_compression: planned value cty.False for a non-computed attribute
      - .minify_css: planned value cty.True for a non-computed attribute
      - .minify_static_html: planned value cty.True for a non-computed attribute
      - .origin_connection_reuse: planned value cty.True for a non-computed attribute
      - .port_to: planned value cty.NumberIntVal(80) for a non-computed attribute
      - .tcp_pre_pooling: planned value cty.True for a non-computed attribute
      - .enable_http2: planned value cty.False for a non-computed attribute
      - .http2_to_origin: planned value cty.False for a non-computed attribute
2023-09-13T18:36:29.697-0500 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2023-09-13T18:36:29.700-0500 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/imperva/incapsula/3.20.2/darwin_amd64/terraform-provider-incapsula_v3.20.2 pid=13464
2023-09-13T18:36:29.700-0500 [DEBUG] provider: plugin exited
2023-09-13T18:36:29.701-0500 [DEBUG] building apply graph to check for errors
2023-09-13T18:36:29.701-0500 [DEBUG] Resource state not found for node "incapsula_application_delivery.example_site", instance incapsula_application_delivery.example_site
2023-09-13T18:36:29.701-0500 [DEBUG] ProviderTransformer: "incapsula_site.example_site (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/imperva/incapsula"]
2023-09-13T18:36:29.701-0500 [DEBUG] ProviderTransformer: "incapsula_application_delivery.example_site (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/imperva/incapsula"]
2023-09-13T18:36:29.701-0500 [DEBUG] ProviderTransformer: "incapsula_application_delivery.example_site" (*terraform.NodeApplyableResourceInstance) needs provider["registry.terraform.io/imperva/incapsula"]
2023-09-13T18:36:29.701-0500 [DEBUG] ReferenceTransformer: "incapsula_site.example_site (expand)" references: []
2023-09-13T18:36:29.702-0500 [DEBUG] ReferenceTransformer: "incapsula_application_delivery.example_site (expand)" references: []
2023-09-13T18:36:29.702-0500 [DEBUG] ReferenceTransformer: "incapsula_application_delivery.example_site" references: [incapsula_site.example_site (expand)]
2023-09-13T18:36:29.702-0500 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/imperva/incapsula\"]" references: []

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # incapsula_application_delivery.example_site will be created
  + resource "incapsula_application_delivery" "example_site" {
      + aggressive_compression      = false
      + compress_jpeg               = true
      + compress_png                = true
      + compression_type            = "GZIP"
      + enable_http2                = false
      + file_compression            = false
      + http2_to_origin             = false
      + id                          = (known after apply)
      + minify_css                  = true
      + minify_js                   = true
      + minify_static_html          = true
      + origin_connection_reuse     = true
      + port_to                     = 80
      + progressive_image_rendering = false
      + redirect_http_to_https      = false
      + redirect_naked_to_full      = false
      + site_id                     = 27746157
      + ssl_port_to                 = 443
      + support_non_sni_clients     = true
      + tcp_pre_pooling             = true
    }

Plan: 1 to add, 0 to change, 0 to destroy.
2023-09-13T18:36:29.708-0500 [DEBUG] command: asking for input: "\nDo you want to perform these actions?"

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

2023-09-13T18:36:31.933-0500 [INFO]  backend/local: apply calling Apply
2023-09-13T18:36:31.934-0500 [DEBUG] Building and walking apply graph for NormalMode plan
2023-09-13T18:36:31.934-0500 [DEBUG] Resource state not found for node "incapsula_application_delivery.example_site", instance incapsula_application_delivery.example_site
2023-09-13T18:36:31.934-0500 [DEBUG] ProviderTransformer: "incapsula_site.example_site (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/imperva/incapsula"]
2023-09-13T18:36:31.934-0500 [DEBUG] ProviderTransformer: "incapsula_application_delivery.example_site (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/imperva/incapsula"]
2023-09-13T18:36:31.934-0500 [DEBUG] ProviderTransformer: "incapsula_application_delivery.example_site" (*terraform.NodeApplyableResourceInstance) needs provider["registry.terraform.io/imperva/incapsula"]
2023-09-13T18:36:31.934-0500 [DEBUG] ReferenceTransformer: "incapsula_application_delivery.example_site (expand)" references: []
2023-09-13T18:36:31.934-0500 [DEBUG] ReferenceTransformer: "incapsula_application_delivery.example_site" references: [incapsula_site.example_site (expand)]
2023-09-13T18:36:31.934-0500 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/imperva/incapsula\"]" references: []
2023-09-13T18:36:31.934-0500 [DEBUG] ReferenceTransformer: "incapsula_site.example_site (expand)" references: []
2023-09-13T18:36:31.934-0500 [DEBUG] Starting graph walk: walkApply
2023-09-13T18:36:31.935-0500 [DEBUG] created provider logger: level=debug
2023-09-13T18:36:31.935-0500 [INFO]  provider: configuring client automatic mTLS
2023-09-13T18:36:31.946-0500 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/imperva/incapsula/3.20.2/darwin_amd64/terraform-provider-incapsula_v3.20.2 args=[.terraform/providers/registry.terraform.io/imperva/incapsula/3.20.2/darwin_amd64/terraform-provider-incapsula_v3.20.2]
2023-09-13T18:36:31.950-0500 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/imperva/incapsula/3.20.2/darwin_amd64/terraform-provider-incapsula_v3.20.2 pid=13476
2023-09-13T18:36:31.950-0500 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/imperva/incapsula/3.20.2/darwin_amd64/terraform-provider-incapsula_v3.20.2
2023-09-13T18:36:31.972-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: configuring server automatic mTLS: timestamp=2023-09-13T18:36:31.972-0500
2023-09-13T18:36:32.004-0500 [DEBUG] provider.terraform-provider-incapsula_v3.20.2: plugin address: address=/var/folders/_p/y4ffy6z96xg7y7880y1xx9gw0000gn/T/plugin4292754550 network=unix timestamp=2023-09-13T18:36:32.004-0500
2023-09-13T18:36:32.004-0500 [DEBUG] provider: using plugin: version=5
2023-09-13T18:36:32.032-0500 [WARN]  ValidateProviderConfig from "provider[\"registry.terraform.io/imperva/incapsula\"]" changed the config value, but that value is unused
2023-09-13T18:36:32.033-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:32 [INFO] Checking API credentials for client instantiation: timestamp=2023-09-13T18:36:32.033-0500
2023-09-13T18:36:32.033-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:32 [INFO] Checking API credentials against Incapsula API: timestamp=2023-09-13T18:36:32.033-0500
2023-09-13T18:36:32.648-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:32 [DEBUG] Incapsula account JSON response: REDACTED: timestamp=2023-09-13T18:36:32.647-0500
2023-09-13T18:36:32.652-0500 [WARN]  Provider "registry.terraform.io/imperva/incapsula" produced an invalid plan for incapsula_application_delivery.example_site, but we are tolerating it because it is using the legacy plugin SDK.
    The following problems may be the cause of any confusing errors from downstream operations:
      - .aggressive_compression: planned value cty.False for a non-computed attribute
      - .minify_css: planned value cty.True for a non-computed attribute
      - .minify_static_html: planned value cty.True for a non-computed attribute
      - .origin_connection_reuse: planned value cty.True for a non-computed attribute
      - .http2_to_origin: planned value cty.False for a non-computed attribute
      - .port_to: planned value cty.NumberIntVal(80) for a non-computed attribute
      - .tcp_pre_pooling: planned value cty.True for a non-computed attribute
      - .enable_http2: planned value cty.False for a non-computed attribute
      - .redirect_naked_to_full: planned value cty.False for a non-computed attribute
      - .minify_js: planned value cty.True for a non-computed attribute
      - .ssl_port_to: planned value cty.NumberIntVal(443) for a non-computed attribute
      - .progressive_image_rendering: planned value cty.False for a non-computed attribute
      - .redirect_http_to_https: planned value cty.False for a non-computed attribute
      - .compress_jpeg: planned value cty.True for a non-computed attribute
      - .compress_png: planned value cty.True for a non-computed attribute
      - .compression_type: planned value cty.StringVal("GZIP") for a non-computed attribute
      - .support_non_sni_clients: planned value cty.True for a non-computed attribute
incapsula_application_delivery.example_site: Creating...
2023-09-13T18:36:32.653-0500 [INFO]  Starting apply for incapsula_application_delivery.example_site
2023-09-13T18:36:32.653-0500 [DEBUG] incapsula_application_delivery.example_site: applying the planned Create change
2023-09-13T18:36:32.654-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:32 [INFO] Updating Incapsula Application Delivery for Site ID 27746157: timestamp=2023-09-13T18:36:32.654-0500
2023-09-13T18:36:33.026-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:33 [DEBUG] Incapsula Update Application Delivery JSON response: {"res":9415,"res_message":"Operation not allowed","debug_info":{"error":"This operation is unavailable because compression file is disabled. Please change compression file to enable","id-info":"999999"}}: timestamp=2023-09-13T18:36:33.026-0500
2023-09-13T18:36:33.026-0500 [INFO]  provider.terraform-provider-incapsula_v3.20.2: 2023/09/13 18:36:33 [ERROR] Could not get Incapsula Application Delivery for Site Id: 27746157 - Error status code 401 from Incapsula service when Updating Application Delivery for Site ID 27746157: {"res":9415,"res_message":"Operation not allowed","debug_info":{"error":"This operation is unavailable because compression file is disabled. Please change compression file to enable","id-info":"999999"}}: timestamp=2023-09-13T18:36:33.026-0500
2023-09-13T18:36:33.026-0500 [ERROR] provider.terraform-provider-incapsula_v3.20.2: Response contains error diagnostic: @caller=github.com/hashicorp/terraform-plugin-go@v0.14.1/tfprotov5/internal/diag/diagnostics.go:55 @module=sdk.proto diagnostic_summary="Error status code 401 from Incapsula service when Updating Application Delivery for Site ID 27746157: {"res":9415,"res_message":"Operation not allowed","debug_info":{"error":"This operation is unavailable because compression file is disabled. Please change compression file to enable","id-info":"999999"}}" tf_proto_version=5.3 tf_provider_addr=provider tf_req_id=9527b03d-398c-fa3b-1e83-f1a50f39cb52 tf_resource_type=incapsula_application_delivery diagnostic_detail= diagnostic_severity=ERROR tf_rpc=ApplyResourceChange timestamp=2023-09-13T18:36:33.026-0500
2023-09-13T18:36:33.050-0500 [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
2023-09-13T18:36:33.050-0500 [ERROR] vertex "incapsula_application_delivery.example_site" error: Error status code 401 from Incapsula service when Updating Application Delivery for Site ID 27746157: {"res":9415,"res_message":"Operation not allowed","debug_info":{"error":"This operation is unavailable because compression file is disabled. Please change compression file to enable","id-info":"999999"}}
╷
│ Error: Error status code 401 from Incapsula service when Updating Application Delivery for Site ID 27746157: {"res":9415,"res_message":"Operation not allowed","debug_info":{"error":"This operation is unavailable because compression file is disabled. Please change compression file to enable","id-info":"999999"}}
│ 
│   with incapsula_application_delivery.example_site,
│   on main.tf line 16, in resource "incapsula_application_delivery" "example_site":
│   16: resource "incapsula_application_delivery" "example_site" {
│ 
╵
2023-09-13T18:36:33.075-0500 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2023-09-13T18:36:33.078-0500 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/imperva/incapsula/3.20.2/darwin_amd64/terraform-provider-incapsula_v3.20.2 pid=13476
2023-09-13T18:36:33.078-0500 [DEBUG] provider: plugin exited

Panic output

No response

Expected output

Delivery settings should be applied:

incapsula_application_delivery.example_site: Creating...
incapsula_application_delivery.example_site: Creation complete after 1s [id=27746157]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

Actual output

Delivery settings are not applied:

incapsula_application_delivery.example_site: Creating...
╷
│ Error: Error status code 401 from Incapsula service when Updating Application Delivery for Site ID 27746157: {"res":9415,"res_message":"Operation not allowed","debug_info":{"error":"This operation is unavailable because compression file is disabled. Please change compression file to enable","id-info":"999999"}}
│ 
│   with incapsula_application_delivery.example_site,
│   on main.tf line 17, in resource "incapsula_application_delivery" "example_site":
│   17: resource "incapsula_application_delivery" "example_site" {
│ 
╵

Steps to reproduce

  1. Create the configuration as provided above.
  2. Replace api_id and api_key values with valid ones.
  3. terraform init
  4. terraform apply

Additional factoids

This bug appears to have been introduced in version 3.16.0 of the provider when compression_type was added to incapsula_application_delivery: https://github.com/imperva/terraform-provider-incapsula/commit/ca57dc21f30d5ba1ef9cf5677d3e91be44df284b I believe compression_type is always being set but should not be if file_compression = false. Downgrading to version 3.15.2 allows delivery settings to be successfully applied.

References

https://github.com/imperva/terraform-provider-incapsula/pull/301

joshsleeper commented 3 months ago

I believe this issue has been resolved on the Imperva API side of things, prompted by Imperva support case #01986025