Skip to content

Commit

Permalink
Merge pull request #1244 from vmware/rename-vpc
Browse files Browse the repository at this point in the history
Rename VPC data source according to convention
  • Loading branch information
annakhm authored Jul 5, 2024
2 parents c16f2b7 + ec2ec23 commit 9a7d2a9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"github.com/vmware/vsphere-automation-sdk-go/services/nsxt/model"
)

func dataSourceNsxtPolicyVPC() *schema.Resource {
func dataSourceNsxtVPC() *schema.Resource {
return &schema.Resource{
Read: dataSourceNsxtPolicyVPCRead,
Read: dataSourceNsxtVPCRead,
Schema: map[string]*schema.Schema{
"id": getDataSourceIDSchema(),
"display_name": getDataSourceDisplayNameSchema(),
Expand All @@ -26,7 +26,7 @@ func dataSourceNsxtPolicyVPC() *schema.Resource {
}
}

func dataSourceNsxtPolicyVPCRead(d *schema.ResourceData, m interface{}) error {
func dataSourceNsxtVPCRead(d *schema.ResourceData, m interface{}) error {
obj, err := policyDataSourceResourceRead(d, getPolicyConnector(m), getSessionContext(d, m), "Vpc", nil)
if err != nil {
return err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
"github.com/vmware/vsphere-automation-sdk-go/services/nsxt/orgs/projects"
)

func TestAccDataSourceNsxtPolicyVPC_basic_multitenancy(t *testing.T) {
func TestAccDataSourceNsxtVPC_basic_multitenancy(t *testing.T) {
name := getAccTestDataSourceName()
testResourceName := "data.nsxt_policy_vpc.test"
testResourceName := "data.nsxt_vpc.test"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() {
Expand All @@ -26,16 +26,16 @@ func TestAccDataSourceNsxtPolicyVPC_basic_multitenancy(t *testing.T) {
},
Providers: testAccProviders,
CheckDestroy: func(state *terraform.State) error {
return testAccDataSourceNsxtPolicyVPCDeleteByName(name)
return testAccDataSourceNsxtVPCDeleteByName(name)
},
Steps: []resource.TestStep{
{
PreConfig: func() {
if err := testAccDataSourceNsxtPolicyVPCCreate(name); err != nil {
if err := testAccDataSourceNsxtVPCCreate(name); err != nil {
t.Error(err)
}
},
Config: testAccNsxtPolicyVPCReadTemplate(name),
Config: testAccNsxtVPCReadTemplate(name),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(testResourceName, "display_name", name),
resource.TestCheckResourceAttr(testResourceName, "description", name),
Expand All @@ -47,7 +47,7 @@ func TestAccDataSourceNsxtPolicyVPC_basic_multitenancy(t *testing.T) {
})
}

func testAccDataSourceNsxtPolicyVPCCreate(name string) error {
func testAccDataSourceNsxtVPCCreate(name string) error {

connector, err := testAccGetPolicyConnector()
if err != nil {
Expand Down Expand Up @@ -87,7 +87,7 @@ func testAccDataSourceNsxtPolicyVPCCreate(name string) error {
return nil
}

func testAccDataSourceNsxtPolicyVPCDeleteByName(name string) error {
func testAccDataSourceNsxtVPCDeleteByName(name string) error {
connector, err := testAccGetPolicyConnector()
if err != nil {
return fmt.Errorf("error during test client initialization: %v", err)
Expand All @@ -113,14 +113,14 @@ func testAccDataSourceNsxtPolicyVPCDeleteByName(name string) error {
return fmt.Errorf("error while deleting VPC '%s': resource not found", name)
}

func testAccNsxtPolicyVPCReadTemplate(name string) string {
func testAccNsxtVPCReadTemplate(name string) string {
context := testAccNsxtPolicyMultitenancyContext()
return fmt.Sprintf(`
data "nsxt_policy_ip_block" "test" {
%s
display_name = "%s"
}
data "nsxt_policy_vpc" "test" {
data "nsxt_vpc" "test" {
%s
display_name = "%s"
}`, context, name, context, name)
Expand Down
2 changes: 1 addition & 1 deletion nsxt/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ func Provider() *schema.Provider {
"nsxt_policy_distributed_flood_protection_profile": dataSourceNsxtPolicyDistributedFloodProtectionProfile(),
"nsxt_policy_gateway_flood_protection_profile": dataSourceNsxtPolicyGatewayFloodProtectionProfile(),
"nsxt_manager_info": dataSourceNsxtManagerInfo(),
"nsxt_policy_vpc": dataSourceNsxtPolicyVPC(),
"nsxt_vpc": dataSourceNsxtVPC(),
},

ResourcesMap: map[string]*schema.Resource{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
subcategory: "Multitenancy"
layout: "nsxt"
page_title: "NSXT: policy_vpc"
description: Policy VPC data source.
page_title: "NSXT: vpc"
description: VPC data source.
---

# nsxt_policy_vpc
# nsxt_vpc

This data source provides information about policy VPC configured on NSX.
This data source provides information about VPC configured on NSX.
This data source is applicable to NSX Policy Manager.

## Example Usage
Expand All @@ -17,7 +17,7 @@ data "nsxt_policy_project" "demoproj" {
display_name = "demoproj"
}
data "nsxt_policy_vpc" "test" {
data "nsxt_vpc" "test" {
context {
project_id = data.nsxt_policy_project.demoproj.id
}
Expand Down

0 comments on commit 9a7d2a9

Please sign in to comment.