forked from GoogleCloudPlatform/magic-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add google_site_verification_web_resource (GoogleCloudPlatform#11624)
- Loading branch information
1 parent
f431d48
commit 8709d00
Showing
5 changed files
with
410 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# Copyright 2024 Google Inc. | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
--- !ruby/object:Api::Resource | ||
name: 'WebResource' | ||
description: | | ||
A web resource is a website or domain with verified ownership. Once your | ||
ownership is verified you will be able to manage your website in the | ||
[Google Search Console](https://www.google.com/webmasters/tools/). | ||
~> **Note:** The verification data (DNS `TXT` record, HTML file, `meta` tag, etc.) | ||
must already exist before the web resource is created, and must be deleted before | ||
the web resource is destroyed. The Google Site Verification API checks that the | ||
verification data exists at creation time and does not exist at destruction time | ||
and will fail if the required condition is not met. | ||
base_url: webResource | ||
self_link: webResource/{{web_resource_id}} | ||
create_url: webResource?verificationMethod={{verification_method}} | ||
delete_url: webResource/{{web_resource_id}} | ||
id_format: webResource/{{web_resource_id}} | ||
immutable: true | ||
identity: | ||
- web_resource_id | ||
references: !ruby/object:Api::Resource::ReferenceLinks | ||
guides: | ||
'Getting Started': 'https://developers.google.com/site-verification/v1/getting_started' | ||
api: 'https://developers.google.com/site-verification/v1' | ||
timeouts: !ruby/object:Api::Timeouts | ||
insert_minutes: 60 | ||
error_retry_predicates: ['transport_tpg.IsSiteVerificationRetryableError'] | ||
examples: | ||
- !ruby/object:Provider::Terraform::Examples | ||
skip_test: true | ||
name: "site_verification_domain_record" | ||
primary_resource_id: "example" | ||
vars: | ||
managed_zone: "example.com" | ||
domain: "www.example.com" | ||
dns_name: "www.example.com." | ||
supports_indirect_user_project_override: true | ||
parameters: | ||
- !ruby/object:Api::Type::Enum | ||
name: 'verification_method' | ||
required: true | ||
immutable: true | ||
url_param_only: true | ||
description: | | ||
The verification method for the Site Verification system to use to verify | ||
this site or domain. | ||
values: | ||
- :ANALYTICS | ||
- :DNS_CNAME | ||
- :DNS_TXT | ||
- :FILE | ||
- :META | ||
- :TAG_MANAGER | ||
properties: | ||
- !ruby/object:Api::Type::String | ||
name: 'web_resource_id' | ||
output: true | ||
api_name: id | ||
description: | | ||
The string used to identify this web resource. | ||
- !ruby/object:Api::Type::NestedObject | ||
name: 'site' | ||
required: true | ||
description: | | ||
Container for the address and type of a site for which a verification token will be verified. | ||
properties: | ||
- !ruby/object:Api::Type::Enum | ||
name: 'type' | ||
required: true | ||
description: | | ||
The type of resource to be verified. | ||
values: | ||
- :INET_DOMAIN | ||
- :SITE | ||
- !ruby/object:Api::Type::String | ||
name: 'identifier' | ||
required: true | ||
description: | | ||
The site identifier. If the type is set to SITE, the identifier is a URL. If the type is | ||
set to INET_DOMAIN, the identifier is a domain name. | ||
- !ruby/object:Api::Type::Array | ||
name: 'owners' | ||
description: | | ||
The email addresses of all direct, verified owners of this exact property. Indirect owners — | ||
for example verified owners of the containing domain—are not included in this list. | ||
output: true | ||
item_type: Api::Type::String |
23 changes: 23 additions & 0 deletions
23
mmv1/templates/terraform/examples/site_verification_domain_record.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
data "google_site_verification_token" "token" { | ||
type = "INET_DOMAIN" | ||
identifier = "<%= ctx[:vars]['domain'] %>" | ||
verification_method = "DNS_TXT" | ||
} | ||
|
||
resource "google_dns_record_set" "example" { | ||
managed_zone = "<%= ctx[:vars]['managed_zone'] %>" | ||
name = "<%= ctx[:vars]['dns_name'] %>" | ||
type = "TXT" | ||
rrdatas = [data.google_site_verification_token.token.token] | ||
ttl = 86400 | ||
} | ||
|
||
resource "google_site_verification_web_resource" "<%= ctx[:primary_resource_id] %>" { | ||
site { | ||
type = data.google_site_verification_token.token.type | ||
identifier = data.google_site_verification_token.token.identifier | ||
} | ||
verification_method = data.google_site_verification_token.token.verification_method | ||
|
||
depends_on = [google_dns_record_set.example] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.