惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

爱范儿
爱范儿
T
The Blog of Author Tim Ferriss
G
Google Developers Blog
博客园_首页
博客园 - 【当耐特】
量子位
S
SegmentFault 最新的问题
B
Blog RSS Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
V
Visual Studio Blog
T
Tailwind CSS Blog
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
Y
Y Combinator Blog
博客园 - 聂微东
The Cloudflare Blog
小众软件
小众软件
J
Java Code Geeks
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
月光博客
月光博客
H
Help Net Security
Jina AI
Jina AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
宝玉的分享
宝玉的分享

Megaport Blog

A Guide to NAT Gateway A Guide to Cloud Storage How the Data Center Is Evolving in 2026 What to Expect When Attending Your First Network Operator Group (NOG) Nine Ways to Connect to Cloud Using Private Connectivity Migrate Your On-premises to the Cloud: A Step-by-Step Guide How to Lower Your Egress Fees in 2026 How to Achieve Data Sovereignty in Europe Cisco and Megaport: Redefining the Edge of Modern Networking How to Reduce Latency in Your Multicloud Environment Introducing Megaport High-Speed Cross-Cloud Encryption Are Businesses Leaving the Cloud? Using Meraki and Megaport Virtual Edge for Multicloud Networking Equinix Metal® is Going Away: Here’s What You Can Do Introducing Megaport On-ramp as a Service Megaport’s Full Solution Portfolio Is Coming to India New Bare-metal GPU Instance Now Available with NVIDIA RTX Pro 6000 A Look Back at 2025: Megaport's Biggest Updates Megaport Expands Into India With Strategic Acquisition of Extreme IX Your 2026 Predictions From AWS re:Invent 2025 What’s Next for NaaS? Top Trends for 2026 What is IPsec? When to Move From Public Internet to Private Connectivity Megaport and Latitude.sh: Bringing Compute and Connectivity Together How to Improve Your Microsoft ExpressRoute Resilience with Megaport Connectivity Comparing Ways to Connect to AWS What is API-First Networking? The Hidden Cost of Running Cloud-Hosted SD-WAN for IaaS How to Overcome NaaS Integration Challenges Introducing SCION with Anapaya and Megaport
Automate Your Multicloud with the Megaport Terraform Prov...
Megaport · 2021-04-19 · via Megaport Blog

With Megaport’s Terraform Provider, you can now easily automate the provisioning and management of your Megaport resources, lowering deployment costs and reducing provisioning time by using Infrastructure as Code (IaC).

Many organizations on the cloud infrastructure journey quickly discover the need for tools to automate resources they create and manage. These tools make it easy to record the state of systems, maintain audit trails, and rapidly create consistent environments for testing or deployment purposes.

Amongst those tools, Terraform stands out. It’s highly successful in the multi-vendor cloud automation space. Its parent company, Hashicorp, has a solid reputation for delivering quality solutions and is often preferred over vendors’ own automation tools, which are an afterthought for most cloud services.

Megaport is proud to have its own Terraform module. You can use it right now to manage Megaport resources in the same way you manage compute and storage from the big cloud players.

If you’re not using Terraform yet, but are considering automating your cloud infrastructure, we recommend it. The IaC tool is widely adopted, easy to use, and has a great community for professional support. It has support for hundreds of popular service providers. And best of all, it’s free and open source.

Get a quick run-through of Megaport’s Terraform Provider.

What can you do with Megaport’s Terraform Provider?

Megaport has an independent global network with PoPs in nearly 400 physical locations. This includes on-ramps to all the major cloud brands and many other service providers. Connections between these providers and locations can be created in minutes, and with no lock-in, you can modify them to suit your demands. Megaport Cloud Router can be configured to create advanced network topologies, such as hybrid cloud solutions that connect multiple, distinct virtual networks together. Connecting AWS to Azure would be an example of this topology.

The Megaport Terraform Provider supports the resources required to configure these networks. And to make it even easier, Megaport has published example Terraform templates that create everything from simple data center connections right up to a hybrid cloud with AWS, Google, and Microsoft Azure networks all connected together.

How it works

Under the hood of the Megaport Terraform Provider, the cloud automation tool uses the same API that the Megaport Portal uses. The Megaport API documentation is available for clients who wish to customize Terraform or write their own bespoke integration.

Megaport publishes the code for our Terraform Provider on GitHub, and clients can interact with our DevOps team to report bugs or push their own code improvements for inclusion in the IaC tool.

To communicate with the Megaport API, the provider uses a library written in Go. This abstract’s functionality is customized for Megaport based on the standard Terraform behaviors and makes working on changes easier. The megaportgo library is also on GitHub.

The provider sits outside of the Megaport network and is not part of the paid Megaport product, so we strongly recommend referring to the documentation for support. We also have our short video demonstrating the tool in use.

Megaport and Terraform capabilities

Our Terraform Provider gives you the ability to manage your multicloud infrastructure including Megaport Ports, VXCs, and MCRs.

Getting started with Terraform

Whether you’re using Megaport by itself or with other cloud service providers, Terraform is easy to use. The official website has simple instructions for installing Terraform on your operating system of choice, and there are many tutorials and examples online.

There are only a few basic concepts for new users. The first is that you detail the desired infrastructure in a text file. The format of these is Terraform-specific and looks similar to JSON. The online documentation is clear with specific modules for each cloud provider. Once you get started, you’ll see the naming conventions closely align with the terms you would normally expect to use.

This short example shows the Terraform code you need in order to look up a Megaport location and provision a single network port there:

data megaport_location ndc_b1 {
name = NextDC B1
has_mcr = false
}

resource megaport_port tf_test {
port_name = Test Port
port_speed = 10000
location_id = data.megaport_location.ndc_b1.id
}

If you’ve used Megaport before, these fields will look familiar to you. The location represents a Megaport Enabled Location, which can be in one of hundreds of points of presence worldwide with many different data centre providers.

The other fields are “name” (the user can enter anything here that makes sense to them), and “port speed” in Mbps.

Once you have your file, Terraform can do the rest. As well as creating resources that match your specifications, it can check for differences between the file and the deployed resources, and if you approve, it will safely remove these differences.

Using Terraform

Once Terraform is up and running, it works from the command line of your operating system, giving advanced users the ability to include it within other scripts such as Continuous Deployment tools.

Initially, there are just three commands to remember:

terraform init  
terraform apply  
terraform destroy

All the commands need to be run in the same directory as your text file which describes the infrastructure. Terraform init will determine which provider modules are required to deploy your code and ensure they’re present.

Terraform apply is the launch button. This clever command determines the required sequence of deployment and makes those changes. As a safety precaution, it informs the user of any intended changes and asks for confirmation before proceeding.

When you’re done, terraform destroy will clean up the resources you created.

For advanced users, there are further possible commands and options based on feedback from millions of users. Whatever your use case, chances are somebody has already solved it.

If you aren’t using the Megaport Terraform Provider, give it a try. For more information, visit our Terraform Registry page, or to view our support forum, visit our GitHub.


Stay Updated

Keep up to date on Megaport in the news by following us on social media at:

Twitter: @megaportnetwork

LinkedIn: @megaport

Facebook: @megaportnetworks