Skip to content
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

BUG: awscc_ses_mail_manager_rule_set not validating with emaill addresses in action.rewrite_recipient.replace_with #2067

Open
areis422 opened this issue Oct 17, 2024 · 1 comment

Comments

@areis422
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
  • The resources and data sources in this provider are generated from the CloudFormation schema, so they can only support the actions that the underlying schema supports. For this reason submitted bugs should be limited to defects in the generation and runtime code of the provider. Customizing behavior of the resource, or noting a gap in behavior are not valid bugs and should be submitted as enhancements to AWS via the CloudFormation Open Coverage Roadmap.

Terraform CLI and Terraform AWS Cloud Control Provider Version

Terraform v1.5.7
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v5.72.1
+ provider registry.terraform.io/hashicorp/awscc v1.16.1

Affected Resource(s)

  • awscc_ses_mail_manager_rule_set

Terraform Configuration Files

resource "awscc_ses_mail_manager_rule_set" "domain_rule_set" {
  rule_set_name = "use1-domain-ruleset"
  tags = [
    {
      key   = "Name"
      value = "use1-domain-ruleset"
    }
  ]
  rules = [
    {
      name = "original_from_at_domain_tld"
      actions = [
        {
          add_header = {
            header_name  = "X-SES-MailManager-Relayed"
            header_value = "Yes"
          }
        },
        {
          replace_recipient = {
            replace_with = [
                "[email protected]",
                "[email protected]",
                "[email protected]"
            ]
          }
        },
        {
          send = {
            role_arn = "arn:aws:iam::accountid:role/SESMailManagerServiceRole"
          }
        }
      ]
      conditions = [
        {
            string_expression = {
                evaluate = {
                    attribute = "RECIPIENT"
                }
                operator = "EQUALS"
                values = ["[email protected]"]
            }
        }
      ]
    }
  ]

}

Debug Output

$ TF_LOG=DEBUG terraform validate
2024-10-16T19:11:59.392-0500 [INFO]  Terraform version: 1.5.7
2024-10-16T19:11:59.392-0500 [DEBUG] using github.com/hashicorp/go-tfe v1.26.0
2024-10-16T19:11:59.392-0500 [DEBUG] using github.com/hashicorp/hcl/v2 v2.16.2
2024-10-16T19:11:59.392-0500 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.0
2024-10-16T19:11:59.392-0500 [DEBUG] using github.com/zclconf/go-cty v1.12.2
2024-10-16T19:11:59.392-0500 [INFO]  Go runtime version: go1.22.2
2024-10-16T19:11:59.392-0500 [INFO]  CLI args: []string{"terraform", "validate"}
2024-10-16T19:11:59.392-0500 [DEBUG] Attempting to open CLI config file: /Users/user/.terraformrc
2024-10-16T19:11:59.392-0500 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2024-10-16T19:11:59.394-0500 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2024-10-16T19:11:59.394-0500 [DEBUG] ignoring non-existing provider search directory /Users/user/.terraform.d/plugins
2024-10-16T19:11:59.394-0500 [DEBUG] ignoring non-existing provider search directory /Users/user/Library/Application Support/io.terraform/plugins
2024-10-16T19:11:59.394-0500 [DEBUG] ignoring non-existing provider search directory /Library/Application Support/io.terraform/plugins
2024-10-16T19:11:59.395-0500 [INFO]  CLI command args: []string{"validate"}
2024-10-16T19:12:00.234-0500 [DEBUG] checking for provisioner in "."
2024-10-16T19:12:00.239-0500 [DEBUG] checking for provisioner in "/opt/homebrew/bin"
2024-10-16T19:12:00.239-0500 [DEBUG] Building and walking validate graph
2024-10-16T19:12:00.240-0500 [DEBUG] adding implicit provider configuration provider["terraform.io/builtin/terraform"], implied first by data.terraform_remote_state.global
2024-10-16T19:12:00.240-0500 [DEBUG] ProviderTransformer: "data.terraform_remote_state.usw2" (*terraform.NodeValidatableResource) needs provider["terraform.io/builtin/terraform"]
2024-10-16T19:12:00.240-0500 [DEBUG] ProviderTransformer: "awscc_ses_mail_manager_rule_set.wisp_rule_set" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/hashicorp/awscc"]
2024-10-16T19:12:00.240-0500 [DEBUG] ProviderTransformer: "data.terraform_remote_state.use2" (*terraform.NodeValidatableResource) needs provider["terraform.io/builtin/terraform"]
2024-10-16T19:12:00.240-0500 [DEBUG] ProviderTransformer: "data.terraform_remote_state.global" (*terraform.NodeValidatableResource) needs provider["terraform.io/builtin/terraform"]
2024-10-16T19:12:00.240-0500 [DEBUG] pruning unused provider["registry.terraform.io/hashicorp/aws"].Oregon
2024-10-16T19:12:00.240-0500 [DEBUG] pruning unused provider["registry.terraform.io/hashicorp/aws"].Ohio
2024-10-16T19:12:00.240-0500 [DEBUG] pruning unused provider["registry.terraform.io/hashicorp/aws"]
2024-10-16T19:12:00.240-0500 [ERROR] AttachSchemaTransformer: No provider config schema available for provider["terraform.io/builtin/terraform"]
2024-10-16T19:12:00.240-0500 [DEBUG] created provider logger: level=debug
2024-10-16T19:12:00.240-0500 [INFO]  provider: configuring client automatic mTLS
2024-10-16T19:12:00.247-0500 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/hashicorp/awscc/1.16.1/darwin_arm64/terraform-provider-awscc_v1.16.1_x5 args=[.terraform/providers/registry.terraform.io/hashicorp/awscc/1.16.1/darwin_arm64/terraform-provider-awscc_v1.16.1_x5]
2024-10-16T19:12:00.251-0500 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/hashicorp/awscc/1.16.1/darwin_arm64/terraform-provider-awscc_v1.16.1_x5 pid=76145
2024-10-16T19:12:00.251-0500 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/hashicorp/awscc/1.16.1/darwin_arm64/terraform-provider-awscc_v1.16.1_x5
2024-10-16T19:12:00.845-0500 [INFO]  provider.terraform-provider-awscc_v1.16.1_x5: configuring server automatic mTLS: timestamp=2024-10-16T19:12:00.844-0500
2024-10-16T19:12:00.854-0500 [DEBUG] provider.terraform-provider-awscc_v1.16.1_x5: plugin address: address=/var/folders/2h/jt7v5_wj4nl929zd_mnnpd180000gq/T/plugin1555098599 network=unix timestamp=2024-10-16T19:12:00.854-0500
2024-10-16T19:12:00.854-0500 [DEBUG] provider: using plugin: version=6
2024-10-16T19:12:01.130-0500 [DEBUG] No provider meta schema returned
2024-10-16T19:12:01.190-0500 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-10-16T19:12:01.193-0500 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/awscc/1.16.1/darwin_arm64/terraform-provider-awscc_v1.16.1_x5 pid=76145
2024-10-16T19:12:01.193-0500 [DEBUG] provider: plugin exited
2024-10-16T19:12:01.193-0500 [DEBUG] ReferenceTransformer: "data.terraform_remote_state.usw2" references: []
2024-10-16T19:12:01.193-0500 [DEBUG] ReferenceTransformer: "data.terraform_remote_state.global" references: []
2024-10-16T19:12:01.193-0500 [DEBUG] ReferenceTransformer: "data.terraform_remote_state.use2" references: []
2024-10-16T19:12:01.193-0500 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/hashicorp/awscc\"]" references: []
2024-10-16T19:12:01.193-0500 [DEBUG] ReferenceTransformer: "provider[\"terraform.io/builtin/terraform\"]" references: []
2024-10-16T19:12:01.193-0500 [DEBUG] ReferenceTransformer: "awscc_ses_mail_manager_rule_set.wisp_rule_set" references: []
2024-10-16T19:12:01.193-0500 [DEBUG] Starting graph walk: walkValidate
2024-10-16T19:12:01.193-0500 [DEBUG] created provider logger: level=debug
2024-10-16T19:12:01.193-0500 [INFO]  provider: configuring client automatic mTLS
2024-10-16T19:12:01.197-0500 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/hashicorp/awscc/1.16.1/darwin_arm64/terraform-provider-awscc_v1.16.1_x5 args=[.terraform/providers/registry.terraform.io/hashicorp/awscc/1.16.1/darwin_arm64/terraform-provider-awscc_v1.16.1_x5]
2024-10-16T19:12:01.200-0500 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/hashicorp/awscc/1.16.1/darwin_arm64/terraform-provider-awscc_v1.16.1_x5 pid=76146
2024-10-16T19:12:01.200-0500 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/hashicorp/awscc/1.16.1/darwin_arm64/terraform-provider-awscc_v1.16.1_x5
2024-10-16T19:12:01.769-0500 [INFO]  provider.terraform-provider-awscc_v1.16.1_x5: configuring server automatic mTLS: timestamp=2024-10-16T19:12:01.768-0500
2024-10-16T19:12:01.780-0500 [DEBUG] provider: using plugin: version=6
2024-10-16T19:12:01.780-0500 [DEBUG] provider.terraform-provider-awscc_v1.16.1_x5: plugin address: address=/var/folders/2h/jt7v5_wj4nl929zd_mnnpd180000gq/T/plugin2431824647 network=unix timestamp=2024-10-16T19:12:01.780-0500
2024-10-16T19:12:01.787-0500 [DEBUG] skipping FixUpBlockAttrs
2024-10-16T19:12:01.787-0500 [DEBUG] Initializing remote state backend: s3
2024-10-16T19:12:01.788-0500 [DEBUG] Initializing remote state backend: s3
2024-10-16T19:12:01.788-0500 [DEBUG] Initializing remote state backend: s3
2024-10-16T19:12:02.053-0500 [DEBUG] No provider meta schema returned
2024-10-16T19:12:02.108-0500 [ERROR] provider.terraform-provider-awscc_v1.16.1_x5: Response contains error diagnostic: @caller=github.com/hashicorp/[email protected]/tfprotov6/internal/diag/diagnostics.go:58 diagnostic_detail="Attribute rules[0].actions[1].replace_recipient.replace_with[0] value must match regular expression '^[0-9A-Za-z@+.-]+$', got: [email protected]" tf_resource_type=awscc_ses_mail_manager_rule_set @module=sdk.proto tf_rpc=ValidateResourceConfig diagnostic_attribute=AttributeName("rules").ElementKeyInt(0).AttributeName("actions").ElementKeyInt(1).AttributeName("replace_recipient").AttributeName("replace_with").ElementKeyInt(0) tf_provider_addr=registry.terraform.io/hashicorp/awscc diagnostic_severity=ERROR diagnostic_summary="Invalid Attribute Value Match" tf_proto_version=6.6 tf_req_id=b82c6063-0ab0-a96a-f312-95c72e1f8903 timestamp=2024-10-16T19:12:02.108-0500
2024-10-16T19:12:02.108-0500 [ERROR] vertex "awscc_ses_mail_manager_rule_set.wisp_rule_set" error: Invalid Attribute Value Match
╷
│ Error: Invalid Attribute Value Match
│ 
│   with awscc_ses_mail_manager_rule_set.wisp_rule_set,
│   on ses_mail_manager_ruleset.tf line 1, in resource "awscc_ses_mail_manager_rule_set" "wisp_rule_set":
│    1: resource "awscc_ses_mail_manager_rule_set" "wisp_rule_set" {
│ 
│ Attribute rules[0].actions[1].replace_recipient.replace_with[0] value must match regular expression '^[0-9A-Za-z@+.-]+$', got: [email protected]
╵
2024-10-16T19:12:02.110-0500 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-10-16T19:12:02.112-0500 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/awscc/1.16.1/darwin_arm64/terraform-provider-awscc_v1.16.1_x5 pid=76146
2024-10-16T19:12:02.112-0500 [DEBUG] provider: plugin exited

Expected Behavior

It works as intended

Actual Behavior

Error validating email address string in list

Steps to Reproduce

  1. terraform validate
@quixoticmonk
Copy link
Collaborator

quixoticmonk commented Nov 1, 2024

Thank you for opening the issue @areis422 . To clarify, is the issue you are facing around a valid email id not being matched with the regex used in the validate ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants