Skip to content

Commit

Permalink
Fix yTier0Gateway redistribution for NSX v4.1.1
Browse files Browse the repository at this point in the history
TestAccResourceNsxtPolicyTier0Gateway_redistribution test fails with the following error:

    resource_nsxt_policy_tier0_gateway_test.go:204: Step 2/3 error: Error running apply: exit status 1

        Error: A valid edge_cluster_path is required when BGP is enabled

          with nsxt_policy_tier0_gateway.test,
          on terraform_plugin_test.tf line 3, in resource "nsxt_policy_tier0_gateway" "test":
           3: resource "nsxt_policy_tier0_gateway" "test" {

To resolve, added the edge cluster configuration.

Signed-off-by: Kobi Samoray <[email protected]>
  • Loading branch information
ksamoray committed Nov 30, 2023
1 parent 2e5e2bc commit f23daa0
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions nsxt/resource_nsxt_policy_tier0_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -841,8 +841,13 @@ resource "nsxt_policy_tier0_gateway_interface" "parent-loopback" {

func testAccNsxtPolicyTier0CreateWithRedistribution(name string) string {
return fmt.Sprintf(`
data "nsxt_policy_edge_cluster" "EC" {
display_name = "%s"
}
resource "nsxt_policy_tier0_gateway" "test" {
display_name = "%s"
edge_cluster_path = data.nsxt_policy_edge_cluster.EC.path
redistribution_config {
enabled = false
ospf_enabled = false
Expand All @@ -855,13 +860,18 @@ resource "nsxt_policy_tier0_gateway" "test" {
data "nsxt_policy_realization_info" "realization_info" {
path = nsxt_policy_tier0_gateway.test.path
}`, name)
}`, getEdgeClusterName(), name)
}

func testAccNsxtPolicyTier0UpdateWithRedistribution(name string) string {
return fmt.Sprintf(`
data "nsxt_policy_edge_cluster" "EC" {
display_name = "%s"
}
resource "nsxt_policy_tier0_gateway" "test" {
display_name = "%s"
edge_cluster_path = data.nsxt_policy_edge_cluster.EC.path
redistribution_config {
enabled = false
ospf_enabled = false
Expand All @@ -877,7 +887,7 @@ resource "nsxt_policy_tier0_gateway" "test" {
data "nsxt_policy_realization_info" "realization_info" {
path = nsxt_policy_tier0_gateway.test.path
}`, name)
}`, getEdgeClusterName(), name)
}

func testAccNsxtPolicyTier0Update2WithRedistribution(name string) string {
Expand Down

0 comments on commit f23daa0

Please sign in to comment.