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

aws_networkfirewall_rule_group: cannot update suricata rules #19414

Closed
arpyzo opened this issue May 17, 2021 · 3 comments · Fixed by #19430
Closed

aws_networkfirewall_rule_group: cannot update suricata rules #19414

arpyzo opened this issue May 17, 2021 · 3 comments · Fixed by #19430
Labels
bug Addresses a defect in current functionality. service/networkfirewall Issues and PRs that pertain to the networkfirewall service.
Milestone

Comments

@arpyzo
Copy link

arpyzo commented May 17, 2021

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

Terraform CLI and Terraform AWS Provider Version

Terraform v0.15.3

  • provider registry.terraform.io/hashicorp/aws v3.40.0

Affected Resource(s)

  • aws_networkfirewall_rule_group

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

resource "aws_networkfirewall_rule_group" "main" {
  name     = "set1"
  type     = "STATEFUL"
  rules    = file("set1.rules")
  capacity = 100
}

Suricata rules set1.rules pre-update:

pass tls $HOME_NET any -> $EXTERNAL_NET 443 (tls.sni; content:"OLD.example.com"; msg:"FQDN test"; sid:1;)

Suricate rules set1.rules post-update:

pass tls $HOME_NET any -> $EXTERNAL_NET 443 (tls.sni; content:"NEW.example.com"; msg:"FQDN test"; sid:1;)

Debug Output

Running terraform apply:

Terraform will perform the following actions:

  # aws_networkfirewall_rule_group.main will be updated in-place
  ~ resource "aws_networkfirewall_rule_group" "main" {
        id           = "arn:aws:network-firewall:us-east-1:000000000000:stateful-rulegroup/set1"
        name         = "set1"
      ~ rules        = <<-EOT
          - pass tls $HOME_NET any -> $EXTERNAL_NET 443 (tls.sni; content:"OLD.example.com"; msg:"FQDN test"; sid:1;)
          + pass tls $HOME_NET any -> $EXTERNAL_NET 443 (tls.sni; content:"NEW.example.com"; msg:"FQDN test"; sid:1;)
        EOT
        tags         = {}
        # (5 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

When applied the following occurs:

aws_networkfirewall_rule_group.main: Modifying... [id=arn:aws:network-firewall:us-east-1:000000000000:stateful-rulegroup/set1]
╷
│ Error: error updating NetworkFirewall Rule Group (arn:aws:network-firewall:us-east-1:000000000000:stateful-rulegroup/set1): InvalidRequestException: Exactly one of Rules or RuleGroup must be set
│
│   with aws_networkfirewall_rule_group.main,
│   on firewall_rules.tf line 1, in resource "aws_networkfirewall_rule_group" "main":
│    1: resource "aws_networkfirewall_rule_group" "main" {
│

Expected Behavior

Applying this change should update the firewall rule group.

Actual Behavior

An error was generated, and the rules were not updated in AWS.

Even though an error ocurred, Terraform updated its state. A subsequent plan/apply shows no changes.

Steps to Reproduce

  1. terraform apply
  2. Update set1.rules
  3. terraform apply
  4. Run terraform apply again and see that Terraform's state has been updated.
@ghost ghost added the service/networkfirewall Issues and PRs that pertain to the networkfirewall service. label May 17, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label May 17, 2021
@anGie44 anGie44 added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels May 18, 2021
@anGie44
Copy link
Contributor

anGie44 commented May 18, 2021

Associated code block causing the error (in this case RuleGroup is Computed so also being added to the input struct):

https://github.com/hashicorp/terraform-provider-aws/blob/main/aws/resource_aws_networkfirewall_rule_group.go#L504-L524

@ghost
Copy link

ghost commented May 20, 2021

This has been released in version 3.42.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/networkfirewall Issues and PRs that pertain to the networkfirewall service.
Projects
None yet
2 participants