Skip to content

Commit

Permalink
Add type field to DNS authorization reosurce (GoogleCloudPlatform#10030)
Browse files Browse the repository at this point in the history
* Add type field to DNS authorization reosurce

* Add an example for regional DNS authorization

* Add an example for regional certs using regional DNS auth

* Fix lint errors

* Fix typo in the enum values

* Add type field in regional dns auth example

---------

Co-authored-by: Hamza Hassan <hamzahassan@google.com>
  • Loading branch information
2 people authored and balanaguharsha committed Apr 19, 2024
1 parent 5099299 commit b27edef
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mmv1/products/certificatemanager/Certificate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ examples:
dns_auth_name2: 'dns-auth2'
dns_auth_subdomain2: 'subdomain2'
cert_name: 'dns-cert'
- !ruby/object:Provider::Terraform::Examples
name: 'certificate_manager_google_managed_regional_certificate_dns_auth'
primary_resource_id: 'default'
vars:
dns_auth_name: 'dns-auth'
dns_auth_subdomain: 'subdomain'
cert_name: 'dns-cert'
custom_code: !ruby/object:Provider::Terraform::CustomCode
constants: templates/terraform/constants/cert_manager.erb
parameters:
Expand Down
23 changes: 23 additions & 0 deletions mmv1/products/certificatemanager/DnsAuthorization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ examples:
dns_auth_name: 'dns-auth'
zone_name: 'my-zone'
subdomain: 'subdomain'
- !ruby/object:Provider::Terraform::Examples
name: 'certificate_manager_dns_authorization_regional'
primary_resource_id: 'default'
vars:
dns_auth_name: 'dns-auth'
zone_name: 'my-zone'
subdomain: 'subdomain'
parameters:
- !ruby/object:Api::Type::String
name: 'name'
Expand Down Expand Up @@ -84,6 +91,22 @@ properties:
A domain which is being authorized. A DnsAuthorization resource covers a
single domain and its wildcard, e.g. authorization for "example.com" can
be used to issue certificates for "example.com" and "*.example.com".
- !ruby/object:Api::Type::Enum
name: type
description: |
type of DNS authorization. If unset during the resource creation, FIXED_RECORD will
be used for global resources, and PER_PROJECT_RECORD will be used for other locations.
FIXED_RECORD DNS authorization uses DNS-01 validation method
PER_PROJECT_RECORD DNS authorization allows for independent management
of Google-managed certificates with DNS authorization across multiple
projects.
immutable: true
values:
- :FIXED_RECORD
- :PER_PROJECT_RECORD
default_from_api: true
- !ruby/object:Api::Type::NestedObject
name: 'dnsResourceRecord'
output: true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resource "google_certificate_manager_dns_authorization" "<%= ctx[:primary_resource_id] %>" {
name = "<%= ctx[:vars]['dns_auth_name'] %>"
location = "us-central1"
description = "reginal dns"
type = "PER_PROJECT_RECORD"
domain = "<%= ctx[:vars]['subdomain'] %>.hashicorptest.com"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
resource "google_certificate_manager_certificate" "<%= ctx[:primary_resource_id] %>" {
name = "<%= ctx[:vars]['cert_name'] %>"
description = "regional managed certs"
location = "us-central1"
managed {
domains = [
google_certificate_manager_dns_authorization.instance.domain,
]
dns_authorizations = [
google_certificate_manager_dns_authorization.instance.id,
]
}
}
resource "google_certificate_manager_dns_authorization" "instance" {
name = "<%= ctx[:vars]['dns_auth_name'] %>"
location = "us-central1"
description = "The default dnss"
domain = "<%= ctx[:vars]['dns_auth_subdomain'] %>.hashicorptest.com"
}

0 comments on commit b27edef

Please sign in to comment.