Skip to content

Commit

Permalink
Add support for new beta non-rfc fields in dns managed zone (#3026) (#…
Browse files Browse the repository at this point in the history
…348)

* 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 <magic-modules@google.com>
  • Loading branch information
modular-magician authored and slevenick committed Feb 20, 2020
1 parent 7e6afc6 commit a2775b9
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/3026.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
dns: `google_dns_managed_zone` added support for Non-RFC1918 fields for reverse lookup and fowarding paths.
```
4 changes: 4 additions & 0 deletions docs/resources/google_dns_managed_zone.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions docs/resources/google_dns_managed_zones.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions libraries/google_dns_managed_zone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }))
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions libraries/google_dns_managed_zones.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit a2775b9

Please sign in to comment.