Importing Existing Production Services
You might already have live services in your production environment. To transition to fully automated service management using the Megaport Terraform Provider, the corresponding Terraform configuration file must include resource definitions for all existing services, such as product name, speed location, and so on.
To achieve this, you will need to import these services into the Terraform configuration file.
Importing production services
To import existing production services, follow these steps. We recommend testing the process in the staging environment first.
To import production services
-
Create definitions matching the production service(s) in the target directory where related Terraform configuration files exist.
For example, if you want to import an MCR then you need to add the following Terraform configuration file into the target directory.
resource "megaport_mcr" "example" { product_name = "importing service's name" product_speed = importing service's speed location_id = importing service's location ID contract_term_months = importing service's contract term diversity_zone = "blue or red" terraform import product name “<product_UID>" }
-
You can find the product_UID in the Portal. Click the service to view the URL.
The alphanumeric information at the end of the URL is the product_UID.
-
Run the following command:
Example:
After the import is complete, you will see a message similar to the following:
Confirm that the target service is imported into Terraform as intended by reviewing the
terraform.tfstate
file.
Helpful references
- Megaport Terraform Provider Registry documentation (import Port)
- Megaport Terraform Provider Registry documentation (import Lag Port)
- Megaport Terraform Provider Registry documentation (import VXC)
- Megaport Terraform Provider Registry documentation (import MCR)
- Megaport Terraform Provider Registry documentation (import MVE)
- Megaport Terraform Provider Registry documentation (import IX)
- Megaport Terraform Provider Registry documentation (import optional VXC information)