Skip to content

Add support for r/nsxt_policy_bgp_config import #1661

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

Open
martinrohrbach opened this issue May 15, 2025 · 0 comments · May be fixed by #1708
Open

Add support for r/nsxt_policy_bgp_config import #1661

martinrohrbach opened this issue May 15, 2025 · 0 comments · May be fixed by #1708
Assignees
Labels
enhancement Enhancement

Comments

@martinrohrbach
Copy link
Contributor

Description

The documentation for the nsxt_policy_bgp_config resource states:

Since BGP config is autocreated by the backend, and terraform create is de-facto an update, importing the resource is not useful and thus not supported.

That is technically correct, but poses a problem when you import an existing T0 gateway along with its bgp neighbors (which we had to do a couple of for .... reasons).

The workflow is as follows:

  • Define nsxt_policy_bgp_config resource without import statement (would overwite config 1:1, not a problem)
  • Define nsxt_policy_bgp_neighbors for all existing neighbors using the nsxt_policy_bgp_config resource along with import blocks to import the actual neighbors

This then happens:

# nsxt_policy_bgp_neighbor.t0-routers-bgp-neighbors["neighbor-name"] must be replaced
# (imported from "t0-router/t0-router-localeservices/neighbor-name")
# Warning: this will destroy the imported resource

-/+ resource "nsxt_policy_bgp_neighbor" "t0-routers-bgp-neighbors" {
~ bgp_path = "/infra/tier-0s/t0-router/locale-services/t0-router-localeservices/bgp" -> (known after apply) # forces replacement

We can work around that by applying the bgp config first and then importing the bgp neighbors, but the way we have structured our t0 code makes this impractical.

My question would be if an import for the nsxt_policy_bgp_config resource would be possible for a scenario like this?

Use Case(s)

Importing a t0 router using the nsxt_policy_bgp_config as well as nsxt_policy_bgp_neighbor resources in a single step.

Potential Configuration

See above.

References

No response

@martinrohrbach martinrohrbach added enhancement Enhancement needs-review Needs Review labels May 15, 2025
@tenthirtyam tenthirtyam added enhancement Enhancement and removed enhancement Enhancement needs-review Needs Review labels May 19, 2025
@tenthirtyam tenthirtyam changed the title nsxt_policy_bgp_config import functionality Add support for r/nsxt_policy_bgp_config import May 19, 2025
@annakhm annakhm linked a pull request May 30, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants