equinix / terraform-provider-equinix

Terraform Equinix provider
https://deploy.equinix.com/labs/terraform-provider-equinix/
MIT License
47 stars 45 forks source link

implement BGP discover for `equinix_metal_project` #121

Open displague opened 2 years ago

displague commented 2 years ago

Community Note

Description

Equinix Metal projects provide a number of BGP settings. These are exposed in Terraform through a few resources, but are initiated by equinix_metal_project.

One of the resources of the Metal API that has not been exposed in Terraform is the ability to force a sync or discover over BGP neighbors in the project (POST /projects/{id}/bgp/discover).

Create a method to signal this API endpoint via Terraform.

New or Affected Resource(s)

Potential Terraform Configuration

resource "equinix_metal_project" "foo" {
  ...
  bgp_discover_since = "<date>" 
  #  the diff would be based on desired date (bgp_discover_since) > observed state
  #  (determined by updated_dt or finding a matching event).

  # computed field could also be added, but perhaps not necessary?
  # would be named bgp_discovered bgp_last_discovered ? 
} 

I don't think bgp_config should be used because the API path for projects/{id}/bgp/config is separate.

https://registry.terraform.io/providers/equinix/equinix/latest/docs/resources/equinix_metal_project#example-with-bgp-config

References

displague commented 1 year ago

Alternatively, or perhaps in addition, whenever the Terraform provider performs BGP-affecting actions, a BGP discover call could be made (equivalent to the "Update Now" button on the BGP Networking panel in the Metal console). This may be a little magical for TF, so if implemented this should be behind a behavior flag in the resource or the provider.