Class TerraformExporter
DeploymentPlan produced by the Deployment Wizard into
Infrastructure-as-Code (HCL) for the
Equinix Terraform provider.
The exporter only emits the resource types the plan actually contains and keeps
attributes faithful to the fields the plan provides; it does not invent provider
attributes that cannot be sourced from the plan. The generated HCL is intended as a
readable, version-controllable starting point for terraform plan / apply.
Resource mapping:
PlannedCloudRouter→resource "equinix_fabric_cloud_router"PlannedConnection(provider connections and backbone links) →resource "equinix_fabric_connection"PlannedRoutingProtocol→resource "equinix_fabric_routing_protocol"
Customer inputs the plan deliberately leaves unresolved (the cloud authorization
key, and the DOT1Q VLAN tag when not yet known) become variable blocks -
the authorization key marked sensitive - referenced from the connection's
Z-side, so the generated configuration is complete without ever fabricating or
inlining a secret. A BGP routing protocol on a connection that also carries a DIRECT
protocol is emitted with depends_on on the DIRECT resource, because Fabric
requires DIRECT to exist before BGP on the same connection. The Fabric-mandated
notifications block is emitted on every Cloud Router and connection -
backbone links included - with every recipient the plan carries.
Provider schema. Every emitted argument was checked against the equinix/equinix
provider docs for equinix_fabric_cloud_router, equinix_fabric_connection and
equinix_fabric_routing_protocol (terraform-provider-equinix main, read 2026-11-12; the
exporter emits no equinix_fabric_network), and TerraformSchemaConformanceTest keeps
it so:
- a Cloud Router always has the required
projectblock, through aproject_idvariable when the plan names no project; - a redundant pair is written the way Fabric assigns groups: the PRIMARY carries only
priority = "PRIMARY"and the SECONDARY references the primary's group,group = one(equinix_fabric_connection.<primary>.redundancy).group; the plan's own group token is never written; - an Azure Z-side carries
peering_type(the plan's value, else a validated<connection>_peering_typevariable defaulting toPRIVATE); - a service-provider Z-side carries
location { metro_code }, which the API requires; bgp_ipv4.equinix_peer_ipis not written (read-only in the provider schema);- a connection carries the plan marker as
additional_info(seePlanMarker) so drift detection finds Terraform-created connections too, plusorder { term_length }andproject { project_id }when the plan has them.
Not emitted: Equinix provider credentials (supply them via the standard provider configuration), and any physical colocation the wider design may assume - the Equinix Terraform provider has no cabinet or cross-connect resources, so those cannot be expressed in HCL at all.
Native multicloud links
Beta. A PlannedMulticloudInterconnect on the plan
(DeploymentPlan.multicloudLinksOrEmpty()) is a direct link between two cloud
providers that uses no Equinix resource. The Equinix Terraform provider has no resource
type for it, and this exporter emits no cloud-provider resource (aws_*,
google_*, oci_*, azurerm_*) and no cloud-provider provider
block. Per link the output holds:
| Output | Content |
|---|---|
Comment block, delimited by BEGIN native multicloud link and
END native multicloud link lines; every line starts with # |
Both providers and regions; the bandwidth the link would be ordered at and the
requested bandwidth, in Mbps; the catalog environment's status, as-of date and source
URLs; the role and strategy; the create-then-accept procedure (create on one provider
with the other provider's account identifier, receive the activation key, accept on the
other provider) with the AWS console path, the gcloud network-connectivity
transports create command line, or the OCI FastConnect "Service key" field for the
providers of the link; the steps recorded on the plan, verbatim |
variable "<sanitized name>_destination_account_id" |
type = string, with a description naming the identifier to record. For a
REPLACEMENT link the variable has no default, so Terraform requires a value.
For any other role it has default = null, so a configuration that does not
depend on the link needs no value. No resource references the variable. Not emitted for
an UNAVAILABLE entry. |
Links add no resource block: the number of resource blocks equals
DeploymentPlan.totalResourceCount() with or without links. The header comment states
the number of links and, for each REPLACEMENT link, the names of the Equinix
connections this configuration omits because of it. The activation key is never an input of
the configuration. Provider procedures are copies of provider documentation retrieved
2026-09-21 and go stale; each is printed with its source URL. Provider-side procedures are
printed for two pairs only: AWS with Google Cloud, and AWS with Oracle Cloud. For AWS with
Azure (preview) and for every other pair the block states that no procedure was verified.
The output for a plan without links contains none of the above.
Plan-supplied text written into a comment has its line breaks replaced by spaces, so a name or recipe line cannot end the comment and start an HCL construct.
This class is stateless and thread-safe; a single instance may be reused.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexport(DeploymentPlan plan) Exports the given deployment plan as Equinix Terraform provider HCL.
-
Constructor Details
-
TerraformExporter
public TerraformExporter()
-
-
Method Details
-
export
Exports the given deployment plan as Equinix Terraform provider HCL.The output is a complete document but not immediately appliable: before
terraform apply, the caller must configure the Equinix provider's credentials and supply a value for each generated inputvariable- the per-connection cloud authorization key (sensitive) and DOT1Q VLAN tag, exactly the customer inputsDeploymentPlan.getRequiredInputs()enumerates. The generated header comment repeats this.Beta. Native multicloud links on the plan are written last, as comment blocks plus one
<name>_destination_account_idvariable each; see the class documentation. AREPLACEMENTlink's variable has no default and therefore also needs a value.- Parameters:
plan- the deployment plan to export; must not benull- Returns:
- an HCL document. Resources are emitted in dependency order (cloud routers, then connections, then routing protocols), and later resources reference earlier ones via Terraform resource expressions.
- Throws:
IllegalArgumentException- ifplanisnull
-