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

Add nat type to nat rule resource #1480

Merged
merged 1 commit into from
Dec 13, 2024
Merged

Add nat type to nat rule resource #1480

merged 1 commit into from
Dec 13, 2024

Conversation

annakhm
Copy link
Collaborator

@annakhm annakhm commented Dec 10, 2024

No description provided.

@annakhm annakhm force-pushed the add-nat-type branch 2 times, most recently from 494508f to 51dbc46 Compare December 10, 2024 19:37
@annakhm
Copy link
Collaborator Author

annakhm commented Dec 10, 2024

PASS: TestAccResourceNsxtPolicyNATRuleT1_natType (48.34s)
PASS: TestAccResourceNsxtPolicyNATRule_minimalT0 (26.83s)
PASS: TestAccResourceNsxtPolicyNATRule_basicT1Import (34.93s)
PASS: TestAccResourceNsxtPolicyNATRuleNoSnatWithoutTNet (41.86s)
PASS: TestAccResourceNsxtPolicyNATRule_nat64T1 (46.48s)
PASS: TestAccResourceNsxtPolicyNATRule_withPolicyBasedVpnMode (46.61s)
PASS: TestAccResourceNsxtPolicyNATRule_basicT0 (52.45s)
PASS: TestAccResourceNsxtPolicyNATRuleT1_natType (60.76s)
PASS: TestAccResourceNsxtPolicyNATRule_basic_T1 (65.04s)
PASS: TestAccResourceNsxtPolicyNATRule_basicT1Import_multitenancy (27.56s)
PASS: TestAccResourceNsxtPolicyNATRule_basicT1_multitenancy (55.67s)

@annakhm annakhm force-pushed the add-nat-type branch 2 times, most recently from aee1f8b to 77d7615 Compare December 12, 2024 01:53
nsxt/resource_nsxt_policy_nat_rule.go Show resolved Hide resolved
if err != nil {
return handleCreateError("NAT Rule", id, err)
}

d.SetId(id)
d.Set("nsx_id", id)
// In case nat type was not specified or got overridden by action
d.Set("type", natType)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this to restore any change that might have been done in line 311?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is create flow - if nat type was left blank by the user, we need to set the Computed nat type that was determined in line 372

nsxt/resource_nsxt_policy_nat_rule.go Show resolved Hide resolved
Before this change, only NAT64 and USER nat types were supported,
and the value was calculated based on action.
With this change, we need to keep in mind refresh of existing
nat rule resources, hence the new type will be calculated.

Signed-off-by: Anna Khmelnitsky <[email protected]>
Copy link
Member

@salv-orlando salv-orlando left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

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

Successfully merging this pull request may close these issues.

2 participants