-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from jfrog/add-custom-domain-name-resource
Add resource 'myjfrog_custom_domain_name'
- Loading branch information
Showing
11 changed files
with
918 additions
and
11 deletions.
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
## 1.0.0 (July 18, 2024) | ||
## 1.0.0 (July 19, 2024). Tested on Artifactory with Terraform 1.9.2 and OpenTofu 1.7.3 | ||
|
||
FEATURES: | ||
|
||
* **New Resource:** `myjfrog_ip_allowlist`: Resource to manage MyJFrog IP allowlist. | ||
* **New Resource:** `myjfrog_custom_domain_name`: Resource to manage MyJFrog IP allowlist. PR: [#2](https://github.com/jfrog/terraform-provider-myjfrog/pull/2) |
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
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
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,104 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "myjfrog_custom_domain_name Resource - terraform-provider-myjfrog" | ||
subcategory: "" | ||
description: |- | ||
Provides a MyJFrog Custom Domain Name https://jfrog.com/help/r/jfrog-hosting-models-documentation/manage-custom-domain-names-in-myjfrog resource to manage custom domain names. Also see Custom Domain Name REST API https://jfrog.com/help/r/jfrog-rest-apis/custom-domain-name-rest-apis for more details. | ||
To use this resource, you need an access token. Only a Primary Admin can generate MyJFrog tokens. For more information, see Generate a Token in MyJFrog https://jfrog.com/help/r/jfrog-hosting-models-documentation/generate-a-token-in-myjfrog. | ||
--- | ||
|
||
# myjfrog_custom_domain_name (Resource) | ||
|
||
Provides a MyJFrog [Custom Domain Name](https://jfrog.com/help/r/jfrog-hosting-models-documentation/manage-custom-domain-names-in-myjfrog) resource to manage custom domain names. Also see [Custom Domain Name REST API](https://jfrog.com/help/r/jfrog-rest-apis/custom-domain-name-rest-apis) for more details. | ||
|
||
To use this resource, you need an access token. Only a Primary Admin can generate MyJFrog tokens. For more information, see [Generate a Token in MyJFrog](https://jfrog.com/help/r/jfrog-hosting-models-documentation/generate-a-token-in-myjfrog). | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
resource "myjfrog_custom_domain_name" "my-custom-domain-name" { | ||
certificate_name = "mycert" | ||
certificate_body = "-----BEGIN CERTIFICATE-----\nMIIETzCCAzegAwIBAgIGAY...jLjELMAkGA1UECwwC\n-----END CERTIFICATE-----\n" | ||
certificate_chain = "-----BEGIN CERTIFICATE-----\nMIIETzCCAzegAwIBAgIGAY...jLjELMAkGA1UECwwC\n-----END CERTIFICATE-----\n" | ||
certificate_private_key = "-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAqXr...rEgIP8TXkOkCaiA\n-----END RSA PRIVATE KEY-----\n" | ||
domains_under_certificate = [ | ||
{ | ||
url = "servername1.com" | ||
server_name = "serverName1" | ||
type = "platform_base_url" | ||
} | ||
] | ||
} | ||
resource "myjfrog_custom_domain_name" "my-custom-domain-name-2" { | ||
certificate_name = "mycert2" | ||
certificate_body = <<EOT | ||
-----BEGIN CERTIFICATE----- | ||
MIIETzCCAzegAwIBAgIGAY...jLjELMAkGA1UECwwC | ||
-----END CERTIFICATE----- | ||
EOT | ||
certificate_private_key = <<EOT | ||
-----BEGIN RSA PRIVATE KEY----- | ||
MIIEowIBAAKCAQEAqXr...rEgIP8TXkOkCaiA\ | ||
-----END RSA PRIVATE KEY----- | ||
EOT | ||
domains_under_certificate = [ | ||
{ | ||
url = "servername1.com" | ||
server_name = "serverName1" | ||
type = "platform_base_url" | ||
}, | ||
{ | ||
url = "servername2.com" | ||
server_name = "serverName2" | ||
type = "docker_sub_domain" | ||
docker_repository_name_override = "docker-local" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `certificate_body` (String) A certificate body is a text field containing information about the certificate such as the domain name, public key, signature algorithm, issuer, and validity period. You may include the certificate chain in the certificate body. | ||
- `certificate_name` (String) Give your certificate a unique name to help identify it. | ||
- `certificate_private_key` (String, Sensitive) The private key pairs with the certificate's public key for encryption. The keys must match. Private key must be in RSA format (RSA PKCS#1). If not, you can convert it to RSA using the following OpenSSL command: | ||
`openssl rsa -in private.key -out private_rsa.key -traditional` | ||
- `domains_under_certificate` (Attributes Set) (see [below for nested schema](#nestedatt--domains_under_certificate)) | ||
|
||
### Optional | ||
|
||
- `certificate_chain` (String) A chain of trust between certificates that is anchored by a root certificate authority is used to verify the validity of a certificate. | ||
|
||
### Read-Only | ||
|
||
- `certificate_expiry` (Number) | ||
- `certificate_status` (String) | ||
- `id` (String) The ID of this resource. | ||
|
||
<a id="nestedatt--domains_under_certificate"></a> | ||
### Nested Schema for `domains_under_certificate` | ||
|
||
Required: | ||
|
||
- `server_name` (String) The server_name field in your request refers to the designated JFrog server where you intend to configure a CNAME (Canonical Name). For instance, if your JFrog server URL is myserver.jfrog.io, and you wish to set up a CNAME for this server, you should enter `myserver` in the server_name field. | ||
- `type` (String) This attribute offers two valid options: | ||
* `platform_base_url`: Use this option when configuring the base URL for accessing the JPD (JFrog Platform Distribution) User Interface. You can also employ this URL as the base for API calls. | ||
* `docker_sub_domain`: Use this option when configuring the base URL for Docker-related operations, such as login, pull, and push actions, within the JPD. Please note that this parameter is exclusively available for JPD instances that have the Docker Subdomain method configured. | ||
For more detailed information on the various Docker methods available in Artifactory, please refer to [Get Started With Artifactory as a Docker Registry](https://jfrog.com/help/r/jfrog-artifactory-documentation/get-started-with-artifactory-as-a-docker-registry). | ||
- `url` (String) | ||
|
||
Optional: | ||
|
||
- `docker_repository_name_override` (String) Only available when `type` is set to `docker_sub_domain` (when configuring the base URL for Docker-related operations). Use this option when you wish to define an explicit repository name (not derived from the domain name) - please notice this is not best practice. | ||
|
||
## Import | ||
|
||
Import is supported using the following syntax: | ||
|
||
```shell | ||
terraform import myjfrog_custom_domain_name.my-custom-domain-name cert-id | ||
``` |
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 @@ | ||
terraform import myjfrog_custom_domain_name.my-custom-domain-name cert-id |
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,40 @@ | ||
resource "myjfrog_custom_domain_name" "my-custom-domain-name" { | ||
certificate_name = "mycert" | ||
certificate_body = "-----BEGIN CERTIFICATE-----\nMIIETzCCAzegAwIBAgIGAY...jLjELMAkGA1UECwwC\n-----END CERTIFICATE-----\n" | ||
certificate_chain = "-----BEGIN CERTIFICATE-----\nMIIETzCCAzegAwIBAgIGAY...jLjELMAkGA1UECwwC\n-----END CERTIFICATE-----\n" | ||
certificate_private_key = "-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAqXr...rEgIP8TXkOkCaiA\n-----END RSA PRIVATE KEY-----\n" | ||
domains_under_certificate = [ | ||
{ | ||
url = "servername1.com" | ||
server_name = "serverName1" | ||
type = "platform_base_url" | ||
} | ||
] | ||
} | ||
|
||
resource "myjfrog_custom_domain_name" "my-custom-domain-name-2" { | ||
certificate_name = "mycert2" | ||
certificate_body = <<EOT | ||
-----BEGIN CERTIFICATE----- | ||
MIIETzCCAzegAwIBAgIGAY...jLjELMAkGA1UECwwC | ||
-----END CERTIFICATE----- | ||
EOT | ||
certificate_private_key = <<EOT | ||
-----BEGIN RSA PRIVATE KEY----- | ||
MIIEowIBAAKCAQEAqXr...rEgIP8TXkOkCaiA\ | ||
-----END RSA PRIVATE KEY----- | ||
EOT | ||
domains_under_certificate = [ | ||
{ | ||
url = "servername1.com" | ||
server_name = "serverName1" | ||
type = "platform_base_url" | ||
}, | ||
{ | ||
url = "servername2.com" | ||
server_name = "serverName2" | ||
type = "docker_sub_domain" | ||
docker_repository_name_override = "docker-local" | ||
} | ||
] | ||
} |
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,13 @@ | ||
package myjfrog | ||
|
||
import "strings" | ||
|
||
type MyJFrogResponseAPIModel struct { | ||
Status string `json:"status"` | ||
StatusCode int64 `json:"statusCode"` | ||
Errors []string `json:"errors"` | ||
} | ||
|
||
func (m MyJFrogResponseAPIModel) Error() string { | ||
return strings.Join(m.Errors, ", ") | ||
} |
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.