-
Notifications
You must be signed in to change notification settings - Fork 1
/
data_source_nsxt_policy_vpc_nat_rule_test.go
71 lines (64 loc) · 2.49 KB
/
data_source_nsxt_policy_vpc_nat_rule_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/***************************************************************************
* ========================================================================
* Copyright 2022-2023 VMware, Inc. All rights reserved. VMware Confidential
* SPDX-License-Identifier: MPL-2.0
* ========================================================================
*/
// Auto generated code. DO NOT EDIT.
// nolint
package nsxt
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"testing"
)
func TestNSXTDataSourcePolicyVpcNatRuleBasic(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccNSXTDSPolicyVpcNatRuleConfig,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(
"nsxt_policy_vpc_nat_rule.testPolicyVpcNatRule", "translated_network", "192.168.4.0"),
resource.TestCheckResourceAttr(
"nsxt_policy_vpc_nat_rule.testPolicyVpcNatRule", "display_name", "test-natrule-abc"),
resource.TestCheckResourceAttr(
"nsxt_policy_vpc_nat_rule.testPolicyVpcNatRule", "description", "NatRule description"),
resource.TestCheckResourceAttr(
"nsxt_policy_vpc_nat_rule.testPolicyVpcNatRule", "enabled", "true"),
resource.TestCheckResourceAttr(
"nsxt_policy_vpc_nat_rule.testPolicyVpcNatRule", "nsx_id", "test-natrule-abc"),
resource.TestCheckResourceAttr(
"nsxt_policy_vpc_nat_rule.testPolicyVpcNatRule", "action", "SNAT"),
resource.TestCheckResourceAttr(
"nsxt_policy_vpc_nat_rule.testPolicyVpcNatRule", "logging", "false"),
resource.TestCheckResourceAttr(
"nsxt_policy_vpc_nat_rule.testPolicyVpcNatRule", "firewall_match", "MATCH_EXTERNAL_ADDRESS"),
resource.TestCheckResourceAttr(
"nsxt_policy_vpc_nat_rule.testPolicyVpcNatRule", "sequence_number", "10"),
),
},
},
})
}
const testAccNSXTDSPolicyVpcNatRuleConfig = `
resource "nsxt_policy_vpc_nat_rule" "testPolicyVpcNatRule" {
translated_network = "192.168.4.0"
display_name = "test-natrule-abc"
description = "NatRule description"
enabled = true
parent_path = "/orgs/default/projects/Dev_project/vpcs/dev_vpc/nat/USER"
nsx_id = "test-natrule-abc"
action = "SNAT"
logging = false
firewall_match = "MATCH_EXTERNAL_ADDRESS"
sequence_number = 10
}
data "nsxt_policy_vpc_nat_rule" "testPolicyVpcNatRule" {
display_name = nsxt_policy_vpc_nat_rule.testPolicyVpcNatRule.display_name
context {
scope = "vpc"
}
}
`