The gitlab_pages_domain
resource allows connecting custom domains and TLS certificates in GitLab Pages.
Upstream API: GitLab REST API docs
# Example using auto_ssl_enabled, which uses lets encrypt to generate a certificate
resource "gitlab_pages_domain" "this" {
project = 123
domain = "example.com"
auto_ssl_enabled = true
}
# Example using a manually generated certificate and key
resource "gitlab_pages_domain" "this" {
project = 123
domain = "example.com"
key = file("${path.module}/key.pem")
certificate = file("${path.module}/cert.pem")
}
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.auto_ssl_enabled
(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.id
(String) The ID of this Terraform resource. In the format of <project>:<domain>
.url
(String) The URL for the given domain.verification_code
(String, Sensitive) The verification code for the domain.verified
(Boolean) The certificate data.Import is supported using the following syntax:
# GitLab pages domain can be imported using an id made up of `projectId:domain` _without_ the http protocol, e.g.
terraform import gitlab_pages_domain.this 123:example.com