@@ -117,6 +117,28 @@ func TestAccResourceNsxtVpc_basic(t *testing.T) {
117
117
})
118
118
}
119
119
120
+ func TestAccResourceNsxtVpc_withID (t * testing.T ) {
121
+ testResourceName := "nsxt_vpc.test"
122
+
123
+ resource .Test (t , resource.TestCase {
124
+ PreCheck : func () { testAccPreCheck (t ); testAccOnlyVPC (t ) },
125
+ Providers : testAccProviders ,
126
+ CheckDestroy : func (state * terraform.State ) error {
127
+ return testAccNsxtVpcCheckDestroy (state , accTestVpcCreateAttributes ["display_name" ])
128
+ },
129
+ Steps : []resource.TestStep {
130
+ {
131
+ Config : testAccNsxtVpcWithID (),
132
+ Check : resource .ComposeTestCheckFunc (
133
+ testAccNsxtVpcExists (accTestVpcCreateAttributes ["display_name" ], testResourceName ),
134
+ resource .TestCheckResourceAttr (testResourceName , "display_name" , accTestVpcCreateAttributes ["display_name" ]),
135
+ resource .TestCheckResourceAttr (testResourceName , "short_id" , accTestVpcCreateAttributes ["short_id" ]),
136
+ ),
137
+ },
138
+ },
139
+ })
140
+ }
141
+
120
142
func TestAccResourceNsxtVpc_importBasic (t * testing.T ) {
121
143
name := getAccTestResourceName ()
122
144
testResourceName := "nsxt_vpc.test"
@@ -262,6 +284,17 @@ resource "nsxt_vpc" "test" {
262
284
}` , testAccNsxtProjectContext (), accTestVpcUpdateAttributes ["display_name" ], accTestVpcUpdateAttributes ["short_id" ])
263
285
}
264
286
287
+ func testAccNsxtVpcWithID () string {
288
+ return testAccNsxtVpcPrerequisites () + fmt .Sprintf (`
289
+ resource "nsxt_vpc" "test" {
290
+ %s
291
+
292
+ nsx_id = "test.%s"
293
+ display_name = "%s"
294
+ short_id = "%s"
295
+ }` , testAccNsxtProjectContext (), accTestVpcCreateAttributes ["display_name" ], accTestVpcCreateAttributes ["display_name" ], accTestVpcCreateAttributes ["short_id" ])
296
+ }
297
+
265
298
// We use short_id as nsx_id to make sure NSX populates the short_id correctly
266
299
func testAccNsxtVpcMinimalisticNoShortId () string {
267
300
return testAccNsxtVpcPrerequisites () + fmt .Sprintf (`
0 commit comments