action.skip

Getting Started with the Megaport Terraform Provider

This topic describes the prerequisites and required setup steps to get started using the Megaport Terraform Provider.

Prerequisites

This section describes the basic setup steps and provides the necessary links to start using the Megaport Terraform Provider. Before using the Megaport Terraform Provider, you need to:

  1. Understand Megaport’s services – Understand the process of creating services and the features of each service.

  2. Understand Megaport Portal environments – Megaport provides two Portal environments, the production environment and the staging environment. You can test any action in the staging environment. All actions mirror the production system, but services will not be deployed and you will not be billed for any activity. For more information, see Testing Configurations in the Staging Environment.

    Important

    We highly recommend that you test Terraform configuration files in the staging environment before applying them to production to prevent errors.

    Automated configuration creates and deletes services instantly. Testing the configuration file in the staging environment helps you avoid accidentally changing or deleting live production services. Note that some live services in the production environment start incurring charges immediately after creation.

  3. Create a Megaport account – If you have not already created one, see Creating an Account.

  4. Add and modify users – To run Terraform configuration files, you must be a user with the Company Admin role. For more information, see Adding and Modifying Users.

  5. Create an API key – You need to create an API key before you can use the Megaport Terraform Provider. The API key consists of the access_key and secret_key values.

    The API key values can be defined in the Terraform file in various ways, including as a variable, an environment variable, directly in the code (not recommended), and so on.

    API keys are valid only in the environment in which they were created. If you need an API key to access a different environment, log in to the Megaport Portal in that environment and create the API key there. For more information, see Creating an API Key.

  6. Install the HashiCorp Terraform platform – Install the Terraform CLI and verify the installation. For detailed instructions, see the Install Terraform (HashiCorp) documentation.

  7. Have access to GitHub – You can obtain sample configuration files, report bugs, and learn about new Megaport Terraform Provider feature releases in the Megaport Terraform Provider GitHub repository.

  8. Install your preferred code editor – A code editor is required to create Terraform configuration files. For example, Visual Studio Code.

Next steps

After you have completed all of the prerequisites above, you can create a Terraform configuration file. For more information, see Creating a Megaport Terraform Provider Configuration File.

Helpful references