> ## Documentation Index
> Fetch the complete documentation index at: https://docs.megaport.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Megaport Terraform Provider Frequently Asked Questions (FAQs)

> This help topic provides answers to common questions about using Megaport Terraform Provider.

export const Link = ({href, children}) => {
  const errorPrefix = '\x1b[31;1;4mERROR\x1b[0m: Link -';
  if (typeof href !== 'string') {
    href = String(href);
  }
  if (!href || href === 'undefined') {
    console.error(`${errorPrefix} the \`href\` property is required — rendering an empty string instead`);
    return <></>;
  }
  if (href.includes('{') || href.toUpperCase().includes('%7B')) {
    console.error(`${errorPrefix} could not resolve a variable in href "${href}" — rendering an empty string instead`);
    return <></>;
  }
  const isExternal = (/^https?:\/\//).test(href);
  return <a href={href} className="link" target={isExternal ? '_blank' : undefined} rel={isExternal ? 'noreferrer' : undefined}>
      {children ?? href}
      {isExternal && <span className="sr-only"> (opens in a new tab)</span>}
    </a>;
};

This topic covers frequently asked questions about using the Megaport Terraform Provider. For more information, see [Megaport Terraform Provider Overview](/terraform).

### How do I find DC location information?

The easiest way to find a location is with the location name in the <Link href="https://portal.megaport.com">Portal</Link>.

However, data center location information, such as name or site code, is subject to change in the API.  For reliable and stable Terraform configurations, we strongly recommend using the location ID instead of names or codes. For the most up-to-date list of Megaport data center locations, see [Megaport Location IDs](/enabled-locations/location-ids).

Location IDs are also available through the [GET /v3/locations Megaport API](https://dev.megaport.com/#7c8e0706-e138-4d9a-bc4f-0419d97604cf).

For more information, see step 2 in [Creating a Megaport Terraform Provider Configuration File](/terraform/megaport-terraform-configuration).

### How do I avoid deleting live services in the production environment while deploying a Terraform configuration file?

Lock your live services via the Portal before deploying a Terraform configuration file.  For more information, see [Locking Megaport Services](/portal-admin/locking).

### How do I add new VXCs to a Port?

If a service such as a Port already exists in the production environment but isn't in your Terraform configuration file, you will need to import it. For more information, see [Importing Existing Production Services](/terraform/importing-existing-services).

Afterwards, add a new configuration line in the Terraform file to create a new VXC under that Port.

### How do I change the name of a service?

Update the `product_name` field in the Terraform configuration file.

Example: Change `product_name` = “Name of Product” to `product_name` = “Updated Name of Product”, then run the `terraform apply` command.

### Does the Megaport Terraform Provider support managing IX services?

Yes, it does.

### How do I apply a service key while ordering a VXC?

First, set up a service key in the Portal. For more information, see [Setting Up Service Keys](/marketplace/service-keys).

Once the service key is created, you can apply it in your `.tf` configuration when ordering a VXC.

In the [Megaport GitHub repository](https://github.com/megaport/terraform-provider-megaport/blob/main/examples/resources/megaport_vxc/resource.tf), there’s an example in `resource.tf` showing exactly how to do this.

Look for the block that starts like this:

`resource "megaport_vxc" "service_key_vxc" {`

<Note>
  * Replace `"YOUR-SERVICE-KEY-HERE"` with the value from the Portal.
  * The `b_end` block is where you specify the service key for the remote end.
  * You can still define other parameters (for example, `rate_limit`, VLAN) as required.
  * The provider docs on GitHub include multiple VXC examples, including MCR and cloud connectivity scenarios.
</Note>

### How do I find the current version of Terraform on my computer?

Run the `terraform version` command to check the version of Terraform you have installed.

This will output the version information for Terraform.

If the output is similar to the example below, visit [Upgrading Guides (HashiCorp)](https://developer.hashicorp.com/terraform/language/upgrade-guides) to update your system.

```text theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
    terraform version Your version of Terraform is out of date! 
    The latest version is x.y.z.
    You can update by downloading from 
    https://www.terraform.io/downloads.html
```

### How do I find the current version of the Megaport Terraform Provider?

Megaport actively tests against the two latest major versions of Terraform to ensure compatibility and reliability.

You can find the latest version of the Megaport Terraform Provider in the [Megaport Terraform Provider Releases page](https://github.com/megaport/terraform-provider-megaport/releases).  This page also includes release notes for each version.

We highly recommend that you keep your Terraform configuration file updated with the latest provider version to take advantage of improvements, new features, and important fixes.

### Where do I update the Megaport Terraform Provider version number?

You update the version field in the `provider.tf` file.

See `version = ">= 1.4.1"` in the following example.  This is an example of a version coding that instructs Terraform to use a version of the provider that is 1.4.1 or newer.

```terraform theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
terraform {
  required_providers {
    megaport = {
      source  = "megaport/megaport"
        version = ">= 1.4.1"
    }
  }
}
```

### Do you support OpenTofu?

Yes, the Megaport Terraform Provider has been tested and is compatible with OpenTofu starting from version v1.3.7.

OpenTofu is an open-source, community-driven fork of Terraform that maintains compatibility with the same providers and HashiCorp Configuration Language (HCL) syntax.

While we test for compatibility with new Megaport Terraform Provider releases, we recommend checking the [Megaport Terraform Provider GitHub Releases page](https://github.com/megaport/terraform-provider-megaport/releases) for the latest information.

For usage details, see the Megaport Provider on the [OpenTofu Registry](https://search.opentofu.org/provider/megaport/megaport/latest) and refer to the [Megaport Terraform Provider GitHub Readme](https://github.com/megaport/terraform-provider-megaport/blob/main/README.md) file.

### Where are the most current examples?

Examples for Ports, VXCs, MCRs, and MVEs are available in the [examples directory](https://github.com/megaport/terraform-provider-megaport/blob/main/examples) of the provider. Additional guidance can be found in the Guides section of the [Megaport Terraform Provider Registry](https://registry.terraform.io/providers/megaport/megaport/latest/docs/guides), which provides context and instructions to complement the examples.

### How does terming work with the provider?

There should be no issues with putting a service on a contract term using Terraform.

### Why is there a requested\_product\_uid field?

This is because when selecting a partner Port, we don't allow the user to pick the specific Port, and the API will pick one dynamically for capacity reasons. This means that this field can be different to what the user requested, which would cause an error in the provider.

## Helpful references

* [Getting Started with the Megaport Terraform Provider](/terraform/getting-started)
* [Megaport Terraform Provider Overview](/terraform)
* [Troubleshooting the Megaport Terraform Provider](/troubleshooting/megaport-terraform-provider)
