Repository navigation
feat(container-registry): onboard tf driver for container registry #1870
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
martinezmo
wants to merge
12
commits into
stackitcloud:main
Choose a base branch
from
martinezmo:feat/container-registry
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
a100d82
feat(container-registry): onboard tf driver for container registry
martinezmo 5a1fcd1
Merge branch 'main' into feat/container-registry
martinezmo dea7401
Merge branch 'main' into feat/container-registry
martinezmo d24d9f6
fix(containerregistry): use 3.0 version of sdk
martinezmo 27e98ae
Merge branch 'main' into feat/container-registry
martinezmo 9147c3e
feat(container-registry): solve PR comments
martinezmo b4970b4
feat(container-registry): missing PR comments
martinezmo ead0cd2
feat(container-registry): third round of PR review
martinezmo 0067025
feat(container-registry): madatory white spaces
martinezmo f9c18fb
Merge branch 'main' into feat/container-registry
martinezmo 31fdd6e
feat(container-registry): block change the project type
martinezmo 177290e
Merge branch 'feat/container-registry' of https://github.com/martinez…
martinezmo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,71 @@ | ||
| --- | ||
| # generated by https://github.com/hashicorp/terraform-plugin-docs | ||
| page_title: "stackit_containerregistry_artifactories Data Source - stackit" | ||
| subcategory: "" | ||
| description: |- | ||
| Container registry artifactories list data source schema. | ||
| --- | ||
|
|
||
| # stackit_containerregistry_artifactories (Data Source) | ||
|
|
||
| Container registry artifactories list data source schema. | ||
|
|
||
| ## Example Usage | ||
|
|
||
| ```terraform | ||
| locals { | ||
| project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | ||
| } | ||
|
|
||
| data "stackit_containerregistry_artifactories" "this" { | ||
| project_id = local.project_id | ||
| } | ||
|
|
||
| output "artifactory_ids" { | ||
| value = [for artifactory in data.stackit_containerregistry_artifactories.this.results : artifactory.artifactory_id] | ||
| } | ||
|
|
||
| # These expressions filter locally in Terraform; they are not API filters. | ||
| locals { | ||
| exact_name = [for artifactory in data.stackit_containerregistry_artifactories.this.results : artifactory if artifactory.name == "my-registry"] | ||
| matching_names = [for artifactory in data.stackit_containerregistry_artifactories.this.results : artifactory if can(regex("my-.*", artifactory.name))] | ||
| proxy_artifactories = [for artifactory in data.stackit_containerregistry_artifactories.this.results : artifactory if artifactory.proxy != null] | ||
| docker_hub_proxies = [for artifactory in data.stackit_containerregistry_artifactories.this.results : artifactory if try(artifactory.proxy.registry_type, "") == "docker-hub"] | ||
| } | ||
| ``` | ||
|
|
||
| <!-- schema generated by tfplugindocs --> | ||
| ## Schema | ||
|
|
||
| ### Required | ||
|
|
||
| - `project_id` (String) STACKIT project ID to which the container registry artifactories are associated. | ||
|
|
||
| ### Optional | ||
|
|
||
| - `region` (String) STACKIT region where the container registry artifactories are located. If not defined, the provider default_region is used. | ||
|
|
||
| ### Read-Only | ||
|
|
||
| - `id` (String) Terraform's internal data source ID, structured as `project_id`,`region`. | ||
| - `results` (Attributes List) List of container registry artifactories. (see [below for nested schema](#nestedatt--results)) | ||
|
|
||
| <a id="nestedatt--results"></a> | ||
| ### Nested Schema for `results` | ||
|
|
||
| Read-Only: | ||
|
|
||
| - `artifactory_id` (String) The unique identifier of the container registry artifactory. | ||
| - `create_time` (String) The date and time the creation of the STACKIT artifactory was triggered. | ||
| - `name` (String) A user-chosen name to distinguish multiple STACKIT artifactories. | ||
| - `proxy` (Attributes) Proxy configuration if this artifactory is created as a proxy-cache for an upstream registry. (see [below for nested schema](#nestedatt--results--proxy)) | ||
| - `url` (String) The base URL of the STACKIT artifactory. | ||
|
|
||
| <a id="nestedatt--results--proxy"></a> | ||
| ### Nested Schema for `results.proxy` | ||
|
|
||
| Read-Only: | ||
|
|
||
| - `description` (String) Description of the upstream registry. | ||
| - `registry_type` (String) Which replication adapter to use for this registry. | ||
| - `url` (String) Upstream registry URL to proxy. |
This file contains hidden or 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,54 @@ | ||
| --- | ||
| # generated by https://github.com/hashicorp/terraform-plugin-docs | ||
| page_title: "stackit_containerregistry_artifactory Data Source - stackit" | ||
| subcategory: "" | ||
| description: |- | ||
| Container registry artifactory data source schema. | ||
| --- | ||
|
|
||
| # stackit_containerregistry_artifactory (Data Source) | ||
|
|
||
| Container registry artifactory data source schema. | ||
|
|
||
| ## Example Usage | ||
|
|
||
| ```terraform | ||
| locals { | ||
| project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | ||
| artifactory_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | ||
| } | ||
|
|
||
| data "stackit_containerregistry_artifactory" "this" { | ||
| project_id = local.project_id | ||
| artifactory_id = local.artifactory_id | ||
| } | ||
| ``` | ||
|
|
||
| <!-- schema generated by tfplugindocs --> | ||
| ## Schema | ||
|
|
||
| ### Required | ||
|
|
||
| - `artifactory_id` (String) The unique identifier of the container registry artifactory. | ||
| - `project_id` (String) STACKIT project ID to which the container registry artifactory is associated. | ||
|
|
||
| ### Optional | ||
|
|
||
| - `region` (String) STACKIT region where the container registry artifactory is located. If not defined, the provider default_region is used. | ||
|
|
||
| ### Read-Only | ||
|
|
||
| - `create_time` (String) The date and time the creation of the STACKIT artifactory was triggered. | ||
| - `id` (String) Terraform's internal resource ID, structured as `project_id`,`region`,`artifactory_id`. | ||
| - `name` (String) A user-chosen name to distinguish multiple STACKIT artifactories. | ||
| - `proxy` (Attributes) Proxy configuration if this artifactory is created as a proxy-cache for an upstream registry. (see [below for nested schema](#nestedatt--proxy)) | ||
| - `url` (String) The base URL of the STACKIT artifactory. | ||
|
|
||
| <a id="nestedatt--proxy"></a> | ||
| ### Nested Schema for `proxy` | ||
|
|
||
| Read-Only: | ||
|
|
||
| - `description` (String) Description of the upstream registry. | ||
| - `registry_type` (String) Which replication adapter to use for this registry. | ||
| - `url` (String) Upstream registry URL to proxy. |
54 changes: 54 additions & 0 deletions
54
docs/data-sources/containerregistry_replication_adapters.md
This file contains hidden or 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,54 @@ | ||
| --- | ||
| # generated by https://github.com/hashicorp/terraform-plugin-docs | ||
| page_title: "stackit_containerregistry_replication_adapters Data Source - stackit" | ||
| subcategory: "" | ||
| description: |- | ||
| Container registry replication adapters data source schema. | ||
| --- | ||
|
|
||
| # stackit_containerregistry_replication_adapters (Data Source) | ||
|
|
||
| Container registry replication adapters data source schema. | ||
|
|
||
| ## Example Usage | ||
|
|
||
| ```terraform | ||
| locals { | ||
| project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | ||
| } | ||
|
|
||
| data "stackit_containerregistry_replication_adapters" "this" { | ||
| project_id = local.project_id | ||
| } | ||
|
|
||
| # These expressions filter locally in Terraform; they are not API filters. | ||
| locals { | ||
| docker_hub_adapters = [for adapter in data.stackit_containerregistry_replication_adapters.this.results : adapter if adapter.registry_type == "docker-hub"] | ||
| basic_auth_adapters = [for adapter in data.stackit_containerregistry_replication_adapters.this.results : adapter if adapter.credential_type == "basic"] | ||
| } | ||
| ``` | ||
|
|
||
| <!-- schema generated by tfplugindocs --> | ||
| ## Schema | ||
|
|
||
| ### Required | ||
|
|
||
| - `project_id` (String) STACKIT project ID to which the replication adapters are associated. | ||
|
|
||
| ### Optional | ||
|
|
||
| - `region` (String) STACKIT region where the replication adapters are located. If not defined, the provider default_region is used. | ||
|
|
||
| ### Read-Only | ||
|
|
||
| - `id` (String) Terraform's internal data source ID, structured as `project_id`,`region`. | ||
| - `results` (Attributes List) List of supported replication adapters. (see [below for nested schema](#nestedatt--results)) | ||
|
|
||
| <a id="nestedatt--results"></a> | ||
| ### Nested Schema for `results` | ||
|
|
||
| Read-Only: | ||
|
|
||
| - `credential_type` (String) User-hint for what type of credentials are expected for the replication adapter type. | ||
| - `display_name` (String) Human-friendly name of the provider the adapter relates to. | ||
| - `registry_type` (String) Identifies the replication adapter. |
This file contains hidden or 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 hidden or 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,105 @@ | ||
| --- | ||
| # generated by https://github.com/hashicorp/terraform-plugin-docs | ||
| page_title: "stackit_containerregistry_artifactory Resource - stackit" | ||
| subcategory: "" | ||
| description: |- | ||
| Container registry artifactory resource schema. | ||
| --- | ||
|
|
||
| # stackit_containerregistry_artifactory (Resource) | ||
|
|
||
| Container registry artifactory resource schema. | ||
|
|
||
| ## Example Usage | ||
|
|
||
| ```terraform | ||
| locals { | ||
| project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | ||
| region = "eu01" | ||
| name = "my-registry" | ||
| } | ||
|
|
||
| # Standard container registry artifactory | ||
| resource "stackit_containerregistry_artifactory" "this" { | ||
| project_id = local.project_id | ||
| name = local.name | ||
| } | ||
|
|
||
| # Container registry artifactory configured as a Docker Hub proxy-cache with write-only credentials | ||
| resource "stackit_containerregistry_artifactory" "docker_hub_proxy" { | ||
| project_id = local.project_id | ||
| name = "my-docker-hub-mirror" | ||
|
|
||
| proxy = { | ||
| registry_type = "docker-hub" | ||
| url = "https://registry-1.docker.io" | ||
| description = "Docker Hub pull-through cache" | ||
|
|
||
| credentials = { | ||
| access_key = "my-dockerhub-username" | ||
| access_secret_wo = "my-dockerhub-access-token" | ||
| access_secret_wo_version = 1 | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| <!-- schema generated by tfplugindocs --> | ||
| ## Schema | ||
|
|
||
| ### Required | ||
|
|
||
| - `name` (String) A user-chosen name to distinguish multiple STACKIT artifactories. | ||
| - `project_id` (String) STACKIT project ID to which the container registry artifactory is associated. | ||
|
|
||
| ### Optional | ||
|
|
||
| - `proxy` (Attributes) Proxy configuration if this artifactory is created as a proxy-cache for an upstream registry. (see [below for nested schema](#nestedatt--proxy)) | ||
| - `region` (String) STACKIT region where the container registry artifactory is located. If not defined, the provider default_region is used. | ||
|
|
||
| ### Read-Only | ||
|
|
||
| - `artifactory_id` (String) The unique identifier of the container registry artifactory. | ||
| - `create_time` (String) The date and time the creation of the STACKIT artifactory was triggered. | ||
| - `id` (String) Terraform's internal resource ID, structured as `project_id`,`region`,`artifactory_id`. | ||
| - `url` (String) The base URL of the STACKIT artifactory. | ||
|
|
||
| <a id="nestedatt--proxy"></a> | ||
| ### Nested Schema for `proxy` | ||
|
|
||
| Required: | ||
|
|
||
| - `registry_type` (String) Which replication adapter to use for this registry. | ||
| - `url` (String) Upstream registry URL to proxy. | ||
|
|
||
| Optional: | ||
|
|
||
| - `credentials` (Attributes) Credentials for the upstream registry. (see [below for nested schema](#nestedatt--proxy--credentials)) | ||
| - `description` (String) Description of the upstream registry. | ||
|
|
||
| <a id="nestedatt--proxy--credentials"></a> | ||
| ### Nested Schema for `proxy.credentials` | ||
|
|
||
| Required: | ||
|
|
||
| - `access_key` (String) Access key or username for the upstream registry. | ||
|
|
||
| Optional: | ||
|
|
||
| - `access_secret` (String, Sensitive) Access secret or password for the upstream registry. Write-only argument `access_secret_wo` should be preferred. | ||
| - `access_secret_wo` (String, Sensitive, [Write-only](https://developer.hashicorp.com/terraform/language/resources/ephemeral#write-only-arguments)) Write-only access secret or password for the upstream registry - never stored in state and never returned by the API. To rotate the secret, update this value AND increment `access_secret_wo_version`. Changing this field alone will NOT trigger an update. | ||
| - `access_secret_wo_version` (Number) User-managed rotation counter for `access_secret_wo`. Must be incremented every time `access_secret_wo` is updated. | ||
|
|
||
| ## Import | ||
|
|
||
| Import is supported using the following syntax: | ||
|
|
||
| In Terraform v1.5.0 and later, the [` + "`" + `import` + "`" + ` block](https://developer.hashicorp.com/terraform/language/import) can be used with the ` + "`" + `id` + "`" + ` attribute, for example: | ||
|
|
||
| ```terraform | ||
| # Only use the import statement if you want to import an existing Container Registry artifactory | ||
| import { | ||
| to = stackit_containerregistry_artifactory.this | ||
| id = "${local.project_id},${local.region},ARTIFACTORY_ID" | ||
| } | ||
| ``` |
19 changes: 19 additions & 0 deletions
19
examples/data-sources/stackit_containerregistry_artifactories/data-source.tf
This file contains hidden or 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,19 @@ | ||
| locals { | ||
| project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | ||
| } | ||
|
|
||
| data "stackit_containerregistry_artifactories" "this" { | ||
| project_id = local.project_id | ||
| } | ||
|
|
||
| output "artifactory_ids" { | ||
| value = [for artifactory in data.stackit_containerregistry_artifactories.this.results : artifactory.artifactory_id] | ||
| } | ||
|
|
||
| # These expressions filter locally in Terraform; they are not API filters. | ||
| locals { | ||
| exact_name = [for artifactory in data.stackit_containerregistry_artifactories.this.results : artifactory if artifactory.name == "my-registry"] | ||
| matching_names = [for artifactory in data.stackit_containerregistry_artifactories.this.results : artifactory if can(regex("my-.*", artifactory.name))] | ||
| proxy_artifactories = [for artifactory in data.stackit_containerregistry_artifactories.this.results : artifactory if artifactory.proxy != null] | ||
| docker_hub_proxies = [for artifactory in data.stackit_containerregistry_artifactories.this.results : artifactory if try(artifactory.proxy.registry_type, "") == "docker-hub"] | ||
| } | ||
9 changes: 9 additions & 0 deletions
9
examples/data-sources/stackit_containerregistry_artifactory/data-source.tf
This file contains hidden or 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,9 @@ | ||
| locals { | ||
| project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | ||
| artifactory_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | ||
| } | ||
|
|
||
| data "stackit_containerregistry_artifactory" "this" { | ||
| project_id = local.project_id | ||
| artifactory_id = local.artifactory_id | ||
| } |
13 changes: 13 additions & 0 deletions
13
examples/data-sources/stackit_containerregistry_replication_adapters/data-source.tf
This file contains hidden or 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 @@ | ||
| locals { | ||
| project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | ||
| } | ||
|
|
||
| data "stackit_containerregistry_replication_adapters" "this" { | ||
| project_id = local.project_id | ||
| } | ||
|
martinezmo marked this conversation as resolved.
Resolved
|
||
|
|
||
| # These expressions filter locally in Terraform; they are not API filters. | ||
| locals { | ||
| docker_hub_adapters = [for adapter in data.stackit_containerregistry_replication_adapters.this.results : adapter if adapter.registry_type == "docker-hub"] | ||
| basic_auth_adapters = [for adapter in data.stackit_containerregistry_replication_adapters.this.results : adapter if adapter.credential_type == "basic"] | ||
| } | ||
5 changes: 5 additions & 0 deletions
5
examples/resources/stackit_containerregistry_artifactory/import-by-string-id.tf
This file contains hidden or 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,5 @@ | ||
| # Only use the import statement if you want to import an existing Container Registry artifactory | ||
| import { | ||
| to = stackit_containerregistry_artifactory.this | ||
| id = "${local.project_id},${local.region},ARTIFACTORY_ID" | ||
| } |
29 changes: 29 additions & 0 deletions
29
examples/resources/stackit_containerregistry_artifactory/resource.tf
This file contains hidden or 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,29 @@ | ||
| locals { | ||
| project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" | ||
| region = "eu01" | ||
| name = "my-registry" | ||
| } | ||
|
|
||
| # Standard container registry artifactory | ||
| resource "stackit_containerregistry_artifactory" "this" { | ||
| project_id = local.project_id | ||
| name = local.name | ||
| } | ||
|
|
||
| # Container registry artifactory configured as a Docker Hub proxy-cache with write-only credentials | ||
| resource "stackit_containerregistry_artifactory" "docker_hub_proxy" { | ||
| project_id = local.project_id | ||
| name = "my-docker-hub-mirror" | ||
|
|
||
| proxy = { | ||
| registry_type = "docker-hub" | ||
| url = "https://registry-1.docker.io" | ||
| description = "Docker Hub pull-through cache" | ||
|
|
||
| credentials = { | ||
| access_key = "my-dockerhub-username" | ||
| access_secret_wo = "my-dockerhub-access-token" | ||
| access_secret_wo_version = 1 | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.