pivotal-cf / terraforming-azure

use terraform, deploy yourself a pcf
Apache License 2.0
34 stars 67 forks source link

Implement calculating and outputting reserved_ip_ranges for subnets #61

Open xyloman opened 5 years ago

xyloman commented 5 years ago

In order to simplify the generation of infrastructure_subnets, pas_subnets, and services_subnets calculating and outputing the reserved ip ranges based upon the cidrs already configured will simplify the automation process that consumes the outputs.tf.

For instance when leveraging ytt for the generation of a director_config.yml used by pcf-automation the following could be used:

- iaas_identifier: #@ "{}/{}".format(data.values.network_name, data.values.pas_subnet_name)
  cidr: #@ data.values.pas_subnet_cidr
  dns: 168.63.129.16
  gateway: #@ data.values.pas_subnet_gateway
  reserved_ip_ranges: #@ data.values.pas_subnet_reserved_ip_ranges
  availability_zone_names:
  - zone-1
  - zone-2
  - zone-3

ytt and templating technologies like it typically do not yet have facilities to generate ips based upon CIDR ranges. By leveraging terraform which has a native ability to do it simplifies down stream consumers.