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
72
forks
source link
Error when using "+" symbols in email addresses #291
incapsula_account_user.user_1: Refreshing state... [id=0000000/example+api_user@example.com]
2023-02-06T15:15:28.641-0700 [INFO] provider.terraform-provider-incapsula_v3.15.1: 2023/02/06 15:15:28 [INFO] Reading Incapsula user : 0000000/example+api_user@example.com: timestamp=2023-02-06T15:15:28.641-0700
2023-02-06T15:15:28.641-0700 [INFO] provider.terraform-provider-incapsula_v3.15.1: 2023/02/06 15:15:28 [INFO] Getting Incapsula user status for email id: example+api_user@example.com: timestamp=2023-02-06T15:15:28.641-0700
2023-02-06T15:15:28.641-0700 [INFO] provider.terraform-provider-incapsula_v3.15.1: 2023/02/06 15:15:28 [DEBUG] Waiting for state to become: [success]: timestamp=2023-02-06T15:15:28.641-0700
2023-02-06T15:15:28.765-0700 [INFO] provider.terraform-provider-incapsula_v3.15.1: 2023/02/06 15:15:28 [DEBUG] Incapsula user status JSON response: {"errors":[{"status":400,"id":"REDACTED","source":{"pointer":"/v3/users"},"title":"Input validation error","detail":"getUserByUserEmail.email: must be a well-formed email address"}]}: timestamp=2023-02-06T15:15:28.765-0700
2023-02-06T15:15:28.765-0700 [INFO] provider.terraform-provider-incapsula_v3.15.1: 2023/02/06 15:15:28 [ERROR] Could not read Incapsula user: example+api_user@example.com, Error status code 400 from Incapsula service when getting User example+api_user@example.com: {"errors":[{"status":400,"id":"REDACTED","source":{"pointer":"/v3/users"},"title":"Input validation error","detail":"getUserByUserEmail.email: must be a well-formed email address"}]}: timestamp=2023-02-06T15:15:28.765-0700
2023-02-06T15:15:28.765-0700 [ERROR] provider.terraform-provider-incapsula_v3.15.1: Response contains error diagnostic: @caller=github.com/hashicorp/terraform-plugin-go@v0.14.1/tfprotov5/internal/diag/diagnostics.go:55 @module=sdk.proto diagnostic_severity=ERROR diagnostic_summary="Error status code 400 from Incapsula service when getting User example+api_user@example.com: {"errors":[{"status":400,"id":"REDACTED","source":{"pointer":"/v3/users"},"title":"Input validation error","detail":"getUserByUserEmail.email: must be a well-formed email address"}]}" tf_req_id=REDACTED tf_resource_type=incapsula_account_user diagnostic_detail= tf_proto_version=5.3 tf_provider_addr=provider tf_rpc=ReadResource timestamp=2023-02-06T15:15:28.765-0700
2023-02-06T15:15:28.765-0700 [ERROR] vertex "incapsula_account_user.user_1" error: Error status code 400 from Incapsula service when getting User example+api_user@example.com: {"errors":[{"status":400,"id":"REDACTED","source":{"pointer":"/v3/users"},"title":"Input validation error","detail":"getUserByUserEmail.email: must be a well-formed email address"}]}
2023-02-06T15:15:28.765-0700 [ERROR] vertex "incapsula_account_user.user_1 (expand)" error: Error status code 400 from Incapsula service when getting User example+api_user@example.com: {"errors":[{"status":400,"id":"REDACTED","source":{"pointer":"/v3/users"},"title":"Input validation error","detail":"getUserByUserEmail.email: must be a well-formed email address"}]}
023-02-06T15:15:28.767-0700 [INFO] backend/local: plan operation completed
│ Error: Error status code 400 from Incapsula service when getting User example+api_user@example.com: {"errors":[{"status":400,"id":"REDACTED","source":{"pointer":"/v3/users"},"title":"Input validation error","detail":"getUserByUserEmail.email: must be a well-formed email address"}]}
│
│ with incapsula_account_user.user_1,
│ on api_users.tf line 299, in resource "incapsula_account_user" "user_1":
│ 299: resource "incapsula_account_user" "user_1" {
│
╵
2023-02-06T15:15:28.775-0700 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2023-02-06T15:15:28.778-0700 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/imperva/incapsula/3.15.1/darwin_amd64/terraform-provider-incapsula_v3.15.1 pid=49713
2023-02-06T15:15:28.778-0700 [DEBUG] provider: plugin exited
Panic output
No response
Expected output
Either the API needs to permit + in the validator, or the TF module should url encode + to %2B where appropriate.
For example, the following fails with the same error:
Confirmation
Terraform and Imperva provider version
Terraform v1.3.7 on darwin_amd64
Affected resource(s)
incapsula_account_user
Terraform configuration files
Debug output
Panic output
No response
Expected output
Either the API needs to permit
+
in the validator, or the TF module should url encode+
to%2B
where appropriate.For example, the following fails with the same error:
Where this succeeds:
Actual output
When working with a valid email string that contains a
+
(plus) symbol, the provider fails to properly parse the email address and fails to continue.Steps to reproduce
New User Resource:
+
alias notation in the email address.Error status code 400 from Incapsula service when getting User example+test@example.com:
Existing User Resource:
+
alias notation in the email address.Error status code 400 from Incapsula service when getting User example+test@example.com:
Additional factoids
+
is a valid character in the 'local part' of an email address.References
https://www.rfc-editor.org/rfc/rfc3696#section-3