1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. siteverification
  5. WebResource
Google Cloud Classic v8.3.1 published on Wednesday, Sep 25, 2024 by Pulumi

gcp.siteverification.WebResource

Explore with Pulumi AI

gcp logo
Google Cloud Classic v8.3.1 published on Wednesday, Sep 25, 2024 by Pulumi

    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.

    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.

    To get more information about WebResource, see:

    Example Usage

    Site Verification Domain Record

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const token = gcp.siteverification.getToken({
        type: "INET_DOMAIN",
        identifier: "www.example.com",
        verificationMethod: "DNS_TXT",
    });
    const example = new gcp.dns.RecordSet("example", {
        managedZone: "example.com",
        name: "www.example.com.",
        type: "TXT",
        rrdatas: [token.then(token => token.token)],
        ttl: 86400,
    });
    const exampleWebResource = new gcp.siteverification.WebResource("example", {
        site: {
            type: token.then(token => token.type),
            identifier: token.then(token => token.identifier),
        },
        verificationMethod: token.then(token => token.verificationMethod),
    }, {
        dependsOn: [example],
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    token = gcp.siteverification.get_token(type="INET_DOMAIN",
        identifier="www.example.com",
        verification_method="DNS_TXT")
    example = gcp.dns.RecordSet("example",
        managed_zone="example.com",
        name="www.example.com.",
        type="TXT",
        rrdatas=[token.token],
        ttl=86400)
    example_web_resource = gcp.siteverification.WebResource("example",
        site={
            "type": token.type,
            "identifier": token.identifier,
        },
        verification_method=token.verification_method,
        opts = pulumi.ResourceOptions(depends_on=[example]))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/dns"
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/siteverification"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		token, err := siteverification.GetToken(ctx, &siteverification.GetTokenArgs{
    			Type:               "INET_DOMAIN",
    			Identifier:         "www.example.com",
    			VerificationMethod: "DNS_TXT",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		example, err := dns.NewRecordSet(ctx, "example", &dns.RecordSetArgs{
    			ManagedZone: pulumi.String("example.com"),
    			Name:        pulumi.String("www.example.com."),
    			Type:        pulumi.String("TXT"),
    			Rrdatas: pulumi.StringArray{
    				pulumi.String(token.Token),
    			},
    			Ttl: pulumi.Int(86400),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = siteverification.NewWebResource(ctx, "example", &siteverification.WebResourceArgs{
    			Site: &siteverification.WebResourceSiteArgs{
    				Type:       pulumi.String(token.Type),
    				Identifier: pulumi.String(token.Identifier),
    			},
    			VerificationMethod: pulumi.String(token.VerificationMethod),
    		}, pulumi.DependsOn([]pulumi.Resource{
    			example,
    		}))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var token = Gcp.SiteVerification.GetToken.Invoke(new()
        {
            Type = "INET_DOMAIN",
            Identifier = "www.example.com",
            VerificationMethod = "DNS_TXT",
        });
    
        var example = new Gcp.Dns.RecordSet("example", new()
        {
            ManagedZone = "example.com",
            Name = "www.example.com.",
            Type = "TXT",
            Rrdatas = new[]
            {
                token.Apply(getTokenResult => getTokenResult.Token),
            },
            Ttl = 86400,
        });
    
        var exampleWebResource = new Gcp.SiteVerification.WebResource("example", new()
        {
            Site = new Gcp.SiteVerification.Inputs.WebResourceSiteArgs
            {
                Type = token.Apply(getTokenResult => getTokenResult.Type),
                Identifier = token.Apply(getTokenResult => getTokenResult.Identifier),
            },
            VerificationMethod = token.Apply(getTokenResult => getTokenResult.VerificationMethod),
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                example,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.siteverification.SiteverificationFunctions;
    import com.pulumi.gcp.siteverification.inputs.GetTokenArgs;
    import com.pulumi.gcp.dns.RecordSet;
    import com.pulumi.gcp.dns.RecordSetArgs;
    import com.pulumi.gcp.siteverification.WebResource;
    import com.pulumi.gcp.siteverification.WebResourceArgs;
    import com.pulumi.gcp.siteverification.inputs.WebResourceSiteArgs;
    import com.pulumi.resources.CustomResourceOptions;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var token = SiteverificationFunctions.getToken(GetTokenArgs.builder()
                .type("INET_DOMAIN")
                .identifier("www.example.com")
                .verificationMethod("DNS_TXT")
                .build());
    
            var example = new RecordSet("example", RecordSetArgs.builder()
                .managedZone("example.com")
                .name("www.example.com.")
                .type("TXT")
                .rrdatas(token.applyValue(getTokenResult -> getTokenResult.token()))
                .ttl(86400)
                .build());
    
            var exampleWebResource = new WebResource("exampleWebResource", WebResourceArgs.builder()
                .site(WebResourceSiteArgs.builder()
                    .type(token.applyValue(getTokenResult -> getTokenResult.type()))
                    .identifier(token.applyValue(getTokenResult -> getTokenResult.identifier()))
                    .build())
                .verificationMethod(token.applyValue(getTokenResult -> getTokenResult.verificationMethod()))
                .build(), CustomResourceOptions.builder()
                    .dependsOn(example)
                    .build());
    
        }
    }
    
    resources:
      example:
        type: gcp:dns:RecordSet
        properties:
          managedZone: example.com
          name: www.example.com.
          type: TXT
          rrdatas:
            - ${token.token}
          ttl: 86400
      exampleWebResource:
        type: gcp:siteverification:WebResource
        name: example
        properties:
          site:
            type: ${token.type}
            identifier: ${token.identifier}
          verificationMethod: ${token.verificationMethod}
        options:
          dependson:
            - ${example}
    variables:
      token:
        fn::invoke:
          Function: gcp:siteverification:getToken
          Arguments:
            type: INET_DOMAIN
            identifier: www.example.com
            verificationMethod: DNS_TXT
    

    Create WebResource Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new WebResource(name: string, args: WebResourceArgs, opts?: CustomResourceOptions);
    @overload
    def WebResource(resource_name: str,
                    args: WebResourceArgs,
                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def WebResource(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    site: Optional[WebResourceSiteArgs] = None,
                    verification_method: Optional[str] = None)
    func NewWebResource(ctx *Context, name string, args WebResourceArgs, opts ...ResourceOption) (*WebResource, error)
    public WebResource(string name, WebResourceArgs args, CustomResourceOptions? opts = null)
    public WebResource(String name, WebResourceArgs args)
    public WebResource(String name, WebResourceArgs args, CustomResourceOptions options)
    
    type: gcp:siteverification:WebResource
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args WebResourceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args WebResourceArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args WebResourceArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args WebResourceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args WebResourceArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var webResourceResource = new Gcp.SiteVerification.WebResource("webResourceResource", new()
    {
        Site = new Gcp.SiteVerification.Inputs.WebResourceSiteArgs
        {
            Identifier = "string",
            Type = "string",
        },
        VerificationMethod = "string",
    });
    
    example, err := siteverification.NewWebResource(ctx, "webResourceResource", &siteverification.WebResourceArgs{
    	Site: &siteverification.WebResourceSiteArgs{
    		Identifier: pulumi.String("string"),
    		Type:       pulumi.String("string"),
    	},
    	VerificationMethod: pulumi.String("string"),
    })
    
    var webResourceResource = new WebResource("webResourceResource", WebResourceArgs.builder()
        .site(WebResourceSiteArgs.builder()
            .identifier("string")
            .type("string")
            .build())
        .verificationMethod("string")
        .build());
    
    web_resource_resource = gcp.siteverification.WebResource("webResourceResource",
        site={
            "identifier": "string",
            "type": "string",
        },
        verification_method="string")
    
    const webResourceResource = new gcp.siteverification.WebResource("webResourceResource", {
        site: {
            identifier: "string",
            type: "string",
        },
        verificationMethod: "string",
    });
    
    type: gcp:siteverification:WebResource
    properties:
        site:
            identifier: string
            type: string
        verificationMethod: string
    

    WebResource Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The WebResource resource accepts the following input properties:

    Site WebResourceSite
    Container for the address and type of a site for which a verification token will be verified. Structure is documented below.
    VerificationMethod string
    The verification method for the Site Verification system to use to verify this site or domain. Possible values are: ANALYTICS, DNS_CNAME, DNS_TXT, FILE, META, TAG_MANAGER.
    Site WebResourceSiteArgs
    Container for the address and type of a site for which a verification token will be verified. Structure is documented below.
    VerificationMethod string
    The verification method for the Site Verification system to use to verify this site or domain. Possible values are: ANALYTICS, DNS_CNAME, DNS_TXT, FILE, META, TAG_MANAGER.
    site WebResourceSite
    Container for the address and type of a site for which a verification token will be verified. Structure is documented below.
    verificationMethod String
    The verification method for the Site Verification system to use to verify this site or domain. Possible values are: ANALYTICS, DNS_CNAME, DNS_TXT, FILE, META, TAG_MANAGER.
    site WebResourceSite
    Container for the address and type of a site for which a verification token will be verified. Structure is documented below.
    verificationMethod string
    The verification method for the Site Verification system to use to verify this site or domain. Possible values are: ANALYTICS, DNS_CNAME, DNS_TXT, FILE, META, TAG_MANAGER.
    site WebResourceSiteArgs
    Container for the address and type of a site for which a verification token will be verified. Structure is documented below.
    verification_method str
    The verification method for the Site Verification system to use to verify this site or domain. Possible values are: ANALYTICS, DNS_CNAME, DNS_TXT, FILE, META, TAG_MANAGER.
    site Property Map
    Container for the address and type of a site for which a verification token will be verified. Structure is documented below.
    verificationMethod String
    The verification method for the Site Verification system to use to verify this site or domain. Possible values are: ANALYTICS, DNS_CNAME, DNS_TXT, FILE, META, TAG_MANAGER.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the WebResource resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Owners List<string>
    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.
    WebResourceId string
    The string used to identify this web resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    Owners []string
    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.
    WebResourceId string
    The string used to identify this web resource.
    id String
    The provider-assigned unique ID for this managed resource.
    owners List<String>
    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.
    webResourceId String
    The string used to identify this web resource.
    id string
    The provider-assigned unique ID for this managed resource.
    owners string[]
    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.
    webResourceId string
    The string used to identify this web resource.
    id str
    The provider-assigned unique ID for this managed resource.
    owners Sequence[str]
    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.
    web_resource_id str
    The string used to identify this web resource.
    id String
    The provider-assigned unique ID for this managed resource.
    owners List<String>
    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.
    webResourceId String
    The string used to identify this web resource.

    Look up Existing WebResource Resource

    Get an existing WebResource resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: WebResourceState, opts?: CustomResourceOptions): WebResource
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            owners: Optional[Sequence[str]] = None,
            site: Optional[WebResourceSiteArgs] = None,
            verification_method: Optional[str] = None,
            web_resource_id: Optional[str] = None) -> WebResource
    func GetWebResource(ctx *Context, name string, id IDInput, state *WebResourceState, opts ...ResourceOption) (*WebResource, error)
    public static WebResource Get(string name, Input<string> id, WebResourceState? state, CustomResourceOptions? opts = null)
    public static WebResource get(String name, Output<String> id, WebResourceState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Owners List<string>
    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.
    Site WebResourceSite
    Container for the address and type of a site for which a verification token will be verified. Structure is documented below.
    VerificationMethod string
    The verification method for the Site Verification system to use to verify this site or domain. Possible values are: ANALYTICS, DNS_CNAME, DNS_TXT, FILE, META, TAG_MANAGER.
    WebResourceId string
    The string used to identify this web resource.
    Owners []string
    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.
    Site WebResourceSiteArgs
    Container for the address and type of a site for which a verification token will be verified. Structure is documented below.
    VerificationMethod string
    The verification method for the Site Verification system to use to verify this site or domain. Possible values are: ANALYTICS, DNS_CNAME, DNS_TXT, FILE, META, TAG_MANAGER.
    WebResourceId string
    The string used to identify this web resource.
    owners List<String>
    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.
    site WebResourceSite
    Container for the address and type of a site for which a verification token will be verified. Structure is documented below.
    verificationMethod String
    The verification method for the Site Verification system to use to verify this site or domain. Possible values are: ANALYTICS, DNS_CNAME, DNS_TXT, FILE, META, TAG_MANAGER.
    webResourceId String
    The string used to identify this web resource.
    owners string[]
    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.
    site WebResourceSite
    Container for the address and type of a site for which a verification token will be verified. Structure is documented below.
    verificationMethod string
    The verification method for the Site Verification system to use to verify this site or domain. Possible values are: ANALYTICS, DNS_CNAME, DNS_TXT, FILE, META, TAG_MANAGER.
    webResourceId string
    The string used to identify this web resource.
    owners Sequence[str]
    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.
    site WebResourceSiteArgs
    Container for the address and type of a site for which a verification token will be verified. Structure is documented below.
    verification_method str
    The verification method for the Site Verification system to use to verify this site or domain. Possible values are: ANALYTICS, DNS_CNAME, DNS_TXT, FILE, META, TAG_MANAGER.
    web_resource_id str
    The string used to identify this web resource.
    owners List<String>
    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.
    site Property Map
    Container for the address and type of a site for which a verification token will be verified. Structure is documented below.
    verificationMethod String
    The verification method for the Site Verification system to use to verify this site or domain. Possible values are: ANALYTICS, DNS_CNAME, DNS_TXT, FILE, META, TAG_MANAGER.
    webResourceId String
    The string used to identify this web resource.

    Supporting Types

    WebResourceSite, WebResourceSiteArgs

    Identifier string
    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.


    Type string
    The type of resource to be verified. Possible values are: INET_DOMAIN, SITE.
    Identifier string
    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.


    Type string
    The type of resource to be verified. Possible values are: INET_DOMAIN, SITE.
    identifier String
    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.


    type String
    The type of resource to be verified. Possible values are: INET_DOMAIN, SITE.
    identifier string
    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.


    type string
    The type of resource to be verified. Possible values are: INET_DOMAIN, SITE.
    identifier str
    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.


    type str
    The type of resource to be verified. Possible values are: INET_DOMAIN, SITE.
    identifier String
    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.


    type String
    The type of resource to be verified. Possible values are: INET_DOMAIN, SITE.

    Import

    WebResource can be imported using any of these accepted formats:

    • webResource/{{web_resource_id}}

    • {{web_resource_id}}

    When using the pulumi import command, WebResource can be imported using one of the formats above. For example:

    $ pulumi import gcp:siteverification/webResource:WebResource default webResource/{{web_resource_id}}
    
    $ pulumi import gcp:siteverification/webResource:WebResource default {{web_resource_id}}
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v8.3.1 published on Wednesday, Sep 25, 2024 by Pulumi