Network Firewall Proxy Resources (Preview) #46939
Draft
alexbacchin wants to merge 20 commits intohashicorp:mainfrom
Draft
Network Firewall Proxy Resources (Preview) #46939alexbacchin wants to merge 20 commits intohashicorp:mainfrom
alexbacchin wants to merge 20 commits intohashicorp:mainfrom
Conversation
Contributor
Community GuidelinesThis comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀 Voting for Prioritization
Pull Request Authors
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds Terraform support for AWS Network Firewall Proxy, a managed HTTP/HTTPS forward proxy that integrates with NAT Gateways. Five new resources are introduced:
aws_networkfirewall_proxyaws_networkfirewall_proxy_configurationaws_networkfirewall_proxy_rule_groupaws_networkfirewall_proxy_rules_exclusiveaws_networkfirewall_proxy_configuration_rule_group_attachments_exclusiveResource Hierarchy
Design Decisions
Exclusive Resources for Rules and Rule Group Attachments
The Network Firewall Proxy API manages rules and rule group attachments independently from the parent resources (
ProxyRuleGroupandProxyConfiguration). This mirrors existing patterns in the AWS provider (e.g.aws_iam_role_policies_exclusive).Two exclusive resources are used instead of embedding everything into parent resources:
aws_networkfirewall_proxy_rules_exclusive— owns all rules in a proxy rule group. Any rule not declared in Terraform will be removed. This provides predictable, authoritative management.aws_networkfirewall_proxy_configuration_rule_group_attachments_exclusive— owns all rule group attachments for a proxy configuration with the same authoritative behaviour.This split allows
aws_networkfirewall_proxy_rule_groupandaws_networkfirewall_proxy_configurationto remain lightweight resources (name, description, tags), while rule content and group membership are managed separately. It also enables independent lifecycle management — e.g. attaching/detaching rule groups without destroying the configuration.Rule Ordering and
InsertPositionThe Network Firewall Proxy API requires an
InsertPositioninteger when creating rules, and rules are evaluated in the order they were inserted. The API does not expose a singleUpdateProxyRulescall that replaces the full rule set — instead it uses:CreateProxyRules(withInsertPosition)UpdateProxyRule(modifies action/conditions of an existing rule by name)DeleteProxyRules(removes rules by name)This creates a challenge for Terraform: the API's positional model does not map cleanly to a declarative
set. Using asetwould lose ordering guarantees, and using amapwould require users to manage positions manually.Decision: Rules are modelled as ordered
listblocks within each request phase (pre_dns,pre_request,post_response). The list index directly corresponds toInsertPosition. This gives users a natural, readable way to control rule order in HCL:Update logic: During updates, the resource compares plan vs. state position-by-position per phase:
UpdateProxyRuleInsertPositionDeleteProxyRulesCreateProxyRuleswith appropriate positionDeletions are always processed before creations to satisfy the API's uniqueness constraint on
proxy_rule_namewithin a rule group.Rule Group Attachment Ordering
Similarly, rule group attachments within a proxy configuration have an API-managed priority. The
aws_networkfirewall_proxy_configuration_rule_group_attachments_exclusiveresource uses an orderedrule_grouplist, where list index maps toInsertPosition/priority. Reordering is handled viaUpdateProxyRuleGroupPriorities.TLS Interception
The
aws_networkfirewall_proxyresource supports TLS interception via thetls_intercept_propertiesblock. Whentls_intercept_mode = "ENABLED", an AWS Private CA ARN (pca_arn) must be provided. TLS interception is required for HTTP field inspection (URI, headers, method) on HTTPS traffic.Listener Properties
The proxy supports up to 2 listener configurations (
HTTPon port 8080,HTTPSon port 443 are typical). Listeners can be updated in-place usingListenerPropertiesToAdd/ListenerPropertiesToRemoveAPI fields without replacement of the proxy.Serial Acceptance Tests
The Proxy API enforces strict concurrency limits during preview. All acceptance tests for these resources are serialised via a single
TestAccNetworkFirewallProxy_serialtest function usingacctest.RunSerialTests2Levels.End-to-End Example
Test Coverage
aws_networkfirewall_proxyaws_networkfirewall_proxy_configurationaws_networkfirewall_proxy_rule_groupaws_networkfirewall_proxy_rules_exclusiveaws_networkfirewall_proxy_configuration_rule_group_attachments_exclusiveOpen Questions / Known Limitations
UpdateProxyRulefor conditions) were found to behave unexpectedly during testing. These may be resolved before GA.proxy_rule_nameuniqueness: Rule names must be unique across all phases within a rule group. The resource enforces this via delete-before-create ordering during updates.ListProxiespagination: The current implementation uses ARN-based describe calls; no list data sources are included in this PR.References
Closes #45265
AI Disclosure
All code in this PR was generated by Claude Code (Anthropic's AI coding assistant). The resource design decisions — including the exclusive resource pattern, ordered list modelling for rules/attachments, update strategy (delete-before-create), and the overall resource hierarchy — were made by the PR author. Claude Code was used to implement those decisions, write tests, and fix CI lint/formatting issues.
🤖 Generated with Claude Code