API, Terraform, aoutomation

I am attempting to automate the creation of the ZeroTier network via Terraform and the subsequent tasks that need to be done in the created ZT network.
Task 1 is to add managed routes to subnets in my AWS VPC. This can be done via Terraform. Those managed routes point to ‘gateways’ that enable access from ZT to the particular subnet the ‘gateway’ serves.

Question 1. Is it possible to modify managed routes with the terraform provider after the network is created?

Question 2. Is it possible to add managed routes via the API?

Everything you can do via the web UI at https://my.zerotier.com can be done via the API. Everything network & member related can also be done via terraform.

Hi Grant

Thanks for the response. In Terraform, I am unable to update the network settings - specifically set a managed route - AFTER the network has been created. Could you share a code snippet that simply adds a managed route via Terraform.

Doing it at create time works. I just don’t know the IP addresses to add to managed routes until much later in the script.

Hi Jeremyk!

The current version of our API stores all the information about the zerotier_network on a single object.
Is it possible to flip the logic around and make the zerotier_network resource depend on your previously created aws resources?


Hi Sean

I have tried this. Chickens and eggs.

I am creating VPN Gateways as per https://zerotier.atlassian.net/wiki/spaces/SD/pages/224395274/Route+between+ZeroTier+and+Physical+Networks

So this is what I am facing:
When I create the instance I need to push the Join statement via user_data on the instance.
For that I need the ZT network ID

When I create the ZT Network, I want to add the managed routes and for that I need the IP addresses of the instances.

I really need to be able to modify the ZT Network after creating it. I can’t see how to do this with the ZT Provider for Terraform