Skip to content

Commit

Permalink
Merge pull request #898 from jfrog/GH-880-add-helmoci-package-type
Browse files Browse the repository at this point in the history
Add helmoci package type for resources and data sources
  • Loading branch information
alexhung authored Mar 6, 2024
2 parents 82ebc86 + 33cea37 commit 1c9860c
Show file tree
Hide file tree
Showing 33 changed files with 1,053 additions and 12 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 10.2.0 (Mar 5, 2024)
## 10.2.0 (Mar 6, 2024)

FEATURES:

Expand All @@ -7,6 +7,11 @@ FEATURES:

PR: [#897](https://github.com/jfrog/terraform-provider-artifactory/pull/897) Issue: [#885](https://github.com/jfrog/terraform-provider-artifactory/issues/885)

* data/artifactory_*_helmoci_repository: add Helm OCI package support for all repository type.
* resource/artifactory_*_helmoci_repository: add Helm OCI package support for all repository type.

PR: [#898](https://github.com/jfrog/terraform-provider-artifactory/pull/898) Issue: [#880](https://github.com/jfrog/terraform-provider-artifactory/issues/880)

## 10.1.5 (Feb 29, 2024)

BUG FIXES:
Expand Down
31 changes: 31 additions & 0 deletions docs/data-sources/federated_helmoci_repository.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
subcategory: "Federated Repositories"
---
# Artifactory Federated Helm OCI Repository Data Source

Retrieves a federated Helm OCI repository.

## Example Usage

```hcl
data "artifactory_federated_helmoci_repository" "my-helmoci-federated" {
key = "my-helmoci-federated"
}
```

## Argument Reference

* `key` - (Required) the identity key of the repo.

## Attribute Reference
The following attributes are supported, along with the [list of attributes from the local Helm OCI repository](local_helmoci_repository.md):

* `member` - The list of Federated members and must contain this repository URL (configured base URL
`/artifactory/` + repo `key`). Note that each of the federated members will need to have a base URL set.
Please follow the [instruction](https://www.jfrog.com/confluence/display/JFROG/Working+with+Federated+Repositories#WorkingwithFederatedRepositories-SettingUpaFederatedRepository)
to set up Federated repositories correctly.
* `url` - Full URL to ending with the repository name.
* `enabled` - Represents the active state of the federated member. It is supported to change the enabled
status of my own member. The config will be updated on the other federated members automatically.
* `proxy` - Proxy key from Artifactory Proxies settings.
* `disable_proxy` - When set to `true`, the proxy is disabled, and not returned in the API response body. If there is a default proxy set for the Artifactory instance, it will be ignored, too.
28 changes: 28 additions & 0 deletions docs/data-sources/local_helmoci_repository.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
subcategory: "Local Repositories"
---

# Artifactory Local Helm OCI Repository Data Source

Retrieves a local Helm OCI repository resource

## Example Usage

```hcl
resource "artifactory_local_helmoci_repository" "my-helmoci-local" {
key = "my-helmoci-local"
}
```

## Argument Reference

The following argument is supported:

* `key` - (Required) the identity key of the repo.

## Attribute Reference

The following attributes are supported, along with the [common list of attributes for the local repositories](local.md):

* `tag_retention` - If greater than 1, overwritten tags will be saved by their digest, up to the set up number.
* `max_unique_tags` - The maximum number of unique tags of a single Docker image to store in this repository. Once the number tags for an image exceeds this setting, older tags are removed. A value of 0 (default) indicates there is no limit.
28 changes: 28 additions & 0 deletions docs/data-sources/remote_helmoci_repository.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
subcategory: "Remote Repositories"
---
# Artifactory Remote Helm OCI Repository Data Source

Retrieves a remote Helm OCI repository.

## Example Usage

```hcl
data "artifactory_remote_helmoci_repository" "my-helmoci-remote" {
key = "my-helmoci-remote"
}
```

## Argument Reference

The following argument is supported:

* `key` - (Required) the identity key of the repo.

## Attribute Reference

The following attributes are supported, along with the [common list of attributes for the remote repositories](../resources/remote.md):

* `enable_token_authentication` - (Optional) Enable token (Bearer) based authentication.
* `external_dependencies_enabled` - (Optional) Also known as 'Foreign Layers Caching' on the UI.
* `external_dependencies_patterns` - (Optional) Optional include patterns to match external URLs. Ant-style path expressions are supported (*, **, ?). For example, specifying `**/github.com/**` will only allow downloading foreign layers from github.com host. Due to SDKv2 limitations, we can't set the default value for the list. This value `[**]` must be assigned to the attribute manually, if user don't specify any other non-default values. We don't want to make this attribute required, but it must be set to avoid the state drift on update. Note: Artifactory assigns `[**]` on update if HCL doesn't have the attribute set or the list is empty.
26 changes: 26 additions & 0 deletions docs/data-sources/virtual_helmoci_repository.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
subcategory: "Virtual Repositories"
---
# Artifactory Virtual Helm OCI Repository Data Source

Retrieves a virtual Helm OCI repository.

## Example Usage

```hcl
data "artifactory_virtual_helmoci_repository" "my-helmoci-virtual" {
key = "my-helmoci-virtual"
}
```

## Argument Reference

The following argument is supported:

* `key` - (Required) the identity key of the repo.

## Attribute Reference

The following attributes are supported, along with the [common list of arguments for the virtual repositories](../resources/virtual.md):

* `resolve_oci_tags_by_timestamp` - (Optional) When enabled, in cases where the same OCI tag exists in two or more of the aggregated repositories, Artifactory will return the tag that has the latest timestamp. Default values is `false`.
47 changes: 47 additions & 0 deletions docs/resources/federated_helmoci_repository.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
subcategory: "Federated Repositories"
---
# Artifactory Federated Helm OCI Repository Resource

Creates a federated Helm OCI repository.

## Example Usage

```hcl
resource "artifactory_federated_helmoci_repository" "my-helmoci-federated" {
key = "my-helmoci-federated"
member {
url = "http://tempurl.org/artifactory/my-helmoci-federated"
enabled = true
}
member {
url = "http://tempurl2.org/artifactory/my-helmoci-federated-2"
enabled = true
}
}
```

## Argument Reference

The following attributes are supported, along with the [list of attributes from the local Helm OCI repository](local_helmoci_repository.md):

* `key` - (Required) the identity key of the repo.
* `member` - (Required) The list of Federated members and must contain this repository URL (configured base URL
`/artifactory/` + repo `key`). Note that each of the federated members will need to have a base URL set.
Please follow the [instruction](https://www.jfrog.com/confluence/display/JFROG/Working+with+Federated+Repositories#WorkingwithFederatedRepositories-SettingUpaFederatedRepository)
to set up Federated repositories correctly.
* `url` - (Required) Full URL to ending with the repository name.
* `enabled` - (Required) Represents the active state of the federated member. It is supported to change the enabled status of my own member. The config will be updated on the other federated members automatically.
* `cleanup_on_delete` - (Optional) Delete all federated members on `terraform destroy` if set to `true`. Default is `false`. This attribute is added to match Terrform logic, so all the resources, created by the provider, must be removed on cleanup. Artifactory's behavior for the federated repositories is different, all the federated repositories stay after the user deletes the initial federated repository. **Caution**: if set to `true` all the repositories in the federation will be deleted, including repositories on other Artifactory instances in the "Circle of trust". This operation can not be reversed.
* `proxy` - (Optional) Proxy key from Artifactory Proxies settings. Default is empty field. Can't be set if `disable_proxy = true`.
* `disable_proxy` - (Optional, Default: `false`) When set to `true`, the proxy is disabled, and not returned in the API response body. If there is a default proxy set for the Artifactory instance, it will be ignored, too.

## Import

Federated repositories can be imported using their name, e.g.

```
$ terraform import artifactory_federated_helmoci_repository.my-helmoci-federated my-helmoci-federated
```
2 changes: 1 addition & 1 deletion docs/resources/local.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The following arguments are supported:
contain spaces or special characters.
* `description` - (Optional)
* `notes` - (Optional)
* `project_key` - (Optional) Project key for assigning this repository to. Must be 2 - 20 lowercase alphanumeric and hyphen characters. When assigning repository to a project, repository key must be prefixed with project key, separated by a dash. We don't recommend using this attribute to assign the repository to the project. Use the `repos` attribute in Project provider to manage the list of repositories.
* `project_key` - (Optional) Project key for assigning this repository to. Must be 2 - 32 lowercase alphanumeric and hyphen characters. When assigning repository to a project, repository key must be prefixed with project key, separated by a dash. We don't recommend using this attribute to assign the repository to the project. Use the `repos` attribute in Project provider to manage the list of repositories.
* `project_environments` - (Optional) Project environment for assigning this repository to. Allow values: `DEV`, `PROD`, or one of custom environment.
Before Artifactory 7.53.1, up to 2 values (`DEV` and `PROD`) are allowed. From 7.53.1 onward, only one value is allowed.
The attribute should only be used if the repository is already assigned to the existing project. If not, the attribute will be ignored by Artifactory, but will remain in the Terraform state, which will create state drift during the update.
Expand Down
37 changes: 37 additions & 0 deletions docs/resources/local_helmoci_repository.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
subcategory: "Local Repositories"
---
# Artifactory Local Helm OCI Repository Resource

Creates a local Helm OCI repository.

Official documentation can be found [here](https://jfrog.com/help/r/jfrog-artifactory-documentation/helm-oci-repositories)

## Example Usage

```hcl
resource "artifactory_local_helmoci_repository" "my-helmoci-local" {
key = "my-helmoci-local"
tag_retention = 3
max_unique_tags = 5
}
```

## Argument Reference

Arguments have a one to one mapping with the [JFrog API](https://www.jfrog.com/confluence/display/RTF/Repository+Configuration+JSON).
The following arguments are supported, along with the [common list of arguments for the local repositories](local.md):

* `key` - (Required) the identity key of the repo.
* `tag_retention` - (Optional) If greater than 1, overwritten tags will be saved by their digest, up to the set up number.
* `max_unique_tags` - (Optional) The maximum number of unique tags of a single OCI image to store in this
repository. Once the number tags for an image exceeds this setting, older tags are removed.
A value of 0 (default) indicates there is no limit.

## Import

Local repositories can be imported using their name, e.g.

```
$ terraform import artifactory_local_helmoci_repository.my-helmoci-local my-helmoci-local
```
4 changes: 2 additions & 2 deletions docs/resources/remote.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ All generic repo arguments are supported, in addition to:
* `key` - (Required) A mandatory identifier for the repository that must be unique. It cannot begin with a number or contain spaces or special characters.
* `description` - (Optional) Public description.
* `notes` - (Optional) Internal description.
* `project_key` - (Optional) Project key for assigning this repository to. Must be 2 - 20 lowercase alphanumeric and hyphen characters. When assigning repository to a project, repository key must be prefixed with project key, separated by a dash. We don't recommend using this attribute to assign the repository to the project. Use the `repos` attribute in Project provider to manage the list of repositories.
* `project_key` - (Optional) Project key for assigning this repository to. Must be 2 - 32 lowercase alphanumeric and hyphen characters. When assigning repository to a project, repository key must be prefixed with project key, separated by a dash. We don't recommend using this attribute to assign the repository to the project. Use the `repos` attribute in Project provider to manage the list of repositories.
* `project_environments` - (Optional) Project environment for assigning this repository to. Allow values: `DEV`, `PROD`, or one of custom environment.
Before Artifactory 7.53.1, up to 2 values (`DEV` and `PROD`) are allowed. From 7.53.1 onward, only one value is allowed.
The attribute should only be used if the repository is already assigned to the existing project. If not, the attribute will be ignored by Artifactory, but will remain in the Terraform state, which will create state drift during the update.
* `url` - (Required) The remote repo URL.
* `url` - (Required) This is a URL to the remote registry. Consider using HTTPS to ensure a secure connection.
* `username` - (Optional)
* `password` - (Optional)
* `proxy` - (Optional) Proxy key from Artifactory Proxies settings. Default is empty field. Can't be set if `disable_proxy = true`.
Expand Down
1 change: 1 addition & 0 deletions docs/resources/remote_docker_repository.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ subcategory: "Remote Repositories"
# Artifactory Remote Repository Resource

Creates remote Docker repository resource.

Official documentation can be found [here](https://www.jfrog.com/confluence/display/JFROG/Docker+Registry)


Expand Down
42 changes: 42 additions & 0 deletions docs/resources/remote_helmoci_repository.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
subcategory: "Remote Repositories"
---
# Artifactory Remote Helm OCI Repository Resource

Creates remote Helm OCI repository resource.

Official documentation can be found [here](https://jfrog.com/help/r/jfrog-artifactory-documentation/helm-oci-repositories)

## Example Usage

```hcl
resource "artifactory_remote_helmoci_repository" "my-helmoci-remote" {
key = "my-helmoci-remote"
external_dependencies_enabled = true
external_dependencies_patterns = ["**/registry-1.docker.io/**"]
enable_token_authentication = true
url = "https://registry-1.docker.io/"
}
```

## Argument Reference

Arguments have a one to one mapping with the [JFrog API](https://www.jfrog.com/confluence/display/RTF/Repository+Configuration+JSON).
The following arguments are supported, along with the [common list of arguments for the remote repositories](remote.md):

* `key` - (Required) A mandatory identifier for the repository that must be unique. It cannot begin with a number or contain spaces or special characters.
* `description` - (Optional)
* `notes` - (Optional)
* `url` - (Required) This is a URL to the remote registry. Consider using HTTPS to ensure a secure connection.
* `enable_token_authentication` - (Optional) Enable token (Bearer) based authentication.
* `external_dependencies_enabled` - (Optional) Also known as 'Foreign Layers Caching' on the UI.
* `external_dependencies_patterns` - (Optional) Optional include patterns to match external URLs. Ant-style path expressions are supported (*, **, ?). For example, specifying `**/github.com/**` will only allow downloading foreign layers from github.com host. By default, this is set to `**` in the UI, which means that foreign layers may be downloaded from any external hosts. Due to SDKv2 limitations, we can't set the default value for the list. This value `**` must be assigned to the attribute manually, if user don't specify any other non-default values. We don't want to make this attribute required, but it must be set to avoid the state drift on update. Note: Artifactory assigns `**` on update if HCL doesn't have the attribute set or the list is empty.
* `project_id` (Optional) Use this attribute to enter your GCR, GAR Project Id to limit the scope of this remote repo to a specific project in your third-party registry. When leaving this field blank or unset, remote repositories that support project id will default to their default project as you have set up in your account.

## Import

Remote repositories can be imported using their name, e.g.

```
$ terraform import artifactory_remote_helmoci_repository.my-helmoci-remote my-helmoci-remote
```
2 changes: 1 addition & 1 deletion docs/resources/virtual.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The following arguments are supported:
* `key` - (Required) A mandatory identifier for the repository that must be unique. It cannot begin with a number or
contain spaces or special characters.
* `repositories` - (Optional) The effective list of actual repositories included in this virtual repository.
* `project_key` - (Optional) Project key for assigning this repository to. Must be 2 - 20 lowercase alphanumeric and hyphen characters. When assigning repository to a project, repository key must be prefixed with project key, separated by a dash. We don't recommend using this attribute to assign the repository to the project. Use the `repos` attribute in Project provider to manage the list of repositories.
* `project_key` - (Optional) Project key for assigning this repository to. Must be 2 - 32 lowercase alphanumeric and hyphen characters. When assigning repository to a project, repository key must be prefixed with project key, separated by a dash. We don't recommend using this attribute to assign the repository to the project. Use the `repos` attribute in Project provider to manage the list of repositories.
* `project_environments` - (Optional) Project environment for assigning this repository to. Allow values: `DEV`, `PROD`, or one of custom environment.
Before Artifactory 7.53.1, up to 2 values (`DEV` and `PROD`) are allowed. From 7.53.1 onward, only one value is allowed.
The attribute should only be used if the repository is already assigned to the existing project. If not, the attribute will be ignored by Artifactory, but will remain in the Terraform state, which will create state drift during the update.
Expand Down
42 changes: 42 additions & 0 deletions docs/resources/virtual_helmoci_repository.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
subcategory: "Virtual Repositories"
---
# Artifactory Virtual Helm OCI Repository Resource

Creates a virtual Helm OCI repository.

Official documentation can be found [here](https://jfrog.com/help/r/jfrog-artifactory-documentation/helm-oci-repositories).

## Example Usage

```hcl
resource "artifactory_virtual_helmoci_repository" "my-helmoci-virtual" {
key = "my-helmoci-virtual"
repositories = []
description = "A test virtual repo"
notes = "Internal description"
includes_pattern = "com/jfrog/**,cloud/jfrog/**"
excludes_pattern = "com/google/**"
resolve_oci_tags_by_timestamp = true
}
```

## Argument Reference

Arguments have a one to one mapping with the [JFrog API](https://www.jfrog.com/confluence/display/RTF/Repository+Configuration+JSON).

The following arguments are supported, along with the [common list of arguments for the virtual repositories](virtual.md):

* `key` - (Required) A mandatory identifier for the repository that must be unique. It cannot begin with a number or contain spaces or special characters.
* `repositories` - (Optional) The effective list of actual repositories included in this virtual repository.
* `description` - (Optional)
* `notes` - (Optional)
* `resolve_oci_tags_by_timestamp` - (Optional) When enabled, in cases where the same OCI tag exists in two or more of the aggregated repositories, Artifactory will return the tag that has the latest timestamp. Default values is `false`.

## Import

Virtual Helm OCI repositories can be imported using their name, e.g.

```
$ terraform import artifactory_virtual_docker_repository.my-helmoci-virtual my-helmoci-virtual
```
Loading

0 comments on commit 1c9860c

Please sign in to comment.