Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Service Directory Cloud DNS integration #384

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/resources/google_dns_managed_zone.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ Properties that can be accessed from the `google_dns_managed_zone` resource:

* `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`.

* `service_directory_config`: (Beta only) The presence of this field indicates that this zone is backed by Service Directory. The value of this field contains information related to the namespace associated with the zone.

* `namespace`: The namespace associated with the zone.

* `namespace_url`: The fully qualified URL of the service directory namespace that should be associated with the zone. Ignored for `public` visibility zones.


## 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 @@ -57,6 +57,7 @@ See [google_dns_managed_zone.md](google_dns_managed_zone.md) for more detailed i
* `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
* `service_directory_configs`: (Beta only) an array of `google_dns_managed_zone` service_directory_config

## 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
@@ -0,0 +1,35 @@
# frozen_string_literal: false

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in README.md and
# CONTRIBUTING.md located at the root of this package.
#
# ----------------------------------------------------------------------------
require 'google/dns/property/managedzone_service_directory_config_namespace'
module GoogleInSpec
module DNS
module Property
class ManagedZoneServiceDirectoryConfig
attr_reader :namespace

def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@namespace = GoogleInSpec::DNS::Property::ManagedZoneServiceDirectoryConfigNamespace.new(args['namespace'], to_s)
end

def to_s
"#{@parent_identifier} ManagedZoneServiceDirectoryConfig"
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# frozen_string_literal: false

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in README.md and
# CONTRIBUTING.md located at the root of this package.
#
# ----------------------------------------------------------------------------
module GoogleInSpec
module DNS
module Property
class ManagedZoneServiceDirectoryConfigNamespace
attr_reader :namespace_url

def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@namespace_url = args['namespaceUrl']
end

def to_s
"#{@parent_identifier} ManagedZoneServiceDirectoryConfigNamespace"
end
end
end
end
end
4 changes: 4 additions & 0 deletions libraries/google_dns_managed_zone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
require 'google/dns/property/managedzone_peering_config_target_network'
require 'google/dns/property/managedzone_private_visibility_config'
require 'google/dns/property/managedzone_private_visibility_config_networks'
require 'google/dns/property/managedzone_service_directory_config'
require 'google/dns/property/managedzone_service_directory_config_namespace'

# A provider to manage Cloud DNS resources.
class DNSManagedZone < GcpResourceBase
Expand All @@ -44,6 +46,7 @@ class DNSManagedZone < GcpResourceBase
attr_reader :forwarding_config
attr_reader :peering_config
attr_reader :reverse_lookup
attr_reader :service_directory_config

def initialize(params)
super(params.merge({ use_http_transport: true }))
Expand All @@ -67,6 +70,7 @@ def parse
@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']
@service_directory_config = GoogleInSpec::DNS::Property::ManagedZoneServiceDirectoryConfig.new(@fetched['serviceDirectoryConfig'], to_s)
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 @@ -37,6 +37,7 @@ class DNSManagedZones < GcpResourceBase
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(:service_directory_configs, field: :service_directory_config)
filter_table_config.add(:dnssec_config_states, field: :dnssec_config_state)

filter_table_config.connect(self, :table)
Expand Down Expand Up @@ -92,6 +93,7 @@ def transformers
'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'] },
'serviceDirectoryConfig' => ->(obj) { return :service_directory_config, GoogleInSpec::DNS::Property::ManagedZoneServiceDirectoryConfig.new(obj['serviceDirectoryConfig'], to_s) },
}
end

Expand Down