1. Packages
  2. GitLab
  3. API Docs
  4. PagesDomain
GitLab v6.11.0 published on Friday, Apr 19, 2024 by Pulumi

gitlab.PagesDomain

Explore with Pulumi AI

gitlab logo
GitLab v6.11.0 published on Friday, Apr 19, 2024 by Pulumi

    The gitlab.PagesDomain resource allows connecting custom domains and TLS certificates in GitLab Pages.

    Upstream API: GitLab REST API docs

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as fs from "fs";
    import * as gitlab from "@pulumi/gitlab";
    
    // Example using auto_ssl_enabled, which uses lets encrypt to generate a certificate
    const thisPagesDomain = new gitlab.PagesDomain("thisPagesDomain", {
        project: "123",
        domain: "example.com",
        autoSslEnabled: true,
    });
    // Example using a manually generated certificate and key
    const thisIndex_pagesDomainPagesDomain = new gitlab.PagesDomain("thisIndex/pagesDomainPagesDomain", {
        project: "123",
        domain: "example.com",
        key: fs.readFileSync(`${path.module}/key.pem`, "utf8"),
        certificate: fs.readFileSync(`${path.module}/cert.pem`, "utf8"),
    });
    
    import pulumi
    import pulumi_gitlab as gitlab
    
    # Example using auto_ssl_enabled, which uses lets encrypt to generate a certificate
    this_pages_domain = gitlab.PagesDomain("thisPagesDomain",
        project="123",
        domain="example.com",
        auto_ssl_enabled=True)
    # Example using a manually generated certificate and key
    this_index_pages_domain_pages_domain = gitlab.PagesDomain("thisIndex/pagesDomainPagesDomain",
        project="123",
        domain="example.com",
        key=(lambda path: open(path).read())(f"{path['module']}/key.pem"),
        certificate=(lambda path: open(path).read())(f"{path['module']}/cert.pem"))
    
    package main
    
    import (
    	"fmt"
    	"os"
    
    	"github.com/pulumi/pulumi-gitlab/sdk/v6/go/gitlab"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func readFileOrPanic(path string) pulumi.StringPtrInput {
    	data, err := os.ReadFile(path)
    	if err != nil {
    		panic(err.Error())
    	}
    	return pulumi.String(string(data))
    }
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Example using auto_ssl_enabled, which uses lets encrypt to generate a certificate
    		_, err := gitlab.NewPagesDomain(ctx, "thisPagesDomain", &gitlab.PagesDomainArgs{
    			Project:        pulumi.String("123"),
    			Domain:         pulumi.String("example.com"),
    			AutoSslEnabled: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		// Example using a manually generated certificate and key
    		_, err = gitlab.NewPagesDomain(ctx, "thisIndex/pagesDomainPagesDomain", &gitlab.PagesDomainArgs{
    			Project:     pulumi.String("123"),
    			Domain:      pulumi.String("example.com"),
    			Key:         readFileOrPanic(fmt.Sprintf("%v/key.pem", path.Module)),
    			Certificate: readFileOrPanic(fmt.Sprintf("%v/cert.pem", path.Module)),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using Pulumi;
    using GitLab = Pulumi.GitLab;
    
    return await Deployment.RunAsync(() => 
    {
        // Example using auto_ssl_enabled, which uses lets encrypt to generate a certificate
        var thisPagesDomain = new GitLab.PagesDomain("thisPagesDomain", new()
        {
            Project = "123",
            Domain = "example.com",
            AutoSslEnabled = true,
        });
    
        // Example using a manually generated certificate and key
        var thisIndex_pagesDomainPagesDomain = new GitLab.PagesDomain("thisIndex/pagesDomainPagesDomain", new()
        {
            Project = "123",
            Domain = "example.com",
            Key = File.ReadAllText($"{path.Module}/key.pem"),
            Certificate = File.ReadAllText($"{path.Module}/cert.pem"),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gitlab.PagesDomain;
    import com.pulumi.gitlab.PagesDomainArgs;
    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) {
            // Example using auto_ssl_enabled, which uses lets encrypt to generate a certificate
            var thisPagesDomain = new PagesDomain("thisPagesDomain", PagesDomainArgs.builder()        
                .project(123)
                .domain("example.com")
                .autoSslEnabled(true)
                .build());
    
            // Example using a manually generated certificate and key
            var thisIndex_pagesDomainPagesDomain = new PagesDomain("thisIndex/pagesDomainPagesDomain", PagesDomainArgs.builder()        
                .project(123)
                .domain("example.com")
                .key(Files.readString(Paths.get(String.format("%s/key.pem", path.module()))))
                .certificate(Files.readString(Paths.get(String.format("%s/cert.pem", path.module()))))
                .build());
    
        }
    }
    
    resources:
      # Example using auto_ssl_enabled, which uses lets encrypt to generate a certificate
      thisPagesDomain:
        type: gitlab:PagesDomain
        properties:
          project: 123
          domain: example.com
          autoSslEnabled: true
      # Example using a manually generated certificate and key
      thisIndex/pagesDomainPagesDomain:
        type: gitlab:PagesDomain
        properties:
          project: 123
          domain: example.com
          key:
            fn::readFile: ${path.module}/key.pem
          certificate:
            fn::readFile: ${path.module}/cert.pem
    

    Create PagesDomain Resource

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

    Constructor syntax

    new PagesDomain(name: string, args: PagesDomainArgs, opts?: CustomResourceOptions);
    @overload
    def PagesDomain(resource_name: str,
                    args: PagesDomainArgs,
                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def PagesDomain(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    domain: Optional[str] = None,
                    project: Optional[str] = None,
                    auto_ssl_enabled: Optional[bool] = None,
                    certificate: Optional[str] = None,
                    expired: Optional[bool] = None,
                    key: Optional[str] = None)
    func NewPagesDomain(ctx *Context, name string, args PagesDomainArgs, opts ...ResourceOption) (*PagesDomain, error)
    public PagesDomain(string name, PagesDomainArgs args, CustomResourceOptions? opts = null)
    public PagesDomain(String name, PagesDomainArgs args)
    public PagesDomain(String name, PagesDomainArgs args, CustomResourceOptions options)
    
    type: gitlab:PagesDomain
    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 PagesDomainArgs
    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 PagesDomainArgs
    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 PagesDomainArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args PagesDomainArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args PagesDomainArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

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

    var pagesDomainResource = new GitLab.PagesDomain("pagesDomainResource", new()
    {
        Domain = "string",
        Project = "string",
        AutoSslEnabled = false,
        Certificate = "string",
        Expired = false,
        Key = "string",
    });
    
    example, err := gitlab.NewPagesDomain(ctx, "pagesDomainResource", &gitlab.PagesDomainArgs{
    	Domain:         pulumi.String("string"),
    	Project:        pulumi.String("string"),
    	AutoSslEnabled: pulumi.Bool(false),
    	Certificate:    pulumi.String("string"),
    	Expired:        pulumi.Bool(false),
    	Key:            pulumi.String("string"),
    })
    
    var pagesDomainResource = new PagesDomain("pagesDomainResource", PagesDomainArgs.builder()        
        .domain("string")
        .project("string")
        .autoSslEnabled(false)
        .certificate("string")
        .expired(false)
        .key("string")
        .build());
    
    pages_domain_resource = gitlab.PagesDomain("pagesDomainResource",
        domain="string",
        project="string",
        auto_ssl_enabled=False,
        certificate="string",
        expired=False,
        key="string")
    
    const pagesDomainResource = new gitlab.PagesDomain("pagesDomainResource", {
        domain: "string",
        project: "string",
        autoSslEnabled: false,
        certificate: "string",
        expired: false,
        key: "string",
    });
    
    type: gitlab:PagesDomain
    properties:
        autoSslEnabled: false
        certificate: string
        domain: string
        expired: false
        key: string
        project: string
    

    PagesDomain 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 PagesDomain resource accepts the following input properties:

    Domain string
    The custom domain indicated by the user.
    Project string
    The ID or URL-encoded path of the project owned by the authenticated user.
    AutoSslEnabled bool
    Enables automatic generation of SSL certificates issued by Let’s Encrypt for custom domains. When this is set to "true", certificate can't be provided.
    Certificate string
    The certificate in PEM format with intermediates following in most specific to least specific order.
    Expired bool
    Whether the certificate is expired.
    Key string
    The certificate key in PEM format.
    Domain string
    The custom domain indicated by the user.
    Project string
    The ID or URL-encoded path of the project owned by the authenticated user.
    AutoSslEnabled bool
    Enables automatic generation of SSL certificates issued by Let’s Encrypt for custom domains. When this is set to "true", certificate can't be provided.
    Certificate string
    The certificate in PEM format with intermediates following in most specific to least specific order.
    Expired bool
    Whether the certificate is expired.
    Key string
    The certificate key in PEM format.
    domain String
    The custom domain indicated by the user.
    project String
    The ID or URL-encoded path of the project owned by the authenticated user.
    autoSslEnabled Boolean
    Enables automatic generation of SSL certificates issued by Let’s Encrypt for custom domains. When this is set to "true", certificate can't be provided.
    certificate String
    The certificate in PEM format with intermediates following in most specific to least specific order.
    expired Boolean
    Whether the certificate is expired.
    key String
    The certificate key in PEM format.
    domain string
    The custom domain indicated by the user.
    project string
    The ID or URL-encoded path of the project owned by the authenticated user.
    autoSslEnabled boolean
    Enables automatic generation of SSL certificates issued by Let’s Encrypt for custom domains. When this is set to "true", certificate can't be provided.
    certificate string
    The certificate in PEM format with intermediates following in most specific to least specific order.
    expired boolean
    Whether the certificate is expired.
    key string
    The certificate key in PEM format.
    domain str
    The custom domain indicated by the user.
    project str
    The ID or URL-encoded path of the project owned by the authenticated user.
    auto_ssl_enabled bool
    Enables automatic generation of SSL certificates issued by Let’s Encrypt for custom domains. When this is set to "true", certificate can't be provided.
    certificate str
    The certificate in PEM format with intermediates following in most specific to least specific order.
    expired bool
    Whether the certificate is expired.
    key str
    The certificate key in PEM format.
    domain String
    The custom domain indicated by the user.
    project String
    The ID or URL-encoded path of the project owned by the authenticated user.
    autoSslEnabled Boolean
    Enables automatic generation of SSL certificates issued by Let’s Encrypt for custom domains. When this is set to "true", certificate can't be provided.
    certificate String
    The certificate in PEM format with intermediates following in most specific to least specific order.
    expired Boolean
    Whether the certificate is expired.
    key String
    The certificate key in PEM format.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Url string
    The URL for the given domain.
    VerificationCode string
    The verification code for the domain.
    Verified bool
    The certificate data.
    Id string
    The provider-assigned unique ID for this managed resource.
    Url string
    The URL for the given domain.
    VerificationCode string
    The verification code for the domain.
    Verified bool
    The certificate data.
    id String
    The provider-assigned unique ID for this managed resource.
    url String
    The URL for the given domain.
    verificationCode String
    The verification code for the domain.
    verified Boolean
    The certificate data.
    id string
    The provider-assigned unique ID for this managed resource.
    url string
    The URL for the given domain.
    verificationCode string
    The verification code for the domain.
    verified boolean
    The certificate data.
    id str
    The provider-assigned unique ID for this managed resource.
    url str
    The URL for the given domain.
    verification_code str
    The verification code for the domain.
    verified bool
    The certificate data.
    id String
    The provider-assigned unique ID for this managed resource.
    url String
    The URL for the given domain.
    verificationCode String
    The verification code for the domain.
    verified Boolean
    The certificate data.

    Look up Existing PagesDomain Resource

    Get an existing PagesDomain 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?: PagesDomainState, opts?: CustomResourceOptions): PagesDomain
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            auto_ssl_enabled: Optional[bool] = None,
            certificate: Optional[str] = None,
            domain: Optional[str] = None,
            expired: Optional[bool] = None,
            key: Optional[str] = None,
            project: Optional[str] = None,
            url: Optional[str] = None,
            verification_code: Optional[str] = None,
            verified: Optional[bool] = None) -> PagesDomain
    func GetPagesDomain(ctx *Context, name string, id IDInput, state *PagesDomainState, opts ...ResourceOption) (*PagesDomain, error)
    public static PagesDomain Get(string name, Input<string> id, PagesDomainState? state, CustomResourceOptions? opts = null)
    public static PagesDomain get(String name, Output<String> id, PagesDomainState 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:
    AutoSslEnabled bool
    Enables automatic generation of SSL certificates issued by Let’s Encrypt for custom domains. When this is set to "true", certificate can't be provided.
    Certificate string
    The certificate in PEM format with intermediates following in most specific to least specific order.
    Domain string
    The custom domain indicated by the user.
    Expired bool
    Whether the certificate is expired.
    Key string
    The certificate key in PEM format.
    Project string
    The ID or URL-encoded path of the project owned by the authenticated user.
    Url string
    The URL for the given domain.
    VerificationCode string
    The verification code for the domain.
    Verified bool
    The certificate data.
    AutoSslEnabled bool
    Enables automatic generation of SSL certificates issued by Let’s Encrypt for custom domains. When this is set to "true", certificate can't be provided.
    Certificate string
    The certificate in PEM format with intermediates following in most specific to least specific order.
    Domain string
    The custom domain indicated by the user.
    Expired bool
    Whether the certificate is expired.
    Key string
    The certificate key in PEM format.
    Project string
    The ID or URL-encoded path of the project owned by the authenticated user.
    Url string
    The URL for the given domain.
    VerificationCode string
    The verification code for the domain.
    Verified bool
    The certificate data.
    autoSslEnabled Boolean
    Enables automatic generation of SSL certificates issued by Let’s Encrypt for custom domains. When this is set to "true", certificate can't be provided.
    certificate String
    The certificate in PEM format with intermediates following in most specific to least specific order.
    domain String
    The custom domain indicated by the user.
    expired Boolean
    Whether the certificate is expired.
    key String
    The certificate key in PEM format.
    project String
    The ID or URL-encoded path of the project owned by the authenticated user.
    url String
    The URL for the given domain.
    verificationCode String
    The verification code for the domain.
    verified Boolean
    The certificate data.
    autoSslEnabled boolean
    Enables automatic generation of SSL certificates issued by Let’s Encrypt for custom domains. When this is set to "true", certificate can't be provided.
    certificate string
    The certificate in PEM format with intermediates following in most specific to least specific order.
    domain string
    The custom domain indicated by the user.
    expired boolean
    Whether the certificate is expired.
    key string
    The certificate key in PEM format.
    project string
    The ID or URL-encoded path of the project owned by the authenticated user.
    url string
    The URL for the given domain.
    verificationCode string
    The verification code for the domain.
    verified boolean
    The certificate data.
    auto_ssl_enabled bool
    Enables automatic generation of SSL certificates issued by Let’s Encrypt for custom domains. When this is set to "true", certificate can't be provided.
    certificate str
    The certificate in PEM format with intermediates following in most specific to least specific order.
    domain str
    The custom domain indicated by the user.
    expired bool
    Whether the certificate is expired.
    key str
    The certificate key in PEM format.
    project str
    The ID or URL-encoded path of the project owned by the authenticated user.
    url str
    The URL for the given domain.
    verification_code str
    The verification code for the domain.
    verified bool
    The certificate data.
    autoSslEnabled Boolean
    Enables automatic generation of SSL certificates issued by Let’s Encrypt for custom domains. When this is set to "true", certificate can't be provided.
    certificate String
    The certificate in PEM format with intermediates following in most specific to least specific order.
    domain String
    The custom domain indicated by the user.
    expired Boolean
    Whether the certificate is expired.
    key String
    The certificate key in PEM format.
    project String
    The ID or URL-encoded path of the project owned by the authenticated user.
    url String
    The URL for the given domain.
    verificationCode String
    The verification code for the domain.
    verified Boolean
    The certificate data.

    Import

    GitLab pages domain can be imported using an id made up of projectId:domain without the http protocol, e.g.

    $ pulumi import gitlab:index/pagesDomain:PagesDomain this 123:example.com
    

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

    Package Details

    Repository
    GitLab pulumi/pulumi-gitlab
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the gitlab Terraform Provider.
    gitlab logo
    GitLab v6.11.0 published on Friday, Apr 19, 2024 by Pulumi