{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/3127","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/3127/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/3127/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/3127/events","html_url":"https://github.com/hashicorp/terraform/pull/3127","id":103974413,"number":3127,"title":"Various interpolation functions for CIDR range manipulation.","user":{"login":"apparentlymart","id":20180,"avatar_url":"https://avatars.githubusercontent.com/u/20180?v=3","gravatar_id":"","url":"https://api.github.com/users/apparentlymart","html_url":"https://github.com/apparentlymart","followers_url":"https://api.github.com/users/apparentlymart/followers","following_url":"https://api.github.com/users/apparentlymart/following{/other_user}","gists_url":"https://api.github.com/users/apparentlymart/gists{/gist_id}","starred_url":"https://api.github.com/users/apparentlymart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apparentlymart/subscriptions","organizations_url":"https://api.github.com/users/apparentlymart/orgs","repos_url":"https://api.github.com/users/apparentlymart/repos","events_url":"https://api.github.com/users/apparentlymart/events{/privacy}","received_events_url":"https://api.github.com/users/apparentlymart/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hashicorp/terraform/labels/core","name":"core","color":"cccccc"},{"url":"https://api.github.com/repos/hashicorp/terraform/labels/enhancement","name":"enhancement","color":"d4c5f9"},{"url":"https://api.github.com/repos/hashicorp/terraform/labels/wip","name":"wip","color":"eb6420"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2015-08-31T02:28:45Z","updated_at":"2015-10-22T15:15:23Z","closed_at":"2015-10-22T15:13:58Z","pull_request":{"url":"https://api.github.com/repos/hashicorp/terraform/pulls/3127","html_url":"https://github.com/hashicorp/terraform/pull/3127","diff_url":"https://github.com/hashicorp/terraform/pull/3127.diff","patch_url":"https://github.com/hashicorp/terraform/pull/3127.patch"},"body":"These new functions allow Terraform to be used for network address space planning tasks, and make it easier to produce reusable modules that contain or depend on network infrastructure.\r\n\r\nFor example:\r\n* ``cidrsubnet`` allows an ``aws_subnet`` to derive its CIDR prefix from its parent ``aws_vpc``.\r\n* ``cidrhost`` allows a fixed IP address for a resource to be assigned within an address range defined elsewhere, for when dynamic allocation is not desired. Computing a host address allows reusable modules to derive addresses from input variables.\r\n* ``cidrfirstaddr`` and ``cidrlastaddr`` respectively provide the IP addresses that bound the range, which is what many DHCP servers accept as configuration of a dynamic allocation range.\r\n* ``cidrmask`` provides the dotted-decimal form of a prefix length that is accepted by some systems such as routers and OS-level static network interface configuration files. (e.g. ``255.255.0.0``)\r\n\r\nThe bulk of the work here is done by an external library I authored called go-cidr. It is MIT licensed and was implemented primarily for the purpose of using it within Terraform. It has its own unit tests and so the unit tests within this change focus on simple success cases and on the correct handling of the various error cases.\r\n\r\n- [x] Implementation\r\n- [x] Tests (unit tests run as part of ``make test``)\r\n- [x] Documentation\r\n"},"comment":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/comments/150258103","html_url":"https://github.com/hashicorp/terraform/pull/3127#issuecomment-150258103","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/3127","id":150258103,"user":{"login":"apparentlymart","id":20180,"avatar_url":"https://avatars.githubusercontent.com/u/20180?v=3","gravatar_id":"","url":"https://api.github.com/users/apparentlymart","html_url":"https://github.com/apparentlymart","followers_url":"https://api.github.com/users/apparentlymart/followers","following_url":"https://api.github.com/users/apparentlymart/following{/other_user}","gists_url":"https://api.github.com/users/apparentlymart/gists{/gist_id}","starred_url":"https://api.github.com/users/apparentlymart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apparentlymart/subscriptions","organizations_url":"https://api.github.com/users/apparentlymart/orgs","repos_url":"https://api.github.com/users/apparentlymart/repos","events_url":"https://api.github.com/users/apparentlymart/events{/privacy}","received_events_url":"https://api.github.com/users/apparentlymart/received_events","type":"User","site_admin":false},"created_at":"2015-10-22T15:15:23Z","updated_at":"2015-10-22T15:15:23Z","body":"Thanks! I corrected the doc bug that @thegedge spotted, along with another one I spotted while fixing it (the function was still documented as `cidrmask` rather than `cidrnetmask`)... and then I merged it.\r\n"}}