cormacrelf / terraform-provider-zerotier

Create, modify and destroy ZeroTier networks and members through Terraform.
128 stars 25 forks source link

Expose IPv6 and IPv4 assigned addresses as computed properties #13

Open bltavares opened 5 years ago

bltavares commented 5 years ago

Currently, the ip_assignments has a list of the IPs that ZeroTier provided to the member from its assignment pool. It contains a mix of IPv4 and IPv6 addresses.

There is some scenarios where having the distiction of wheter it is an IPv4 or IPv6 changes which resource to create. For example using DNS records we are only allowed to create AAAA records in the presence of IPv6 addresses, and A records to IPv4.

Filtering this information on Terraform is cumbersome, using the filter on list operations, while it is much easier to provide this information through the provider.

This commit create two extra computed properties, ipv6_assignments and ipv4_assignments, which separates each address assignment as expected.

The ipv6_assignments does not include RFC4139 nor 6PLANE addresses as they are always computed on the member resource level, even if the network is configured to not use those addresses, and their information is not returned by the controller API as an assigned address either.