From ff58c6733b017523386436fed742a2db0b8dcb23 Mon Sep 17 00:00:00 2001 From: Modular Magician Date: Sat, 25 Jan 2020 00:07:12 +0000 Subject: [PATCH] Add support for new beta non-rfc fields in dns managed zone (#3026) * Add support for new beta non-rfc fields in dns managed zone * Test updating forwarding path * Forgot to remove a param * Typo Signed-off-by: Modular Magician --- .changelog/3026.txt | 3 +++ docs/resources/google_dns_managed_zone.md | 4 ++++ docs/resources/google_dns_managed_zones.md | 1 + .../managedzone_forwarding_config_target_name_servers.rb | 3 +++ libraries/google_dns_managed_zone.rb | 2 ++ libraries/google_dns_managed_zones.rb | 2 ++ 6 files changed, 15 insertions(+) create mode 100644 .changelog/3026.txt diff --git a/.changelog/3026.txt b/.changelog/3026.txt new file mode 100644 index 000000000..4b0657725 --- /dev/null +++ b/.changelog/3026.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +dns: `google_dns_managed_zone` added support for Non-RFC1918 fields for reverse lookup and fowarding paths. +``` diff --git a/docs/resources/google_dns_managed_zone.md b/docs/resources/google_dns_managed_zone.md index 9618802d9..7d95f89b4 100644 --- a/docs/resources/google_dns_managed_zone.md +++ b/docs/resources/google_dns_managed_zone.md @@ -78,12 +78,16 @@ Properties that can be accessed from the `google_dns_managed_zone` resource: * `ipv4_address`: IPv4 address of a target name server. + * `forwarding_path`: Forwarding path for this TargetNameServer. If unset or `default` Cloud DNS will make forwarding decision based on address ranges, i.e. RFC1918 addresses go to the VPC, Non-RFC1918 addresses go to the Internet. When set to `private`, Cloud DNS will always send queries through VPC for this target + * `peering_config`: (Beta only) The presence of this field indicates that DNS Peering is enabled for this zone. The value of this field contains the network to peer with. * `target_network`: The network with which to peer. * `network_url`: The fully qualified URL of the VPC network to forward queries to. This should be formatted like `https://www.googleapis.com/compute/v1/projects/{project}/global/networks/{network}` + * `reverse_lookup`: (Beta only) Specifies if this is a managed reverse lookup zone. If true, Cloud DNS will resolve reverse lookup queries using automatically configured records for VPC resources. This only applies to networks listed under `private_visibility_config`. + ## GCP Permissions diff --git a/docs/resources/google_dns_managed_zones.md b/docs/resources/google_dns_managed_zones.md index 2256e38da..d209a829c 100644 --- a/docs/resources/google_dns_managed_zones.md +++ b/docs/resources/google_dns_managed_zones.md @@ -36,6 +36,7 @@ See [google_dns_managed_zone.md](google_dns_managed_zone.md) for more detailed i * `private_visibility_configs`: an array of `google_dns_managed_zone` private_visibility_config * `forwarding_configs`: (Beta only) an array of `google_dns_managed_zone` forwarding_config * `peering_configs`: (Beta only) an array of `google_dns_managed_zone` peering_config + * `reverse_lookups`: (Beta only) an array of `google_dns_managed_zone` reverse_lookup ## Filter Criteria This resource supports all of the above properties as filter criteria, which can be used diff --git a/libraries/google/dns/property/managedzone_forwarding_config_target_name_servers.rb b/libraries/google/dns/property/managedzone_forwarding_config_target_name_servers.rb index 4bc78c141..9fbef9a80 100644 --- a/libraries/google/dns/property/managedzone_forwarding_config_target_name_servers.rb +++ b/libraries/google/dns/property/managedzone_forwarding_config_target_name_servers.rb @@ -19,10 +19,13 @@ module Property class ManagedZoneForwardingConfigTargetNameServers attr_reader :ipv4_address + attr_reader :forwarding_path + def initialize(args = nil, parent_identifier = nil) return if args.nil? @parent_identifier = parent_identifier @ipv4_address = args['ipv4Address'] + @forwarding_path = args['forwardingPath'] end def to_s diff --git a/libraries/google_dns_managed_zone.rb b/libraries/google_dns_managed_zone.rb index 283aec648..4a4c5661c 100644 --- a/libraries/google_dns_managed_zone.rb +++ b/libraries/google_dns_managed_zone.rb @@ -43,6 +43,7 @@ class DNSManagedZone < GcpResourceBase attr_reader :private_visibility_config attr_reader :forwarding_config attr_reader :peering_config + attr_reader :reverse_lookup def initialize(params) super(params.merge({ use_http_transport: true })) @@ -65,6 +66,7 @@ def parse @private_visibility_config = GoogleInSpec::DNS::Property::ManagedZonePrivateVisibilityConfig.new(@fetched['privateVisibilityConfig'], to_s) @forwarding_config = GoogleInSpec::DNS::Property::ManagedZoneForwardingConfig.new(@fetched['forwardingConfig'], to_s) @peering_config = GoogleInSpec::DNS::Property::ManagedZonePeeringConfig.new(@fetched['peeringConfig'], to_s) + @reverse_lookup = @fetched['reverseLookupConfig'] end # Handles parsing RFC3339 time string diff --git a/libraries/google_dns_managed_zones.rb b/libraries/google_dns_managed_zones.rb index 7a5f3047f..5d519a67b 100644 --- a/libraries/google_dns_managed_zones.rb +++ b/libraries/google_dns_managed_zones.rb @@ -36,6 +36,7 @@ class DNSManagedZones < GcpResourceBase filter_table_config.add(:private_visibility_configs, field: :private_visibility_config) filter_table_config.add(:forwarding_configs, field: :forwarding_config) filter_table_config.add(:peering_configs, field: :peering_config) + filter_table_config.add(:reverse_lookups, field: :reverse_lookup) filter_table_config.add(:dnssec_config_states, field: :dnssec_config_state) filter_table_config.connect(self, :table) @@ -90,6 +91,7 @@ def transformers 'privateVisibilityConfig' => ->(obj) { return :private_visibility_config, GoogleInSpec::DNS::Property::ManagedZonePrivateVisibilityConfig.new(obj['privateVisibilityConfig'], to_s) }, 'forwardingConfig' => ->(obj) { return :forwarding_config, GoogleInSpec::DNS::Property::ManagedZoneForwardingConfig.new(obj['forwardingConfig'], to_s) }, 'peeringConfig' => ->(obj) { return :peering_config, GoogleInSpec::DNS::Property::ManagedZonePeeringConfig.new(obj['peeringConfig'], to_s) }, + 'reverseLookupConfig' => ->(obj) { return :reverse_lookup, obj['reverseLookupConfig'] }, } end