From 4a432921dd2ad636b501ce46a1025bb8014c1c68 Mon Sep 17 00:00:00 2001 From: Christian Sibbel Date: Thu, 11 Jul 2024 13:17:44 +0200 Subject: [PATCH 01/11] feat: Update Nexus version to 3.70.1 --- README.md | 2 +- docs/index.md | 2 +- scripts/.env | 2 +- templates/index.md.tmpl | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c8f06659..57b13aca 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Terraform provider to configure Sonatype Nexus using its API. -Implemented and tested with Sonatype Nexus `3.64.0-03`. +Implemented and tested with Sonatype Nexus `3.70.1-02`. ## Usage diff --git a/docs/index.md b/docs/index.md index 475ca152..4304e26c 100644 --- a/docs/index.md +++ b/docs/index.md @@ -8,7 +8,7 @@ description: |- The Nexus provider allows Terraform to read from, write to, and configure [Sonatype Nexus Repository Manager](https://www.sonatype.com/product-nexus-repository). --> **Note** This provider hat been implemented and tested with Sonatype Nexus Repository Manager OSS `3.64.0-03`. +-> **Note** This provider hat been implemented and tested with Sonatype Nexus Repository Manager OSS `3.70.1-02`. ## Usage diff --git a/scripts/.env b/scripts/.env index d171f4e5..478a267f 100644 --- a/scripts/.env +++ b/scripts/.env @@ -1,3 +1,3 @@ export NEXUS_IMAGE=ghcr.io/datadrivers/docker-nexus3 -export NEXUS_VERSION=3.64.0 +export NEXUS_VERSION=3.70.1 export NEXUS_PORT=8081 diff --git a/templates/index.md.tmpl b/templates/index.md.tmpl index 28ebcf30..88684d11 100644 --- a/templates/index.md.tmpl +++ b/templates/index.md.tmpl @@ -8,7 +8,7 @@ description: |- The Nexus provider allows Terraform to read from, write to, and configure [Sonatype Nexus Repository Manager](https://www.sonatype.com/product-nexus-repository). --> **Note** This provider hat been implemented and tested with Sonatype Nexus Repository Manager OSS `3.64.0-03`. +-> **Note** This provider hat been implemented and tested with Sonatype Nexus Repository Manager OSS `3.70.1-02`. ## Usage From b9c53a0abdfac50b7e8d1256e20a8ac90ff1fc42 Mon Sep 17 00:00:00 2001 From: Christian Sibbel Date: Thu, 11 Jul 2024 15:45:09 +0200 Subject: [PATCH 02/11] feat: Add expiration fields --- .../data_source_security_user_token_test.go | 8 ++++++-- .../security/resource_security_user_token.go | 20 +++++++++++++++++-- .../resource_security_user_token_test.go | 16 ++++++++++----- 3 files changed, 35 insertions(+), 9 deletions(-) diff --git a/internal/services/security/data_source_security_user_token_test.go b/internal/services/security/data_source_security_user_token_test.go index 72cbaf44..f136668e 100644 --- a/internal/services/security/data_source_security_user_token_test.go +++ b/internal/services/security/data_source_security_user_token_test.go @@ -18,8 +18,10 @@ func TestAccDataSourceSecurityUserToken(t *testing.T) { dataSourceName := "data.nexus_security_user_token.acceptance" token := security.UserTokenConfiguration{ - Enabled: true, - ProtectContent: false, + Enabled: true, + ProtectContent: false, + ExpirationEnabled: true, + ExpirationDays: int(30), } resource.Test(t, resource.TestCase{ @@ -35,6 +37,8 @@ func TestAccDataSourceSecurityUserToken(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(dataSourceName, "enabled", strconv.FormatBool(token.Enabled)), resource.TestCheckResourceAttr(dataSourceName, "protect_content", strconv.FormatBool(token.ProtectContent)), + resource.TestCheckResourceAttr(dataSourceName, "expiration_enabled", strconv.FormatBool(token.ExpirationEnabled)), + resource.TestCheckResourceAttr(dataSourceName, "expiration_days", strconv.FormatInt(token.ExpirationDays)), ), }, }, diff --git a/internal/services/security/resource_security_user_token.go b/internal/services/security/resource_security_user_token.go index 804de15b..c5498d8a 100644 --- a/internal/services/security/resource_security_user_token.go +++ b/internal/services/security/resource_security_user_token.go @@ -34,14 +34,28 @@ Use this resource to manage the global configuration for the user-tokens.`, Optional: true, Default: false, }, + "expiration_enabled": { + Description: "Set user tokens expiration.", + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "expiration_days": { + Description: "Number of days for which you want user tokens to remain valid.", + Type: schema.TypeInt, + Optional: true, + Default: 30, + }, }, } } func getSecurityUserTokenFromResourceData(d *schema.ResourceData) security.UserTokenConfiguration { return security.UserTokenConfiguration{ - Enabled: d.Get("enabled").(bool), - ProtectContent: d.Get("protect_content").(bool), + Enabled: d.Get("enabled").(bool), + ProtectContent: d.Get("protect_content").(bool), + ExpirationEnabled: d.Get("expiration_enabled").(bool), + ExpirationDays: d.Get("expiration_days").(int), } } @@ -49,6 +63,8 @@ func setSecurityUserTokenToResourceData(token *security.UserTokenConfiguration, d.SetId("golbalUserTokenConfiguration") d.Set("enabled", token.Enabled) d.Set("protect_content", token.ProtectContent) + d.Set("expiration_enabled", token.ExpirationEnabled) + d.Set("expiration_days", token.ExpirationDays) } func resourceSecurityUserTokenRead(d *schema.ResourceData, m interface{}) error { diff --git a/internal/services/security/resource_security_user_token_test.go b/internal/services/security/resource_security_user_token_test.go index eabc1e2f..12dad9d5 100644 --- a/internal/services/security/resource_security_user_token_test.go +++ b/internal/services/security/resource_security_user_token_test.go @@ -19,8 +19,10 @@ func TestAccResourceSecurityUserToken(t *testing.T) { resName := "nexus_security_user_token.acceptance" token := security.UserTokenConfiguration{ - Enabled: true, - ProtectContent: false, + Enabled: true, + ProtectContent: false, + ExpirationEnabled: true, + ExpirationDays: int(30), } resource.Test(t, resource.TestCase{ @@ -32,6 +34,8 @@ func TestAccResourceSecurityUserToken(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resName, "enabled", strconv.FormatBool(token.Enabled)), resource.TestCheckResourceAttr(resName, "protect_content", strconv.FormatBool(token.ProtectContent)), + resource.TestCheckResourceAttr(resName, "expiration_enabled", strconv.FormatBool(token.ExpirationEnabled)), + resource.TestCheckResourceAttr(resName, "expiration_days", strconv.FormatInt(token.ExpirationDays)), ), }, }, @@ -41,8 +45,10 @@ func TestAccResourceSecurityUserToken(t *testing.T) { func testAccResourceSecurityUserTokenConfig(token security.UserTokenConfiguration) string { return fmt.Sprintf(` resource "nexus_security_user_token" "acceptance" { - enabled = %t - protect_content = %t + enabled = %t + protect_content = %t + expiration_enabled = %t + expiration_days = %t } -`, token.Enabled, token.ProtectContent) +`, token.Enabled, token.ProtectContent, token.ExpirationEnabled, token.ExpirationDays) } From e8fa5d63e4e3b4a384de0550cc55c419241dae46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20R=C3=BCcker?= Date: Thu, 8 Aug 2024 10:15:18 +0200 Subject: [PATCH 03/11] fix: Update client library to fix expiration field test --- go.mod | 2 +- go.sum | 4 ++-- .../security/data_source_security_user_token.go | 12 +++++++++++- .../security/data_source_security_user_token_test.go | 2 +- .../security/resource_security_user_token_test.go | 4 ++-- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index bd22b946..f6a0e710 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ toolchain go1.21.1 require ( github.com/client9/misspell v0.3.4 - github.com/datadrivers/go-nexus-client v1.10.1 + github.com/datadrivers/go-nexus-client v1.11.0 github.com/golangci/golangci-lint v1.59.1 github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 github.com/hashicorp/terraform-plugin-docs v0.19.4 diff --git a/go.sum b/go.sum index 2894dcd1..fff68975 100644 --- a/go.sum +++ b/go.sum @@ -156,8 +156,8 @@ github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53E github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/daixiang0/gci v0.13.4 h1:61UGkmpoAcxHM2hhNkZEf5SzwQtWJXTSws7jaPyqwlw= github.com/daixiang0/gci v0.13.4/go.mod h1:12etP2OniiIdP4q+kjUGrC/rUagga7ODbqsom5Eo5Yk= -github.com/datadrivers/go-nexus-client v1.10.1 h1:FAQBkYOxlgh9wpaDiHpjAZ96EkMm5FVOKzJAFfTiCdw= -github.com/datadrivers/go-nexus-client v1.10.1/go.mod h1:nYUmYplEgXusK5Hvz+stvslPbSgSO0MyidDy6Da4LO0= +github.com/datadrivers/go-nexus-client v1.11.0 h1:fTmBYPzPBLL8v1LQOc8Fyzz40lHDl3Bm3ofvpNdHRro= +github.com/datadrivers/go-nexus-client v1.11.0/go.mod h1:sPjBOxF7idUoiJoa730L3JyKZodjT0LDAvVF8u4kOLU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/internal/services/security/data_source_security_user_token.go b/internal/services/security/data_source_security_user_token.go index 09dfc737..eb19b55c 100644 --- a/internal/services/security/data_source_security_user_token.go +++ b/internal/services/security/data_source_security_user_token.go @@ -16,7 +16,7 @@ Use this data source to get the global user-token configuration.`, "id": common.DataSourceID, "enabled": { Computed: true, - Description: "Activate the feature of user tokens.", + Description: "Activation of the user tokens feature.", Type: schema.TypeBool, }, "protect_content": { @@ -24,6 +24,16 @@ Use this data source to get the global user-token configuration.`, Description: "Require user tokens for repository authentication. This does not effect UI access.", Type: schema.TypeBool, }, + "expiration_enabled": { + Description: "Activation of the user tokens expiration feature.", + Type: schema.TypeBool, + Computed: true, + }, + "expiration_days": { + Description: "Number of days user tokens remain valid.", + Type: schema.TypeInt, + Computed: true, + }, }, } } diff --git a/internal/services/security/data_source_security_user_token_test.go b/internal/services/security/data_source_security_user_token_test.go index f136668e..b62920bc 100644 --- a/internal/services/security/data_source_security_user_token_test.go +++ b/internal/services/security/data_source_security_user_token_test.go @@ -38,7 +38,7 @@ func TestAccDataSourceSecurityUserToken(t *testing.T) { resource.TestCheckResourceAttr(dataSourceName, "enabled", strconv.FormatBool(token.Enabled)), resource.TestCheckResourceAttr(dataSourceName, "protect_content", strconv.FormatBool(token.ProtectContent)), resource.TestCheckResourceAttr(dataSourceName, "expiration_enabled", strconv.FormatBool(token.ExpirationEnabled)), - resource.TestCheckResourceAttr(dataSourceName, "expiration_days", strconv.FormatInt(token.ExpirationDays)), + resource.TestCheckResourceAttr(dataSourceName, "expiration_days", strconv.Itoa(token.ExpirationDays)), ), }, }, diff --git a/internal/services/security/resource_security_user_token_test.go b/internal/services/security/resource_security_user_token_test.go index 12dad9d5..74b835b7 100644 --- a/internal/services/security/resource_security_user_token_test.go +++ b/internal/services/security/resource_security_user_token_test.go @@ -35,7 +35,7 @@ func TestAccResourceSecurityUserToken(t *testing.T) { resource.TestCheckResourceAttr(resName, "enabled", strconv.FormatBool(token.Enabled)), resource.TestCheckResourceAttr(resName, "protect_content", strconv.FormatBool(token.ProtectContent)), resource.TestCheckResourceAttr(resName, "expiration_enabled", strconv.FormatBool(token.ExpirationEnabled)), - resource.TestCheckResourceAttr(resName, "expiration_days", strconv.FormatInt(token.ExpirationDays)), + resource.TestCheckResourceAttr(resName, "expiration_days", strconv.Itoa(token.ExpirationDays)), ), }, }, @@ -48,7 +48,7 @@ resource "nexus_security_user_token" "acceptance" { enabled = %t protect_content = %t expiration_enabled = %t - expiration_days = %t + expiration_days = %d } `, token.Enabled, token.ProtectContent, token.ExpirationEnabled, token.ExpirationDays) } From 200c21c939c60ff7d4b1d148b0cb1771dad145e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20R=C3=BCcker?= Date: Thu, 8 Aug 2024 10:16:21 +0200 Subject: [PATCH 04/11] ci: use docker compose instead of docker-compose --- scripts/start-services.sh | 2 +- scripts/stop-services.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/start-services.sh b/scripts/start-services.sh index 1f608823..8705513d 100755 --- a/scripts/start-services.sh +++ b/scripts/start-services.sh @@ -4,6 +4,6 @@ set -eo pipefail source ./script.source echo "Starting Nexus ${NEXUS_TYPE} and other required services..." -docker-compose up -d +docker compose up -d ./wait-for-nexus.sh diff --git a/scripts/stop-services.sh b/scripts/stop-services.sh index 6e588adf..aa4d46b6 100755 --- a/scripts/stop-services.sh +++ b/scripts/stop-services.sh @@ -4,4 +4,4 @@ set -eo pipefail source ./script.source echo "Stopping the services..." -docker-compose down +docker compose down From b11c8af082637024ddc1990b565d2fdee911c095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20R=C3=BCcker?= Date: Thu, 8 Aug 2024 10:48:15 +0200 Subject: [PATCH 05/11] feat: add deprecation warning for npm proxy remove_non_cataloged and remove test for the field --- internal/acceptance/template-strings-repository-npm.go | 1 - .../repository/data_source_repository_npm_proxy_test.go | 3 +-- internal/services/repository/resource_repository_npm_proxy.go | 1 + .../services/repository/resource_repository_npm_proxy_test.go | 3 +-- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/internal/acceptance/template-strings-repository-npm.go b/internal/acceptance/template-strings-repository-npm.go index ff875074..d94726af 100644 --- a/internal/acceptance/template-strings-repository-npm.go +++ b/internal/acceptance/template-strings-repository-npm.go @@ -15,6 +15,5 @@ resource "nexus_repository_npm_group" "acceptance" { TemplateStringRepositoryNpmProxy = ` resource "nexus_repository_npm_proxy" "acceptance" { remove_quarantined = {{ .Npm.RemoveQuarantined }} - remove_non_cataloged = {{ .Npm.RemoveNonCataloged }} ` + TemplateStringProxyRepository ) diff --git a/internal/services/repository/data_source_repository_npm_proxy_test.go b/internal/services/repository/data_source_repository_npm_proxy_test.go index e60163f8..22253643 100644 --- a/internal/services/repository/data_source_repository_npm_proxy_test.go +++ b/internal/services/repository/data_source_repository_npm_proxy_test.go @@ -30,7 +30,7 @@ func TestAccDataSourceRepositoryNpmProxy(t *testing.T) { StrictContentTypeValidation: true, }, Npm: &repository.Npm{ - RemoveNonCataloged: true, + RemoveNonCataloged: false, RemoveQuarantined: true, }, } @@ -61,7 +61,6 @@ func TestAccDataSourceRepositoryNpmProxy(t *testing.T) { resource.TestCheckResourceAttr(dataSourceName, "storage.0.strict_content_type_validation", strconv.FormatBool(repoUsingDefaults.Storage.StrictContentTypeValidation)), ), resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr(dataSourceName, "remove_non_cataloged", strconv.FormatBool(repoUsingDefaults.Npm.RemoveNonCataloged)), resource.TestCheckResourceAttr(dataSourceName, "remove_quarantined", strconv.FormatBool(repoUsingDefaults.Npm.RemoveQuarantined)), ), ), diff --git a/internal/services/repository/resource_repository_npm_proxy.go b/internal/services/repository/resource_repository_npm_proxy.go index ae1e0b86..9cf8313b 100644 --- a/internal/services/repository/resource_repository_npm_proxy.go +++ b/internal/services/repository/resource_repository_npm_proxy.go @@ -40,6 +40,7 @@ func ResourceRepositoryNpmProxy() *schema.Resource { Optional: true, Default: false, Type: schema.TypeBool, + Deprecated: "This field is removed in nexus version 3.66.0 and will be removed in the next major release of this provider", }, "remove_quarantined": { Description: "Remove quarantined versions from the npm package metadata.", diff --git a/internal/services/repository/resource_repository_npm_proxy_test.go b/internal/services/repository/resource_repository_npm_proxy_test.go index 079a1c64..87bdb076 100644 --- a/internal/services/repository/resource_repository_npm_proxy_test.go +++ b/internal/services/repository/resource_repository_npm_proxy_test.go @@ -58,7 +58,7 @@ func testAccResourceRepositoryNpmProxy() repository.NpmProxyRepository { RemoteURL: "https://npmjs.org", }, Npm: &repository.Npm{ - RemoveNonCataloged: true, + RemoveNonCataloged: false, RemoveQuarantined: true, }, } @@ -129,7 +129,6 @@ func TestAccResourceRepositoryNpmProxy(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "routing_rule", *repo.RoutingRule), ), resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr(resourceName, "remove_non_cataloged", strconv.FormatBool(repo.Npm.RemoveNonCataloged)), resource.TestCheckResourceAttr(resourceName, "remove_quarantined", strconv.FormatBool(repo.Npm.RemoveQuarantined)), ), ), From 5402ece7ec106f19358090e83d5305b1b93aec37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20R=C3=BCcker?= Date: Thu, 8 Aug 2024 10:52:16 +0200 Subject: [PATCH 06/11] docs: update npm proxy docs for deprecation --- docs/data-sources/repository_npm_proxy.md | 2 +- docs/resources/repository_npm_proxy.md | 2 +- .../services/repository/data_source_repository_npm_proxy.go | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/data-sources/repository_npm_proxy.md b/docs/data-sources/repository_npm_proxy.md index e7f259d9..4ee653fa 100644 --- a/docs/data-sources/repository_npm_proxy.md +++ b/docs/data-sources/repository_npm_proxy.md @@ -27,7 +27,7 @@ data "nexus_repository_npm_proxy" "npmjs" { - `negative_cache` (List of Object) Configuration of the negative cache handling (see [below for nested schema](#nestedatt--negative_cache)) - `online` (Boolean) Whether this repository accepts incoming requests - `proxy` (List of Object) Configuration for the proxy repository (see [below for nested schema](#nestedatt--proxy)) -- `remove_non_cataloged` (Boolean) Remove non-catalogued versions from the npm package metadata. +- `remove_non_cataloged` (Boolean, Deprecated) Remove non-catalogued versions from the npm package metadata. - `remove_quarantined` (Boolean) Remove quarantined versions from the npm package metadata. - `routing_rule` (String) The name of the routing rule assigned to this repository - `storage` (List of Object) The storage configuration of the repository (see [below for nested schema](#nestedatt--storage)) diff --git a/docs/resources/repository_npm_proxy.md b/docs/resources/repository_npm_proxy.md index 99eca842..ec6e6d68 100644 --- a/docs/resources/repository_npm_proxy.md +++ b/docs/resources/repository_npm_proxy.md @@ -49,7 +49,7 @@ resource "nexus_repository_npm_proxy" "npmjs" { - `cleanup` (Block List) Cleanup policies (see [below for nested schema](#nestedblock--cleanup)) - `negative_cache` (Block List, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `online` (Boolean) Whether this repository accepts incoming requests -- `remove_non_cataloged` (Boolean) Remove non-catalogued versions from the npm package metadata. +- `remove_non_cataloged` (Boolean, Deprecated) Remove non-catalogued versions from the npm package metadata. - `remove_quarantined` (Boolean) Remove quarantined versions from the npm package metadata. - `routing_rule` (String) The name of the routing rule assigned to this repository diff --git a/internal/services/repository/data_source_repository_npm_proxy.go b/internal/services/repository/data_source_repository_npm_proxy.go index d5424f90..62e747ec 100644 --- a/internal/services/repository/data_source_repository_npm_proxy.go +++ b/internal/services/repository/data_source_repository_npm_proxy.go @@ -29,6 +29,7 @@ func DataSourceRepositoryNpmProxy() *schema.Resource { Description: "Remove non-catalogued versions from the npm package metadata.", Computed: true, Type: schema.TypeBool, + Deprecated: "This field is removed in nexus version 3.66.0 and will be removed in the next major release of this provider", }, "remove_quarantined": { Description: "Remove quarantined versions from the npm package metadata.", From c94ecb28ad3770bf6797484b4795e3c8252e44de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20R=C3=BCcker?= Date: Thu, 8 Aug 2024 10:53:45 +0200 Subject: [PATCH 07/11] docs: update docs --- docs/data-sources/blobstore_list.md | 6 +++--- docs/data-sources/repository_bower_group.md | 2 +- docs/data-sources/repository_docker_group.md | 2 +- docs/data-sources/repository_go_group.md | 2 +- docs/data-sources/repository_maven_group.md | 2 +- docs/data-sources/repository_npm_group.md | 2 +- docs/data-sources/repository_nuget_group.md | 2 +- docs/data-sources/repository_pypi_group.md | 2 +- docs/data-sources/repository_r_group.md | 2 +- docs/data-sources/repository_raw_group.md | 2 +- docs/data-sources/repository_rubygems_group.md | 2 +- docs/data-sources/repository_yum_group.md | 2 +- docs/data-sources/security_ssl.md | 14 +++++++++++++- docs/data-sources/security_ssl_truststore.md | 12 +++++------- docs/data-sources/security_user_token.md | 4 +++- docs/resources/repository_bower_group.md | 2 +- docs/resources/repository_docker_group.md | 2 +- docs/resources/repository_go_group.md | 2 +- docs/resources/repository_maven_group.md | 2 +- docs/resources/repository_npm_group.md | 2 +- docs/resources/repository_nuget_group.md | 2 +- docs/resources/repository_pypi_group.md | 2 +- docs/resources/repository_r_group.md | 2 +- docs/resources/repository_raw_group.md | 2 +- docs/resources/repository_rubygems_group.md | 2 +- docs/resources/repository_yum_group.md | 2 +- docs/resources/security_ssl_truststore.md | 9 ++++++++- docs/resources/security_user_token.md | 2 ++ 28 files changed, 56 insertions(+), 35 deletions(-) diff --git a/docs/data-sources/blobstore_list.md b/docs/data-sources/blobstore_list.md index d5060ddd..e239fd2f 100644 --- a/docs/data-sources/blobstore_list.md +++ b/docs/data-sources/blobstore_list.md @@ -2,10 +2,10 @@ page_title: "Data Source nexus_blobstore_list" subcategory: "Blobstore" description: |- - Use this data source to get a list with all blob stores. + Use this data source to get a list with all Blob Stores. --- # Data Source nexus_blobstore_list -Use this data source to get a list with all blob stores. +Use this data source to get a list with all Blob Stores. ## Example Usage ```terraform data "nexus_blobstore_list" "all" {} @@ -16,7 +16,7 @@ data "nexus_blobstore_list" "all" {} ### Read-Only - `id` (String) Used to identify data source at nexus -- `items` (List of Object) A List of all blob stores (see [below for nested schema](#nestedatt--items)) +- `items` (List of Object) A List of all Blob Stores (see [below for nested schema](#nestedatt--items)) ### Nested Schema for `items` diff --git a/docs/data-sources/repository_bower_group.md b/docs/data-sources/repository_bower_group.md index 0a5f3247..92108ee4 100644 --- a/docs/data-sources/repository_bower_group.md +++ b/docs/data-sources/repository_bower_group.md @@ -31,7 +31,7 @@ data "nexus_repository_bower_group" "group" { Read-Only: -- `member_names` (Set of String) +- `member_names` (List of String) diff --git a/docs/data-sources/repository_docker_group.md b/docs/data-sources/repository_docker_group.md index ccb23936..abbe8565 100644 --- a/docs/data-sources/repository_docker_group.md +++ b/docs/data-sources/repository_docker_group.md @@ -44,7 +44,7 @@ Read-Only: Read-Only: -- `member_names` (Set of String) +- `member_names` (List of String) - `writable_member` (String) diff --git a/docs/data-sources/repository_go_group.md b/docs/data-sources/repository_go_group.md index 32207f51..2d452fd9 100644 --- a/docs/data-sources/repository_go_group.md +++ b/docs/data-sources/repository_go_group.md @@ -31,7 +31,7 @@ data "nexus_repository_go_group" "go_public" { Read-Only: -- `member_names` (Set of String) +- `member_names` (List of String) diff --git a/docs/data-sources/repository_maven_group.md b/docs/data-sources/repository_maven_group.md index 9fe0e387..1277fae4 100644 --- a/docs/data-sources/repository_maven_group.md +++ b/docs/data-sources/repository_maven_group.md @@ -31,7 +31,7 @@ data "nexus_repository_maven_group" "maven_public" { Read-Only: -- `member_names` (Set of String) +- `member_names` (List of String) diff --git a/docs/data-sources/repository_npm_group.md b/docs/data-sources/repository_npm_group.md index a26f785c..1bd0dd48 100644 --- a/docs/data-sources/repository_npm_group.md +++ b/docs/data-sources/repository_npm_group.md @@ -31,7 +31,7 @@ data "nexus_repository_npm_group" "group" { Read-Only: -- `member_names` (Set of String) +- `member_names` (List of String) - `writable_member` (String) diff --git a/docs/data-sources/repository_nuget_group.md b/docs/data-sources/repository_nuget_group.md index 10676e6c..c68b8733 100644 --- a/docs/data-sources/repository_nuget_group.md +++ b/docs/data-sources/repository_nuget_group.md @@ -31,7 +31,7 @@ data "nexus_repository_nuget_group" "group" { Read-Only: -- `member_names` (Set of String) +- `member_names` (List of String) diff --git a/docs/data-sources/repository_pypi_group.md b/docs/data-sources/repository_pypi_group.md index e180fe1e..c1ec5a64 100644 --- a/docs/data-sources/repository_pypi_group.md +++ b/docs/data-sources/repository_pypi_group.md @@ -31,7 +31,7 @@ data "nexus_repository_pypi_group" "group" { Read-Only: -- `member_names` (Set of String) +- `member_names` (List of String) - `writable_member` (String) diff --git a/docs/data-sources/repository_r_group.md b/docs/data-sources/repository_r_group.md index 767e2243..b8912472 100644 --- a/docs/data-sources/repository_r_group.md +++ b/docs/data-sources/repository_r_group.md @@ -31,7 +31,7 @@ data "nexus_repository_r_group" "group" { Read-Only: -- `member_names` (Set of String) +- `member_names` (List of String) - `writable_member` (String) diff --git a/docs/data-sources/repository_raw_group.md b/docs/data-sources/repository_raw_group.md index 8ca0aa96..290b1549 100644 --- a/docs/data-sources/repository_raw_group.md +++ b/docs/data-sources/repository_raw_group.md @@ -31,7 +31,7 @@ data "nexus_repository_raw_group" "raw_public" { Read-Only: -- `member_names` (Set of String) +- `member_names` (List of String) diff --git a/docs/data-sources/repository_rubygems_group.md b/docs/data-sources/repository_rubygems_group.md index ebb9a00a..94aafbba 100644 --- a/docs/data-sources/repository_rubygems_group.md +++ b/docs/data-sources/repository_rubygems_group.md @@ -31,7 +31,7 @@ data "nexus_repository_rubygems_group" "group" { Read-Only: -- `member_names` (Set of String) +- `member_names` (List of String) - `writable_member` (String) diff --git a/docs/data-sources/repository_yum_group.md b/docs/data-sources/repository_yum_group.md index 68b89fbb..d0fb94c2 100644 --- a/docs/data-sources/repository_yum_group.md +++ b/docs/data-sources/repository_yum_group.md @@ -32,7 +32,7 @@ data "nexus_repository_yum_group" "yum_group" { Read-Only: -- `member_names` (Set of String) +- `member_names` (List of String) diff --git a/docs/data-sources/security_ssl.md b/docs/data-sources/security_ssl.md index d8723a3f..bdc23202 100644 --- a/docs/data-sources/security_ssl.md +++ b/docs/data-sources/security_ssl.md @@ -3,12 +3,24 @@ page_title: "Data Source nexus_security_ssl" subcategory: "Security" description: |- Use this data source to retrieve a SSL certificate from any Nexus-external hostvia Nexus. - This resource does NOT retrieve a certificate from the Nexus truststore + This resource does NOT retrieve a certificate from the Nexus truststore --- # Data Source nexus_security_ssl Use this data source to retrieve a SSL certificate from any Nexus-external hostvia Nexus. This resource does NOT retrieve a certificate from the Nexus truststore +## Example Usage +```terraform +# Retrieve Cert via Nexus +data "nexus_security_ssl" "ldap_cert" { + host = "google.de" + port = 443 +} +# Import Cert into Nexus +resource "nexus_security_ssl_truststore" "ldap_cert" { + pem = data.nexus_security_ssl.ldap_cert.pem +} +``` ## Schema diff --git a/docs/data-sources/security_ssl_truststore.md b/docs/data-sources/security_ssl_truststore.md index 3b79bf4a..418dc7e5 100644 --- a/docs/data-sources/security_ssl_truststore.md +++ b/docs/data-sources/security_ssl_truststore.md @@ -8,15 +8,13 @@ description: |- Use this data source to retrieve ALL certificates in the Nexus truststore. ## Example Usage ```terraform -# Retrieve Cert via Nexus -data "nexus_security_ssl" "ldap_cert" { - host = "google.de" - port = 443 +# Retrieve certificates from Nexus truststore +data "nexus_security_ssl_truststore" "nexus_truststore" { } -# Import Cert into Nexus -resource "nexus_security_ssl_truststore" "ldap_cert" { - pem = data.nexus_security_ssl.ldap_cert.pem +# Output Nexus truststore certificates +output "truststore" { + value = data.nexus_security_ssl_truststore.nexus_truststore } ``` diff --git a/docs/data-sources/security_user_token.md b/docs/data-sources/security_user_token.md index 9970602c..164cd33c 100644 --- a/docs/data-sources/security_user_token.md +++ b/docs/data-sources/security_user_token.md @@ -23,6 +23,8 @@ output "nexus_user_token_enabled" { ### Read-Only -- `enabled` (Boolean) Activate the feature of user tokens. +- `enabled` (Boolean) Activation of the user tokens feature. +- `expiration_days` (Number) Number of days user tokens remain valid. +- `expiration_enabled` (Boolean) Activation of the user tokens expiration feature. - `id` (String) Used to identify data source at nexus - `protect_content` (Boolean) Require user tokens for repository authentication. This does not effect UI access. diff --git a/docs/resources/repository_bower_group.md b/docs/resources/repository_bower_group.md index 3ff3667e..1949036b 100644 --- a/docs/resources/repository_bower_group.md +++ b/docs/resources/repository_bower_group.md @@ -86,7 +86,7 @@ resource "nexus_repository_bower_group" "group" { Required: -- `member_names` (Set of String) Member repositories names +- `member_names` (List of String) Member repositories names diff --git a/docs/resources/repository_docker_group.md b/docs/resources/repository_docker_group.md index d45b7e42..af696d28 100644 --- a/docs/resources/repository_docker_group.md +++ b/docs/resources/repository_docker_group.md @@ -123,7 +123,7 @@ Optional: Required: -- `member_names` (Set of String) Member repositories names +- `member_names` (List of String) Member repositories names Optional: diff --git a/docs/resources/repository_go_group.md b/docs/resources/repository_go_group.md index aae22990..524b12ba 100644 --- a/docs/resources/repository_go_group.md +++ b/docs/resources/repository_go_group.md @@ -73,7 +73,7 @@ resource "nexus_repository_go_group" "group" { Required: -- `member_names` (Set of String) Member repositories names +- `member_names` (List of String) Member repositories names diff --git a/docs/resources/repository_maven_group.md b/docs/resources/repository_maven_group.md index dadb03a3..bee00c7a 100644 --- a/docs/resources/repository_maven_group.md +++ b/docs/resources/repository_maven_group.md @@ -64,7 +64,7 @@ resource "nexus_repository_maven_group" "group" { Required: -- `member_names` (Set of String) Member repositories names +- `member_names` (List of String) Member repositories names diff --git a/docs/resources/repository_npm_group.md b/docs/resources/repository_npm_group.md index dcd67899..0c52dd5b 100644 --- a/docs/resources/repository_npm_group.md +++ b/docs/resources/repository_npm_group.md @@ -57,7 +57,7 @@ resource "nexus_repository_npm_group" "group" { Required: -- `member_names` (Set of String) Member repositories names +- `member_names` (List of String) Member repositories names Optional: diff --git a/docs/resources/repository_nuget_group.md b/docs/resources/repository_nuget_group.md index fc76e4de..b38cc291 100644 --- a/docs/resources/repository_nuget_group.md +++ b/docs/resources/repository_nuget_group.md @@ -87,7 +87,7 @@ resource "nexus_repository_nuget_group" "group" { Required: -- `member_names` (Set of String) Member repositories names +- `member_names` (List of String) Member repositories names diff --git a/docs/resources/repository_pypi_group.md b/docs/resources/repository_pypi_group.md index 89935277..e03d6995 100644 --- a/docs/resources/repository_pypi_group.md +++ b/docs/resources/repository_pypi_group.md @@ -84,7 +84,7 @@ resource "nexus_repository_pypi_group" "group" { Required: -- `member_names` (Set of String) Member repositories names +- `member_names` (List of String) Member repositories names diff --git a/docs/resources/repository_r_group.md b/docs/resources/repository_r_group.md index f710e3a0..9791808f 100644 --- a/docs/resources/repository_r_group.md +++ b/docs/resources/repository_r_group.md @@ -84,7 +84,7 @@ resource "nexus_repository_r_group" "group" { Required: -- `member_names` (Set of String) Member repositories names +- `member_names` (List of String) Member repositories names diff --git a/docs/resources/repository_raw_group.md b/docs/resources/repository_raw_group.md index 030c597e..51055bd9 100644 --- a/docs/resources/repository_raw_group.md +++ b/docs/resources/repository_raw_group.md @@ -59,7 +59,7 @@ resource "nexus_repository_raw_group" "group" { Required: -- `member_names` (Set of String) Member repositories names +- `member_names` (List of String) Member repositories names diff --git a/docs/resources/repository_rubygems_group.md b/docs/resources/repository_rubygems_group.md index b742c1a3..aa26f665 100644 --- a/docs/resources/repository_rubygems_group.md +++ b/docs/resources/repository_rubygems_group.md @@ -84,7 +84,7 @@ resource "nexus_repository_rubygems_group" "group" { Required: -- `member_names` (Set of String) Member repositories names +- `member_names` (List of String) Member repositories names diff --git a/docs/resources/repository_yum_group.md b/docs/resources/repository_yum_group.md index 5c2af276..e851109a 100644 --- a/docs/resources/repository_yum_group.md +++ b/docs/resources/repository_yum_group.md @@ -60,7 +60,7 @@ resource "nexus_repository_yum_group" "group" { Required: -- `member_names` (Set of String) Member repositories names +- `member_names` (List of String) Member repositories names diff --git a/docs/resources/security_ssl_truststore.md b/docs/resources/security_ssl_truststore.md index 62fdcdd5..06e9aa9b 100644 --- a/docs/resources/security_ssl_truststore.md +++ b/docs/resources/security_ssl_truststore.md @@ -8,8 +8,15 @@ description: |- Use this resource to add an SSL certificate to the nexus Truststore ## Example Usage ```terraform +# Retrieve Cert via Nexus +data "nexus_security_ssl" "ldap_cert" { + host = "google.de" + port = 443 +} + +# Import Cert into Nexus resource "nexus_security_ssl_truststore" "ldap_cert" { - pem = file("${path.module}/cert.pem") + pem = data.nexus_security_ssl.ldap_cert.pem } ``` diff --git a/docs/resources/security_user_token.md b/docs/resources/security_user_token.md index 1c7cffc5..96d6b2f9 100644 --- a/docs/resources/security_user_token.md +++ b/docs/resources/security_user_token.md @@ -25,6 +25,8 @@ resource "nexus_security_user_token" "nexus" { ### Optional +- `expiration_days` (Number) Number of days for which you want user tokens to remain valid. +- `expiration_enabled` (Boolean) Set user tokens expiration. - `protect_content` (Boolean) Require user tokens for repository authentication. This does not effect UI access. ### Read-Only From e0ec59f9aa3bfed6c9acb42849a40da74c6cb5fd Mon Sep 17 00:00:00 2001 From: Andre Moeller Date: Thu, 8 Aug 2024 13:59:34 +0200 Subject: [PATCH 08/11] fix: Set negative_cache block to required --- docs/resources/repository_apt_proxy.md | 20 +++++++++---------- docs/resources/repository_bower_proxy.md | 20 +++++++++---------- docs/resources/repository_cocoapods_proxy.md | 20 +++++++++---------- docs/resources/repository_conan_proxy.md | 20 +++++++++---------- docs/resources/repository_conda_proxy.md | 20 +++++++++---------- docs/resources/repository_docker_proxy.md | 20 +++++++++---------- docs/resources/repository_go_proxy.md | 20 +++++++++---------- docs/resources/repository_helm_proxy.md | 20 +++++++++---------- docs/resources/repository_maven_proxy.md | 20 +++++++++---------- docs/resources/repository_npm_proxy.md | 20 +++++++++---------- docs/resources/repository_nuget_proxy.md | 20 +++++++++---------- docs/resources/repository_p2_proxy.md | 20 +++++++++---------- docs/resources/repository_pypi_proxy.md | 20 +++++++++---------- docs/resources/repository_r_proxy.md | 20 +++++++++---------- docs/resources/repository_raw_proxy.md | 20 +++++++++---------- docs/resources/repository_rubygems_proxy.md | 20 +++++++++---------- docs/resources/repository_yum_proxy.md | 20 +++++++++---------- .../repository/schema_negative_cache.go | 2 +- 18 files changed, 171 insertions(+), 171 deletions(-) diff --git a/docs/resources/repository_apt_proxy.md b/docs/resources/repository_apt_proxy.md index c45e2076..7284196b 100644 --- a/docs/resources/repository_apt_proxy.md +++ b/docs/resources/repository_apt_proxy.md @@ -62,13 +62,13 @@ resource "nexus_repository_apt_proxy" "bionic_proxy" { - `flat` (Boolean) Distribution to fetch - `http_client` (Block List, Min: 1, Max: 1) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedblock--http_client)) - `name` (String) A unique identifier for this repository +- `negative_cache` (Block List, Min: 1, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `proxy` (Block List, Min: 1, Max: 1) Configuration for the proxy repository (see [below for nested schema](#nestedblock--proxy)) - `storage` (Block List, Min: 1, Max: 1) The storage configuration of the repository (see [below for nested schema](#nestedblock--storage)) ### Optional - `cleanup` (Block List) Cleanup policies (see [below for nested schema](#nestedblock--cleanup)) -- `negative_cache` (Block List, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `online` (Boolean) Whether this repository accepts incoming requests - `routing_rule` (String) The name of the routing rule assigned to this repository @@ -118,6 +118,15 @@ Optional: + +### Nested Schema for `negative_cache` + +Optional: + +- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository +- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) + + ### Nested Schema for `proxy` @@ -149,15 +158,6 @@ Optional: Optional: - `policy_names` (Set of String) List of policy names - - - -### Nested Schema for `negative_cache` - -Optional: - -- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository -- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) ## Import Import is supported using the following syntax: ```shell diff --git a/docs/resources/repository_bower_proxy.md b/docs/resources/repository_bower_proxy.md index a800cdc8..dcb147f6 100644 --- a/docs/resources/repository_bower_proxy.md +++ b/docs/resources/repository_bower_proxy.md @@ -43,6 +43,7 @@ resource "nexus_repository_bower_proxy" "bower_io" { - `http_client` (Block List, Min: 1, Max: 1) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedblock--http_client)) - `name` (String) A unique identifier for this repository +- `negative_cache` (Block List, Min: 1, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `proxy` (Block List, Min: 1, Max: 1) Configuration for the proxy repository (see [below for nested schema](#nestedblock--proxy)) - `rewrite_package_urls` (Boolean) Whether to force Bower to retrieve packages through this proxy repository - `storage` (Block List, Min: 1, Max: 1) The storage configuration of the repository (see [below for nested schema](#nestedblock--storage)) @@ -50,7 +51,6 @@ resource "nexus_repository_bower_proxy" "bower_io" { ### Optional - `cleanup` (Block List) Cleanup policies (see [below for nested schema](#nestedblock--cleanup)) -- `negative_cache` (Block List, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `online` (Boolean) Whether this repository accepts incoming requests - `routing_rule` (String) The name of the routing rule assigned to this repository @@ -100,6 +100,15 @@ Optional: + +### Nested Schema for `negative_cache` + +Optional: + +- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository +- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) + + ### Nested Schema for `proxy` @@ -131,15 +140,6 @@ Optional: Optional: - `policy_names` (Set of String) List of policy names - - - -### Nested Schema for `negative_cache` - -Optional: - -- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository -- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) ## Import Import is supported using the following syntax: ```shell diff --git a/docs/resources/repository_cocoapods_proxy.md b/docs/resources/repository_cocoapods_proxy.md index 611f5607..b89b4942 100644 --- a/docs/resources/repository_cocoapods_proxy.md +++ b/docs/resources/repository_cocoapods_proxy.md @@ -41,13 +41,13 @@ resource "nexus_repository_cocoapods_proxy" "cocoapods_org" { - `http_client` (Block List, Min: 1, Max: 1) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedblock--http_client)) - `name` (String) A unique identifier for this repository +- `negative_cache` (Block List, Min: 1, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `proxy` (Block List, Min: 1, Max: 1) Configuration for the proxy repository (see [below for nested schema](#nestedblock--proxy)) - `storage` (Block List, Min: 1, Max: 1) The storage configuration of the repository (see [below for nested schema](#nestedblock--storage)) ### Optional - `cleanup` (Block List) Cleanup policies (see [below for nested schema](#nestedblock--cleanup)) -- `negative_cache` (Block List, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `online` (Boolean) Whether this repository accepts incoming requests - `routing_rule` (String) The name of the routing rule assigned to this repository @@ -97,6 +97,15 @@ Optional: + +### Nested Schema for `negative_cache` + +Optional: + +- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository +- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) + + ### Nested Schema for `proxy` @@ -128,15 +137,6 @@ Optional: Optional: - `policy_names` (Set of String) List of policy names - - - -### Nested Schema for `negative_cache` - -Optional: - -- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository -- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) ## Import Import is supported using the following syntax: ```shell diff --git a/docs/resources/repository_conan_proxy.md b/docs/resources/repository_conan_proxy.md index b8ef7719..200810c3 100644 --- a/docs/resources/repository_conan_proxy.md +++ b/docs/resources/repository_conan_proxy.md @@ -41,13 +41,13 @@ resource "nexus_repository_conan_proxy" "conan_center" { - `http_client` (Block List, Min: 1, Max: 1) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedblock--http_client)) - `name` (String) A unique identifier for this repository +- `negative_cache` (Block List, Min: 1, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `proxy` (Block List, Min: 1, Max: 1) Configuration for the proxy repository (see [below for nested schema](#nestedblock--proxy)) - `storage` (Block List, Min: 1, Max: 1) The storage configuration of the repository (see [below for nested schema](#nestedblock--storage)) ### Optional - `cleanup` (Block List) Cleanup policies (see [below for nested schema](#nestedblock--cleanup)) -- `negative_cache` (Block List, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `online` (Boolean) Whether this repository accepts incoming requests - `routing_rule` (String) The name of the routing rule assigned to this repository @@ -97,6 +97,15 @@ Optional: + +### Nested Schema for `negative_cache` + +Optional: + +- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository +- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) + + ### Nested Schema for `proxy` @@ -128,15 +137,6 @@ Optional: Optional: - `policy_names` (Set of String) List of policy names - - - -### Nested Schema for `negative_cache` - -Optional: - -- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository -- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) ## Import Import is supported using the following syntax: ```shell diff --git a/docs/resources/repository_conda_proxy.md b/docs/resources/repository_conda_proxy.md index 7367b960..bf128041 100644 --- a/docs/resources/repository_conda_proxy.md +++ b/docs/resources/repository_conda_proxy.md @@ -41,13 +41,13 @@ resource "nexus_repository_conda_proxy" "anaconda" { - `http_client` (Block List, Min: 1, Max: 1) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedblock--http_client)) - `name` (String) A unique identifier for this repository +- `negative_cache` (Block List, Min: 1, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `proxy` (Block List, Min: 1, Max: 1) Configuration for the proxy repository (see [below for nested schema](#nestedblock--proxy)) - `storage` (Block List, Min: 1, Max: 1) The storage configuration of the repository (see [below for nested schema](#nestedblock--storage)) ### Optional - `cleanup` (Block List) Cleanup policies (see [below for nested schema](#nestedblock--cleanup)) -- `negative_cache` (Block List, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `online` (Boolean) Whether this repository accepts incoming requests - `routing_rule` (String) The name of the routing rule assigned to this repository @@ -97,6 +97,15 @@ Optional: + +### Nested Schema for `negative_cache` + +Optional: + +- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository +- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) + + ### Nested Schema for `proxy` @@ -128,15 +137,6 @@ Optional: Optional: - `policy_names` (Set of String) List of policy names - - - -### Nested Schema for `negative_cache` - -Optional: - -- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository -- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) ## Import Import is supported using the following syntax: ```shell diff --git a/docs/resources/repository_docker_proxy.md b/docs/resources/repository_docker_proxy.md index 30bf94f3..80eedf60 100644 --- a/docs/resources/repository_docker_proxy.md +++ b/docs/resources/repository_docker_proxy.md @@ -53,13 +53,13 @@ resource "nexus_repository_docker_proxy" "dockerhub" { - `docker_proxy` (Block List, Min: 1, Max: 1) docker_proxy contains the configuration of the docker index (see [below for nested schema](#nestedblock--docker_proxy)) - `http_client` (Block List, Min: 1, Max: 1) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedblock--http_client)) - `name` (String) A unique identifier for this repository +- `negative_cache` (Block List, Min: 1, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `proxy` (Block List, Min: 1, Max: 1) Configuration for the proxy repository (see [below for nested schema](#nestedblock--proxy)) - `storage` (Block List, Min: 1, Max: 1) The storage configuration of the repository (see [below for nested schema](#nestedblock--storage)) ### Optional - `cleanup` (Block List) Cleanup policies (see [below for nested schema](#nestedblock--cleanup)) -- `negative_cache` (Block List, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `online` (Boolean) Whether this repository accepts incoming requests - `routing_rule` (String) The name of the routing rule assigned to this repository @@ -136,6 +136,15 @@ Optional: + +### Nested Schema for `negative_cache` + +Optional: + +- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository +- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) + + ### Nested Schema for `proxy` @@ -167,15 +176,6 @@ Optional: Optional: - `policy_names` (Set of String) List of policy names - - - -### Nested Schema for `negative_cache` - -Optional: - -- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository -- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) ## Import Import is supported using the following syntax: ```shell diff --git a/docs/resources/repository_go_proxy.md b/docs/resources/repository_go_proxy.md index 3955e34b..3a150560 100644 --- a/docs/resources/repository_go_proxy.md +++ b/docs/resources/repository_go_proxy.md @@ -41,13 +41,13 @@ resource "nexus_repository_go_proxy" "golang_org" { - `http_client` (Block List, Min: 1, Max: 1) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedblock--http_client)) - `name` (String) A unique identifier for this repository +- `negative_cache` (Block List, Min: 1, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `proxy` (Block List, Min: 1, Max: 1) Configuration for the proxy repository (see [below for nested schema](#nestedblock--proxy)) - `storage` (Block List, Min: 1, Max: 1) The storage configuration of the repository (see [below for nested schema](#nestedblock--storage)) ### Optional - `cleanup` (Block List) Cleanup policies (see [below for nested schema](#nestedblock--cleanup)) -- `negative_cache` (Block List, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `online` (Boolean) Whether this repository accepts incoming requests - `routing_rule` (String) The name of the routing rule assigned to this repository @@ -98,6 +98,15 @@ Optional: + +### Nested Schema for `negative_cache` + +Optional: + +- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository +- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) + + ### Nested Schema for `proxy` @@ -129,15 +138,6 @@ Optional: Optional: - `policy_names` (Set of String) List of policy names - - - -### Nested Schema for `negative_cache` - -Optional: - -- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository -- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) ## Import Import is supported using the following syntax: ```shell diff --git a/docs/resources/repository_helm_proxy.md b/docs/resources/repository_helm_proxy.md index 4a531b07..ec65c833 100644 --- a/docs/resources/repository_helm_proxy.md +++ b/docs/resources/repository_helm_proxy.md @@ -41,13 +41,13 @@ resource "nexus_repository_helm_proxy" "kubernetes_charts" { - `http_client` (Block List, Min: 1, Max: 1) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedblock--http_client)) - `name` (String) A unique identifier for this repository +- `negative_cache` (Block List, Min: 1, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `proxy` (Block List, Min: 1, Max: 1) Configuration for the proxy repository (see [below for nested schema](#nestedblock--proxy)) - `storage` (Block List, Min: 1, Max: 1) The storage configuration of the repository (see [below for nested schema](#nestedblock--storage)) ### Optional - `cleanup` (Block List) Cleanup policies (see [below for nested schema](#nestedblock--cleanup)) -- `negative_cache` (Block List, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `online` (Boolean) Whether this repository accepts incoming requests - `routing_rule` (String) The name of the routing rule assigned to this repository @@ -98,6 +98,15 @@ Optional: + +### Nested Schema for `negative_cache` + +Optional: + +- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository +- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) + + ### Nested Schema for `proxy` @@ -129,15 +138,6 @@ Optional: Optional: - `policy_names` (Set of String) List of policy names - - - -### Nested Schema for `negative_cache` - -Optional: - -- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository -- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) ## Import Import is supported using the following syntax: ```shell diff --git a/docs/resources/repository_maven_proxy.md b/docs/resources/repository_maven_proxy.md index 7c1909c6..24d4cfe0 100644 --- a/docs/resources/repository_maven_proxy.md +++ b/docs/resources/repository_maven_proxy.md @@ -47,13 +47,13 @@ resource "nexus_repository_maven_proxy" "maven_central" { - `http_client` (Block List, Min: 1, Max: 1) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedblock--http_client)) - `maven` (Block List, Min: 1, Max: 1) Maven contains additional data of maven repository (see [below for nested schema](#nestedblock--maven)) - `name` (String) A unique identifier for this repository +- `negative_cache` (Block List, Min: 1, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `proxy` (Block List, Min: 1, Max: 1) Configuration for the proxy repository (see [below for nested schema](#nestedblock--proxy)) - `storage` (Block List, Min: 1, Max: 1) The storage configuration of the repository (see [below for nested schema](#nestedblock--storage)) ### Optional - `cleanup` (Block List) Cleanup policies (see [below for nested schema](#nestedblock--cleanup)) -- `negative_cache` (Block List, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `online` (Boolean) Whether this repository accepts incoming requests - `routing_rule` (String) The name of the routing rule assigned to this repository @@ -117,6 +117,15 @@ Optional: - `content_disposition` (String) Add Content-Disposition header as 'Attachment' to disable some content from being inline in a browse. Possible Value: `INLINE` or `ATTACHMENT` + +### Nested Schema for `negative_cache` + +Optional: + +- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository +- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) + + ### Nested Schema for `proxy` @@ -148,15 +157,6 @@ Optional: Optional: - `policy_names` (Set of String) List of policy names - - - -### Nested Schema for `negative_cache` - -Optional: - -- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository -- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) ## Import Import is supported using the following syntax: ```shell diff --git a/docs/resources/repository_npm_proxy.md b/docs/resources/repository_npm_proxy.md index ec6e6d68..9e08947f 100644 --- a/docs/resources/repository_npm_proxy.md +++ b/docs/resources/repository_npm_proxy.md @@ -41,13 +41,13 @@ resource "nexus_repository_npm_proxy" "npmjs" { - `http_client` (Block List, Min: 1, Max: 1) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedblock--http_client)) - `name` (String) A unique identifier for this repository +- `negative_cache` (Block List, Min: 1, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `proxy` (Block List, Min: 1, Max: 1) Configuration for the proxy repository (see [below for nested schema](#nestedblock--proxy)) - `storage` (Block List, Min: 1, Max: 1) The storage configuration of the repository (see [below for nested schema](#nestedblock--storage)) ### Optional - `cleanup` (Block List) Cleanup policies (see [below for nested schema](#nestedblock--cleanup)) -- `negative_cache` (Block List, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `online` (Boolean) Whether this repository accepts incoming requests - `remove_non_cataloged` (Boolean, Deprecated) Remove non-catalogued versions from the npm package metadata. - `remove_quarantined` (Boolean) Remove quarantined versions from the npm package metadata. @@ -99,6 +99,15 @@ Optional: + +### Nested Schema for `negative_cache` + +Optional: + +- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository +- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) + + ### Nested Schema for `proxy` @@ -130,15 +139,6 @@ Optional: Optional: - `policy_names` (Set of String) List of policy names - - - -### Nested Schema for `negative_cache` - -Optional: - -- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository -- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) ## Import Import is supported using the following syntax: ```shell diff --git a/docs/resources/repository_nuget_proxy.md b/docs/resources/repository_nuget_proxy.md index 75a61e9f..2aed8ea8 100644 --- a/docs/resources/repository_nuget_proxy.md +++ b/docs/resources/repository_nuget_proxy.md @@ -44,6 +44,7 @@ resource "nexus_repository_nuget_proxy" "nuget_org" { - `http_client` (Block List, Min: 1, Max: 1) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedblock--http_client)) - `name` (String) A unique identifier for this repository +- `negative_cache` (Block List, Min: 1, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `nuget_version` (String) Nuget protocol version - `proxy` (Block List, Min: 1, Max: 1) Configuration for the proxy repository (see [below for nested schema](#nestedblock--proxy)) - `query_cache_item_max_age` (Number) How long to cache query results from the proxied repository (in seconds) @@ -52,7 +53,6 @@ resource "nexus_repository_nuget_proxy" "nuget_org" { ### Optional - `cleanup` (Block List) Cleanup policies (see [below for nested schema](#nestedblock--cleanup)) -- `negative_cache` (Block List, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `online` (Boolean) Whether this repository accepts incoming requests - `routing_rule` (String) The name of the routing rule assigned to this repository @@ -102,6 +102,15 @@ Optional: + +### Nested Schema for `negative_cache` + +Optional: + +- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository +- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) + + ### Nested Schema for `proxy` @@ -133,15 +142,6 @@ Optional: Optional: - `policy_names` (Set of String) List of policy names - - - -### Nested Schema for `negative_cache` - -Optional: - -- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository -- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) ## Import Import is supported using the following syntax: ```shell diff --git a/docs/resources/repository_p2_proxy.md b/docs/resources/repository_p2_proxy.md index 7fa6bd4e..c1ada7f0 100644 --- a/docs/resources/repository_p2_proxy.md +++ b/docs/resources/repository_p2_proxy.md @@ -41,13 +41,13 @@ resource "nexus_repository_p2_proxy" "eclipse" { - `http_client` (Block List, Min: 1, Max: 1) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedblock--http_client)) - `name` (String) A unique identifier for this repository +- `negative_cache` (Block List, Min: 1, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `proxy` (Block List, Min: 1, Max: 1) Configuration for the proxy repository (see [below for nested schema](#nestedblock--proxy)) - `storage` (Block List, Min: 1, Max: 1) The storage configuration of the repository (see [below for nested schema](#nestedblock--storage)) ### Optional - `cleanup` (Block List) Cleanup policies (see [below for nested schema](#nestedblock--cleanup)) -- `negative_cache` (Block List, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `online` (Boolean) Whether this repository accepts incoming requests - `routing_rule` (String) The name of the routing rule assigned to this repository @@ -97,6 +97,15 @@ Optional: + +### Nested Schema for `negative_cache` + +Optional: + +- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository +- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) + + ### Nested Schema for `proxy` @@ -128,15 +137,6 @@ Optional: Optional: - `policy_names` (Set of String) List of policy names - - - -### Nested Schema for `negative_cache` - -Optional: - -- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository -- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) ## Import Import is supported using the following syntax: ```shell diff --git a/docs/resources/repository_pypi_proxy.md b/docs/resources/repository_pypi_proxy.md index 13e3e555..66f4a6b1 100644 --- a/docs/resources/repository_pypi_proxy.md +++ b/docs/resources/repository_pypi_proxy.md @@ -41,13 +41,13 @@ resource "nexus_repository_pypi_proxy" "pypi_org" { - `http_client` (Block List, Min: 1, Max: 1) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedblock--http_client)) - `name` (String) A unique identifier for this repository +- `negative_cache` (Block List, Min: 1, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `proxy` (Block List, Min: 1, Max: 1) Configuration for the proxy repository (see [below for nested schema](#nestedblock--proxy)) - `storage` (Block List, Min: 1, Max: 1) The storage configuration of the repository (see [below for nested schema](#nestedblock--storage)) ### Optional - `cleanup` (Block List) Cleanup policies (see [below for nested schema](#nestedblock--cleanup)) -- `negative_cache` (Block List, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `online` (Boolean) Whether this repository accepts incoming requests - `routing_rule` (String) The name of the routing rule assigned to this repository @@ -97,6 +97,15 @@ Optional: + +### Nested Schema for `negative_cache` + +Optional: + +- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository +- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) + + ### Nested Schema for `proxy` @@ -128,15 +137,6 @@ Optional: Optional: - `policy_names` (Set of String) List of policy names - - - -### Nested Schema for `negative_cache` - -Optional: - -- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository -- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) ## Import Import is supported using the following syntax: ```shell diff --git a/docs/resources/repository_r_proxy.md b/docs/resources/repository_r_proxy.md index 97b897f0..75d0487b 100644 --- a/docs/resources/repository_r_proxy.md +++ b/docs/resources/repository_r_proxy.md @@ -41,13 +41,13 @@ resource "nexus_repository_r_proxy" "r_org" { - `http_client` (Block List, Min: 1, Max: 1) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedblock--http_client)) - `name` (String) A unique identifier for this repository +- `negative_cache` (Block List, Min: 1, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `proxy` (Block List, Min: 1, Max: 1) Configuration for the proxy repository (see [below for nested schema](#nestedblock--proxy)) - `storage` (Block List, Min: 1, Max: 1) The storage configuration of the repository (see [below for nested schema](#nestedblock--storage)) ### Optional - `cleanup` (Block List) Cleanup policies (see [below for nested schema](#nestedblock--cleanup)) -- `negative_cache` (Block List, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `online` (Boolean) Whether this repository accepts incoming requests - `routing_rule` (String) The name of the routing rule assigned to this repository @@ -97,6 +97,15 @@ Optional: + +### Nested Schema for `negative_cache` + +Optional: + +- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository +- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) + + ### Nested Schema for `proxy` @@ -128,15 +137,6 @@ Optional: Optional: - `policy_names` (Set of String) List of policy names - - - -### Nested Schema for `negative_cache` - -Optional: - -- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository -- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) ## Import Import is supported using the following syntax: ```shell diff --git a/docs/resources/repository_raw_proxy.md b/docs/resources/repository_raw_proxy.md index de73c088..c0e500ee 100644 --- a/docs/resources/repository_raw_proxy.md +++ b/docs/resources/repository_raw_proxy.md @@ -41,13 +41,13 @@ resource "nexus_repository_raw_proxy" "raw_org" { - `http_client` (Block List, Min: 1, Max: 1) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedblock--http_client)) - `name` (String) A unique identifier for this repository +- `negative_cache` (Block List, Min: 1, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `proxy` (Block List, Min: 1, Max: 1) Configuration for the proxy repository (see [below for nested schema](#nestedblock--proxy)) - `storage` (Block List, Min: 1, Max: 1) The storage configuration of the repository (see [below for nested schema](#nestedblock--storage)) ### Optional - `cleanup` (Block List) Cleanup policies (see [below for nested schema](#nestedblock--cleanup)) -- `negative_cache` (Block List, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `online` (Boolean) Whether this repository accepts incoming requests - `routing_rule` (String) The name of the routing rule assigned to this repository @@ -98,6 +98,15 @@ Optional: + +### Nested Schema for `negative_cache` + +Optional: + +- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository +- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) + + ### Nested Schema for `proxy` @@ -129,15 +138,6 @@ Optional: Optional: - `policy_names` (Set of String) List of policy names - - - -### Nested Schema for `negative_cache` - -Optional: - -- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository -- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) ## Import Import is supported using the following syntax: ```shell diff --git a/docs/resources/repository_rubygems_proxy.md b/docs/resources/repository_rubygems_proxy.md index dad06b92..afca4834 100644 --- a/docs/resources/repository_rubygems_proxy.md +++ b/docs/resources/repository_rubygems_proxy.md @@ -41,13 +41,13 @@ resource "nexus_repository_rubygems_proxy" "rubygems_org" { - `http_client` (Block List, Min: 1, Max: 1) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedblock--http_client)) - `name` (String) A unique identifier for this repository +- `negative_cache` (Block List, Min: 1, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `proxy` (Block List, Min: 1, Max: 1) Configuration for the proxy repository (see [below for nested schema](#nestedblock--proxy)) - `storage` (Block List, Min: 1, Max: 1) The storage configuration of the repository (see [below for nested schema](#nestedblock--storage)) ### Optional - `cleanup` (Block List) Cleanup policies (see [below for nested schema](#nestedblock--cleanup)) -- `negative_cache` (Block List, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `online` (Boolean) Whether this repository accepts incoming requests - `routing_rule` (String) The name of the routing rule assigned to this repository @@ -97,6 +97,15 @@ Optional: + +### Nested Schema for `negative_cache` + +Optional: + +- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository +- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) + + ### Nested Schema for `proxy` @@ -128,15 +137,6 @@ Optional: Optional: - `policy_names` (Set of String) List of policy names - - - -### Nested Schema for `negative_cache` - -Optional: - -- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository -- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) ## Import Import is supported using the following syntax: ```shell diff --git a/docs/resources/repository_yum_proxy.md b/docs/resources/repository_yum_proxy.md index 3cb83f15..56b14150 100644 --- a/docs/resources/repository_yum_proxy.md +++ b/docs/resources/repository_yum_proxy.md @@ -41,13 +41,13 @@ resource "nexus_repository_yum_proxy" "centos" { - `http_client` (Block List, Min: 1, Max: 1) HTTP Client configuration for proxy repositories (see [below for nested schema](#nestedblock--http_client)) - `name` (String) A unique identifier for this repository +- `negative_cache` (Block List, Min: 1, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `proxy` (Block List, Min: 1, Max: 1) Configuration for the proxy repository (see [below for nested schema](#nestedblock--proxy)) - `storage` (Block List, Min: 1, Max: 1) The storage configuration of the repository (see [below for nested schema](#nestedblock--storage)) ### Optional - `cleanup` (Block List) Cleanup policies (see [below for nested schema](#nestedblock--cleanup)) -- `negative_cache` (Block List, Max: 1) Configuration of the negative cache handling (see [below for nested schema](#nestedblock--negative_cache)) - `online` (Boolean) Whether this repository accepts incoming requests - `routing_rule` (String) The name of the routing rule assigned to this repository - `yum_signing` (Block List, Max: 1) Contains signing data of repositores (see [below for nested schema](#nestedblock--yum_signing)) @@ -98,6 +98,15 @@ Optional: + +### Nested Schema for `negative_cache` + +Optional: + +- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository +- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) + + ### Nested Schema for `proxy` @@ -131,15 +140,6 @@ Optional: - `policy_names` (Set of String) List of policy names - -### Nested Schema for `negative_cache` - -Optional: - -- `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository -- `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) - - ### Nested Schema for `yum_signing` diff --git a/internal/schema/repository/schema_negative_cache.go b/internal/schema/repository/schema_negative_cache.go index cb727094..db374b7b 100644 --- a/internal/schema/repository/schema_negative_cache.go +++ b/internal/schema/repository/schema_negative_cache.go @@ -7,8 +7,8 @@ import ( var ( ResourceNegativeCache = &schema.Schema{ Description: "Configuration of the negative cache handling", - Optional: true, Type: schema.TypeList, + Required: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ From fcc66866988f433efab45d4922e069b36ac40785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20M=C3=B6ller?= Date: Thu, 8 Aug 2024 16:23:20 +0200 Subject: [PATCH 09/11] feat: Set negative cache fields as required options (#458) * feat: Set negative cache fields as required options following the Nexus API definition * fix: Fix all tests for data sources repository proxy --- docs/resources/repository_apt_proxy.md | 2 +- docs/resources/repository_bower_proxy.md | 2 +- docs/resources/repository_cocoapods_proxy.md | 2 +- docs/resources/repository_conan_proxy.md | 2 +- docs/resources/repository_conda_proxy.md | 2 +- docs/resources/repository_docker_proxy.md | 2 +- docs/resources/repository_go_proxy.md | 2 +- docs/resources/repository_helm_proxy.md | 2 +- docs/resources/repository_maven_proxy.md | 2 +- docs/resources/repository_npm_proxy.md | 2 +- docs/resources/repository_nuget_proxy.md | 2 +- docs/resources/repository_p2_proxy.md | 2 +- docs/resources/repository_pypi_proxy.md | 2 +- docs/resources/repository_r_proxy.md | 2 +- docs/resources/repository_raw_proxy.md | 2 +- docs/resources/repository_rubygems_proxy.md | 2 +- docs/resources/repository_yum_proxy.md | 2 +- internal/acceptance/template-strings-repository.go | 6 ------ internal/schema/repository/schema_negative_cache.go | 6 ++---- .../repository/data_source_repository_apt_proxy_test.go | 4 ++++ .../repository/data_source_repository_bower_proxy_test.go | 4 ++++ .../data_source_repository_cocoapods_proxy_test.go | 4 ++++ .../repository/data_source_repository_conan_proxy_test.go | 4 ++++ .../repository/data_source_repository_conda_proxy_test.go | 4 ++++ .../repository/data_source_repository_docker_proxy_test.go | 4 ++++ .../repository/data_source_repository_go_proxy_test.go | 4 ++++ .../repository/data_source_repository_helm_proxy_test.go | 4 ++++ .../repository/data_source_repository_maven_proxy_test.go | 4 ++++ .../repository/data_source_repository_npm_proxy_test.go | 4 ++++ .../repository/data_source_repository_nuget_proxy_test.go | 4 ++++ .../repository/data_source_repository_p2_proxy_test.go | 4 ++++ .../repository/data_source_repository_pypi_proxy_test.go | 4 ++++ .../repository/data_source_repository_r_proxy_test.go | 4 ++++ .../repository/data_source_repository_raw_proxy_test.go | 4 ++++ .../data_source_repository_rubygems_proxy_test.go | 4 ++++ .../repository/data_source_repository_yum_proxy_test.go | 4 ++++ 36 files changed, 87 insertions(+), 27 deletions(-) diff --git a/docs/resources/repository_apt_proxy.md b/docs/resources/repository_apt_proxy.md index 7284196b..dd3a9bff 100644 --- a/docs/resources/repository_apt_proxy.md +++ b/docs/resources/repository_apt_proxy.md @@ -121,7 +121,7 @@ Optional: ### Nested Schema for `negative_cache` -Optional: +Required: - `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository - `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) diff --git a/docs/resources/repository_bower_proxy.md b/docs/resources/repository_bower_proxy.md index dcb147f6..00427b27 100644 --- a/docs/resources/repository_bower_proxy.md +++ b/docs/resources/repository_bower_proxy.md @@ -103,7 +103,7 @@ Optional: ### Nested Schema for `negative_cache` -Optional: +Required: - `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository - `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) diff --git a/docs/resources/repository_cocoapods_proxy.md b/docs/resources/repository_cocoapods_proxy.md index b89b4942..8d70a8a3 100644 --- a/docs/resources/repository_cocoapods_proxy.md +++ b/docs/resources/repository_cocoapods_proxy.md @@ -100,7 +100,7 @@ Optional: ### Nested Schema for `negative_cache` -Optional: +Required: - `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository - `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) diff --git a/docs/resources/repository_conan_proxy.md b/docs/resources/repository_conan_proxy.md index 200810c3..396dc7fe 100644 --- a/docs/resources/repository_conan_proxy.md +++ b/docs/resources/repository_conan_proxy.md @@ -100,7 +100,7 @@ Optional: ### Nested Schema for `negative_cache` -Optional: +Required: - `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository - `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) diff --git a/docs/resources/repository_conda_proxy.md b/docs/resources/repository_conda_proxy.md index bf128041..62a8b79d 100644 --- a/docs/resources/repository_conda_proxy.md +++ b/docs/resources/repository_conda_proxy.md @@ -100,7 +100,7 @@ Optional: ### Nested Schema for `negative_cache` -Optional: +Required: - `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository - `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) diff --git a/docs/resources/repository_docker_proxy.md b/docs/resources/repository_docker_proxy.md index 80eedf60..ee99365c 100644 --- a/docs/resources/repository_docker_proxy.md +++ b/docs/resources/repository_docker_proxy.md @@ -139,7 +139,7 @@ Optional: ### Nested Schema for `negative_cache` -Optional: +Required: - `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository - `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) diff --git a/docs/resources/repository_go_proxy.md b/docs/resources/repository_go_proxy.md index 3a150560..b140a97a 100644 --- a/docs/resources/repository_go_proxy.md +++ b/docs/resources/repository_go_proxy.md @@ -101,7 +101,7 @@ Optional: ### Nested Schema for `negative_cache` -Optional: +Required: - `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository - `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) diff --git a/docs/resources/repository_helm_proxy.md b/docs/resources/repository_helm_proxy.md index ec65c833..fd168a85 100644 --- a/docs/resources/repository_helm_proxy.md +++ b/docs/resources/repository_helm_proxy.md @@ -101,7 +101,7 @@ Optional: ### Nested Schema for `negative_cache` -Optional: +Required: - `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository - `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) diff --git a/docs/resources/repository_maven_proxy.md b/docs/resources/repository_maven_proxy.md index 24d4cfe0..39f76035 100644 --- a/docs/resources/repository_maven_proxy.md +++ b/docs/resources/repository_maven_proxy.md @@ -120,7 +120,7 @@ Optional: ### Nested Schema for `negative_cache` -Optional: +Required: - `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository - `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) diff --git a/docs/resources/repository_npm_proxy.md b/docs/resources/repository_npm_proxy.md index 9e08947f..1276c511 100644 --- a/docs/resources/repository_npm_proxy.md +++ b/docs/resources/repository_npm_proxy.md @@ -102,7 +102,7 @@ Optional: ### Nested Schema for `negative_cache` -Optional: +Required: - `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository - `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) diff --git a/docs/resources/repository_nuget_proxy.md b/docs/resources/repository_nuget_proxy.md index 2aed8ea8..04d3d56a 100644 --- a/docs/resources/repository_nuget_proxy.md +++ b/docs/resources/repository_nuget_proxy.md @@ -105,7 +105,7 @@ Optional: ### Nested Schema for `negative_cache` -Optional: +Required: - `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository - `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) diff --git a/docs/resources/repository_p2_proxy.md b/docs/resources/repository_p2_proxy.md index c1ada7f0..d70b4a00 100644 --- a/docs/resources/repository_p2_proxy.md +++ b/docs/resources/repository_p2_proxy.md @@ -100,7 +100,7 @@ Optional: ### Nested Schema for `negative_cache` -Optional: +Required: - `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository - `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) diff --git a/docs/resources/repository_pypi_proxy.md b/docs/resources/repository_pypi_proxy.md index 66f4a6b1..34a825d7 100644 --- a/docs/resources/repository_pypi_proxy.md +++ b/docs/resources/repository_pypi_proxy.md @@ -100,7 +100,7 @@ Optional: ### Nested Schema for `negative_cache` -Optional: +Required: - `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository - `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) diff --git a/docs/resources/repository_r_proxy.md b/docs/resources/repository_r_proxy.md index 75d0487b..4082003f 100644 --- a/docs/resources/repository_r_proxy.md +++ b/docs/resources/repository_r_proxy.md @@ -100,7 +100,7 @@ Optional: ### Nested Schema for `negative_cache` -Optional: +Required: - `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository - `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) diff --git a/docs/resources/repository_raw_proxy.md b/docs/resources/repository_raw_proxy.md index c0e500ee..0cecd465 100644 --- a/docs/resources/repository_raw_proxy.md +++ b/docs/resources/repository_raw_proxy.md @@ -101,7 +101,7 @@ Optional: ### Nested Schema for `negative_cache` -Optional: +Required: - `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository - `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) diff --git a/docs/resources/repository_rubygems_proxy.md b/docs/resources/repository_rubygems_proxy.md index afca4834..9e753b55 100644 --- a/docs/resources/repository_rubygems_proxy.md +++ b/docs/resources/repository_rubygems_proxy.md @@ -100,7 +100,7 @@ Optional: ### Nested Schema for `negative_cache` -Optional: +Required: - `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository - `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) diff --git a/docs/resources/repository_yum_proxy.md b/docs/resources/repository_yum_proxy.md index 56b14150..5a98833f 100644 --- a/docs/resources/repository_yum_proxy.md +++ b/docs/resources/repository_yum_proxy.md @@ -101,7 +101,7 @@ Optional: ### Nested Schema for `negative_cache` -Optional: +Required: - `enabled` (Boolean) Whether to cache responses for content not present in the proxied repository - `ttl` (Number) How long to cache the fact that a file was not found in the repository (in minutes) diff --git a/internal/acceptance/template-strings-repository.go b/internal/acceptance/template-strings-repository.go index c5c76cba..d35b10f6 100644 --- a/internal/acceptance/template-strings-repository.go +++ b/internal/acceptance/template-strings-repository.go @@ -118,16 +118,10 @@ group { ` TemplateStringNegativeCache = ` -{{ if .NegativeCache }} negative_cache { - {{ if .NegativeCache.Enabled }} enabled = {{ .NegativeCache.Enabled }} - {{ end -}} - {{ if .NegativeCache.TTL }} ttl = {{ .NegativeCache.TTL }} - {{ end }} } -{{ end -}} ` TemplateStringProxy = ` diff --git a/internal/schema/repository/schema_negative_cache.go b/internal/schema/repository/schema_negative_cache.go index db374b7b..0fd5d24e 100644 --- a/internal/schema/repository/schema_negative_cache.go +++ b/internal/schema/repository/schema_negative_cache.go @@ -13,15 +13,13 @@ var ( Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "enabled": { - Default: false, Description: "Whether to cache responses for content not present in the proxied repository", - Optional: true, + Required: true, Type: schema.TypeBool, }, "ttl": { - Default: 1440, Description: "How long to cache the fact that a file was not found in the repository (in minutes)", - Optional: true, + Required: true, Type: schema.TypeInt, }, }, diff --git a/internal/services/repository/data_source_repository_apt_proxy_test.go b/internal/services/repository/data_source_repository_apt_proxy_test.go index 5b63b238..d6c56c02 100644 --- a/internal/services/repository/data_source_repository_apt_proxy_test.go +++ b/internal/services/repository/data_source_repository_apt_proxy_test.go @@ -32,6 +32,10 @@ func TestAccDataSourceRepositoryAptProxy(t *testing.T) { BlobStoreName: "default", StrictContentTypeValidation: true, }, + NegativeCache: repository.NegativeCache{ + Enabled: true, + TTL: 5, + }, } dataSourceName := "data.nexus_repository_apt_proxy.acceptance" diff --git a/internal/services/repository/data_source_repository_bower_proxy_test.go b/internal/services/repository/data_source_repository_bower_proxy_test.go index 4878e0db..249236c5 100644 --- a/internal/services/repository/data_source_repository_bower_proxy_test.go +++ b/internal/services/repository/data_source_repository_bower_proxy_test.go @@ -29,6 +29,10 @@ func TestAccDataSourceRepositoryBowerProxy(t *testing.T) { BlobStoreName: "default", StrictContentTypeValidation: true, }, + NegativeCache: repository.NegativeCache{ + Enabled: true, + TTL: 5, + }, Bower: repository.Bower{ RewritePackageUrls: false, }, diff --git a/internal/services/repository/data_source_repository_cocoapods_proxy_test.go b/internal/services/repository/data_source_repository_cocoapods_proxy_test.go index 4e02a6eb..65557251 100644 --- a/internal/services/repository/data_source_repository_cocoapods_proxy_test.go +++ b/internal/services/repository/data_source_repository_cocoapods_proxy_test.go @@ -29,6 +29,10 @@ func TestAccDataSourceRepositoryCocoapodsProxy(t *testing.T) { BlobStoreName: "default", StrictContentTypeValidation: true, }, + NegativeCache: repository.NegativeCache{ + Enabled: true, + TTL: 5, + }, } dataSourceName := "data.nexus_repository_cocoapods_proxy.acceptance" diff --git a/internal/services/repository/data_source_repository_conan_proxy_test.go b/internal/services/repository/data_source_repository_conan_proxy_test.go index 1b7beb8f..a84dd947 100644 --- a/internal/services/repository/data_source_repository_conan_proxy_test.go +++ b/internal/services/repository/data_source_repository_conan_proxy_test.go @@ -29,6 +29,10 @@ func TestAccDataSourceRepositoryConanProxy(t *testing.T) { BlobStoreName: "default", StrictContentTypeValidation: true, }, + NegativeCache: repository.NegativeCache{ + Enabled: true, + TTL: 5, + }, } dataSourceName := "data.nexus_repository_conan_proxy.acceptance" diff --git a/internal/services/repository/data_source_repository_conda_proxy_test.go b/internal/services/repository/data_source_repository_conda_proxy_test.go index e9f800a3..9bb50739 100644 --- a/internal/services/repository/data_source_repository_conda_proxy_test.go +++ b/internal/services/repository/data_source_repository_conda_proxy_test.go @@ -29,6 +29,10 @@ func TestAccDataSourceRepositoryCondaProxy(t *testing.T) { BlobStoreName: "default", StrictContentTypeValidation: true, }, + NegativeCache: repository.NegativeCache{ + Enabled: true, + TTL: 5, + }, } dataSourceName := "data.nexus_repository_conda_proxy.acceptance" diff --git a/internal/services/repository/data_source_repository_docker_proxy_test.go b/internal/services/repository/data_source_repository_docker_proxy_test.go index 837ca11c..3bf5fa26 100644 --- a/internal/services/repository/data_source_repository_docker_proxy_test.go +++ b/internal/services/repository/data_source_repository_docker_proxy_test.go @@ -42,6 +42,10 @@ func TestAccDataSourceRepositoryDockerProxy(t *testing.T) { BlobStoreName: "default", StrictContentTypeValidation: true, }, + NegativeCache: repository.NegativeCache{ + Enabled: true, + TTL: 5, + }, } repo.Docker.Subdomain = &subdomain dataSourceName := "data.nexus_repository_docker_proxy.acceptance" diff --git a/internal/services/repository/data_source_repository_go_proxy_test.go b/internal/services/repository/data_source_repository_go_proxy_test.go index 02827a13..73c7367f 100644 --- a/internal/services/repository/data_source_repository_go_proxy_test.go +++ b/internal/services/repository/data_source_repository_go_proxy_test.go @@ -29,6 +29,10 @@ func TestAccDataSourceRepositoryGoProxy(t *testing.T) { BlobStoreName: "default", StrictContentTypeValidation: true, }, + NegativeCache: repository.NegativeCache{ + Enabled: true, + TTL: 5, + }, } dataSourceName := "data.nexus_repository_go_proxy.acceptance" diff --git a/internal/services/repository/data_source_repository_helm_proxy_test.go b/internal/services/repository/data_source_repository_helm_proxy_test.go index af7d7fa3..2f285f0b 100644 --- a/internal/services/repository/data_source_repository_helm_proxy_test.go +++ b/internal/services/repository/data_source_repository_helm_proxy_test.go @@ -29,6 +29,10 @@ func TestAccDataSourceRepositoryHelmProxy(t *testing.T) { BlobStoreName: "default", StrictContentTypeValidation: true, }, + NegativeCache: repository.NegativeCache{ + Enabled: true, + TTL: 5, + }, } dataSourceName := "data.nexus_repository_helm_proxy.acceptance" diff --git a/internal/services/repository/data_source_repository_maven_proxy_test.go b/internal/services/repository/data_source_repository_maven_proxy_test.go index ac3d657c..50fc61a8 100644 --- a/internal/services/repository/data_source_repository_maven_proxy_test.go +++ b/internal/services/repository/data_source_repository_maven_proxy_test.go @@ -29,6 +29,10 @@ func TestAccDataSourceRepositoryMavenProxy(t *testing.T) { BlobStoreName: "default", StrictContentTypeValidation: true, }, + NegativeCache: repository.NegativeCache{ + Enabled: true, + TTL: 5, + }, Maven: repository.Maven{ VersionPolicy: repository.MavenVersionPolicyRelease, LayoutPolicy: repository.MavenLayoutPolicyStrict, diff --git a/internal/services/repository/data_source_repository_npm_proxy_test.go b/internal/services/repository/data_source_repository_npm_proxy_test.go index 22253643..6b707185 100644 --- a/internal/services/repository/data_source_repository_npm_proxy_test.go +++ b/internal/services/repository/data_source_repository_npm_proxy_test.go @@ -29,6 +29,10 @@ func TestAccDataSourceRepositoryNpmProxy(t *testing.T) { BlobStoreName: "default", StrictContentTypeValidation: true, }, + NegativeCache: repository.NegativeCache{ + Enabled: true, + TTL: 5, + }, Npm: &repository.Npm{ RemoveNonCataloged: false, RemoveQuarantined: true, diff --git a/internal/services/repository/data_source_repository_nuget_proxy_test.go b/internal/services/repository/data_source_repository_nuget_proxy_test.go index 63cab994..db0277c1 100644 --- a/internal/services/repository/data_source_repository_nuget_proxy_test.go +++ b/internal/services/repository/data_source_repository_nuget_proxy_test.go @@ -29,6 +29,10 @@ func TestAccDataSourceRepositoryNugetProxy(t *testing.T) { BlobStoreName: "default", StrictContentTypeValidation: true, }, + NegativeCache: repository.NegativeCache{ + Enabled: true, + TTL: 5, + }, NugetProxy: repository.NugetProxy{ NugetVersion: repository.NugetVersion2, QueryCacheItemMaxAge: 300, diff --git a/internal/services/repository/data_source_repository_p2_proxy_test.go b/internal/services/repository/data_source_repository_p2_proxy_test.go index 81ee08ea..6d5bc13d 100644 --- a/internal/services/repository/data_source_repository_p2_proxy_test.go +++ b/internal/services/repository/data_source_repository_p2_proxy_test.go @@ -29,6 +29,10 @@ func TestAccDataSourceRepositoryP2Proxy(t *testing.T) { BlobStoreName: "default", StrictContentTypeValidation: true, }, + NegativeCache: repository.NegativeCache{ + Enabled: true, + TTL: 5, + }, } dataSourceName := "data.nexus_repository_p2_proxy.acceptance" diff --git a/internal/services/repository/data_source_repository_pypi_proxy_test.go b/internal/services/repository/data_source_repository_pypi_proxy_test.go index 49443aae..b1283d84 100644 --- a/internal/services/repository/data_source_repository_pypi_proxy_test.go +++ b/internal/services/repository/data_source_repository_pypi_proxy_test.go @@ -29,6 +29,10 @@ func TestAccDataSourceRepositoryPypiProxy(t *testing.T) { BlobStoreName: "default", StrictContentTypeValidation: true, }, + NegativeCache: repository.NegativeCache{ + Enabled: true, + TTL: 5, + }, } dataSourceName := "data.nexus_repository_pypi_proxy.acceptance" diff --git a/internal/services/repository/data_source_repository_r_proxy_test.go b/internal/services/repository/data_source_repository_r_proxy_test.go index c8d6e63e..de417fa9 100644 --- a/internal/services/repository/data_source_repository_r_proxy_test.go +++ b/internal/services/repository/data_source_repository_r_proxy_test.go @@ -29,6 +29,10 @@ func TestAccDataSourceRepositoryRProxy(t *testing.T) { BlobStoreName: "default", StrictContentTypeValidation: true, }, + NegativeCache: repository.NegativeCache{ + Enabled: true, + TTL: 5, + }, } dataSourceName := "data.nexus_repository_r_proxy.acceptance" diff --git a/internal/services/repository/data_source_repository_raw_proxy_test.go b/internal/services/repository/data_source_repository_raw_proxy_test.go index a5c602ce..d23d1fda 100644 --- a/internal/services/repository/data_source_repository_raw_proxy_test.go +++ b/internal/services/repository/data_source_repository_raw_proxy_test.go @@ -29,6 +29,10 @@ func TestAccDataSourceRepositoryRawProxy(t *testing.T) { BlobStoreName: "default", StrictContentTypeValidation: true, }, + NegativeCache: repository.NegativeCache{ + Enabled: true, + TTL: 5, + }, } dataSourceName := "data.nexus_repository_raw_proxy.acceptance" diff --git a/internal/services/repository/data_source_repository_rubygems_proxy_test.go b/internal/services/repository/data_source_repository_rubygems_proxy_test.go index ece69c13..f989c516 100644 --- a/internal/services/repository/data_source_repository_rubygems_proxy_test.go +++ b/internal/services/repository/data_source_repository_rubygems_proxy_test.go @@ -29,6 +29,10 @@ func TestAccDataSourceRepositoryRubygemsProxy(t *testing.T) { BlobStoreName: "default", StrictContentTypeValidation: true, }, + NegativeCache: repository.NegativeCache{ + Enabled: true, + TTL: 5, + }, } dataSourceName := "data.nexus_repository_rubygems_proxy.acceptance" diff --git a/internal/services/repository/data_source_repository_yum_proxy_test.go b/internal/services/repository/data_source_repository_yum_proxy_test.go index 8620aff0..0fc9502c 100644 --- a/internal/services/repository/data_source_repository_yum_proxy_test.go +++ b/internal/services/repository/data_source_repository_yum_proxy_test.go @@ -29,6 +29,10 @@ func TestAccDataSourceRepositoryYumProxy(t *testing.T) { BlobStoreName: "default", StrictContentTypeValidation: true, }, + NegativeCache: repository.NegativeCache{ + Enabled: true, + TTL: 5, + }, } dataSourceName := "data.nexus_repository_yum_proxy.acceptance" From 0007ee11a55efdbe7dd2c3d8dccf288aaf77e697 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20M=C3=B6ller?= Date: Mon, 12 Aug 2024 10:28:52 +0200 Subject: [PATCH 10/11] feat: Add latest_policy to storage block of docker hosted repository (#460) related to #341 --- docs/data-sources/repository_docker_hosted.md | 3 +- docs/resources/repository_docker_hosted.md | 3 +- go.mod | 2 +- go.sum | 4 +- .../template-strings-repository-docker.go | 19 ++++- internal/schema/repository/schema_docker.go | 72 +++++++++++++++++++ .../data_source_repository_docker_hosted.go | 2 +- ...ta_source_repository_docker_hosted_test.go | 4 +- internal/services/repository/flatten.go | 15 ++++ .../resource_repository_docker_hosted.go | 13 ++-- .../resource_repository_docker_hosted_test.go | 10 +-- 11 files changed, 130 insertions(+), 17 deletions(-) diff --git a/docs/data-sources/repository_docker_hosted.md b/docs/data-sources/repository_docker_hosted.md index c1a7c92a..7bc1f1b8 100644 --- a/docs/data-sources/repository_docker_hosted.md +++ b/docs/data-sources/repository_docker_hosted.md @@ -26,7 +26,7 @@ data "nexus_repository_docker_hosted" "example" { - `docker` (List of Object) docker contains the configuration of the docker repository (see [below for nested schema](#nestedatt--docker)) - `id` (String) Used to identify data source at nexus - `online` (Boolean) Whether this repository accepts incoming requests -- `storage` (List of Object) The storage configuration of the repository (see [below for nested schema](#nestedatt--storage)) +- `storage` (List of Object) The storage configuration of the repository docker hosted (see [below for nested schema](#nestedatt--storage)) ### Nested Schema for `cleanup` @@ -62,5 +62,6 @@ Read-Only: Read-Only: - `blob_store_name` (String) +- `latest_policy` (Boolean) - `strict_content_type_validation` (Boolean) - `write_policy` (String) diff --git a/docs/resources/repository_docker_hosted.md b/docs/resources/repository_docker_hosted.md index 889095ba..3ae6e8a1 100644 --- a/docs/resources/repository_docker_hosted.md +++ b/docs/resources/repository_docker_hosted.md @@ -32,7 +32,7 @@ resource "nexus_repository_docker_hosted" "example" { - `docker` (Block List, Min: 1, Max: 1) docker contains the configuration of the docker repository (see [below for nested schema](#nestedblock--docker)) - `name` (String) A unique identifier for this repository -- `storage` (Block List, Min: 1, Max: 1) The storage configuration of the repository (see [below for nested schema](#nestedblock--storage)) +- `storage` (Block List, Min: 1, Max: 1) The storage configuration of the repository docker hosted (see [below for nested schema](#nestedblock--storage)) ### Optional @@ -69,6 +69,7 @@ Required: Optional: +- `latest_policy` (Boolean) Whether to allow redeploying the 'latest' tag but defer to the Deployment Policy for all other tags. Only usable with write_policy "ALLOW_ONCE" - `write_policy` (String) Controls if deployments of and updates to assets are allowed diff --git a/go.mod b/go.mod index f6a0e710..fca9dd24 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ toolchain go1.21.1 require ( github.com/client9/misspell v0.3.4 - github.com/datadrivers/go-nexus-client v1.11.0 + github.com/datadrivers/go-nexus-client v1.12.0 github.com/golangci/golangci-lint v1.59.1 github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 github.com/hashicorp/terraform-plugin-docs v0.19.4 diff --git a/go.sum b/go.sum index fff68975..f1d7de50 100644 --- a/go.sum +++ b/go.sum @@ -156,8 +156,8 @@ github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53E github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/daixiang0/gci v0.13.4 h1:61UGkmpoAcxHM2hhNkZEf5SzwQtWJXTSws7jaPyqwlw= github.com/daixiang0/gci v0.13.4/go.mod h1:12etP2OniiIdP4q+kjUGrC/rUagga7ODbqsom5Eo5Yk= -github.com/datadrivers/go-nexus-client v1.11.0 h1:fTmBYPzPBLL8v1LQOc8Fyzz40lHDl3Bm3ofvpNdHRro= -github.com/datadrivers/go-nexus-client v1.11.0/go.mod h1:sPjBOxF7idUoiJoa730L3JyKZodjT0LDAvVF8u4kOLU= +github.com/datadrivers/go-nexus-client v1.12.0 h1:ZBoTNAxdWbPs5gYZemJ+HLfk/8xt7aZyPtI1/R7ahag= +github.com/datadrivers/go-nexus-client v1.12.0/go.mod h1:sPjBOxF7idUoiJoa730L3JyKZodjT0LDAvVF8u4kOLU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/internal/acceptance/template-strings-repository-docker.go b/internal/acceptance/template-strings-repository-docker.go index 7cc28165..b74b3b54 100644 --- a/internal/acceptance/template-strings-repository-docker.go +++ b/internal/acceptance/template-strings-repository-docker.go @@ -16,7 +16,11 @@ resource "nexus_repository_docker_hosted" "acceptance" { {{- end }} v1_enabled = "{{ .Docker.V1Enabled }}" } -` + TemplateStringHostedRepository +` + TemplateStringNameOnline + + TemplateStringCleanup + + TemplateStringComponent + + TemplateStringDockerStorageHosted + + TemplateStringEnd TemplateStringRepositoryDockerGroup = ` resource "nexus_repository_docker_group" "acceptance" { @@ -61,4 +65,17 @@ resource "nexus_repository_docker_proxy" "acceptance" { {{- end }} } ` + TemplateStringProxyRepository + + TemplateStringDockerStorageHosted = ` +storage { + blob_store_name = "{{ .Storage.BlobStoreName }}" + strict_content_type_validation = {{ .Storage.StrictContentTypeValidation }} + {{- if .Storage.WritePolicy }} + write_policy = "{{ .Storage.WritePolicy }}" + {{- end }} + {{- if .Storage.LatestPolicy }} + latest_policy = "{{ .Storage.LatestPolicy }}" + {{- end }} +} +` ) diff --git a/internal/schema/repository/schema_docker.go b/internal/schema/repository/schema_docker.go index d73d2a58..23c950e3 100644 --- a/internal/schema/repository/schema_docker.go +++ b/internal/schema/repository/schema_docker.go @@ -1,7 +1,10 @@ package repository import ( + "strings" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) var ( @@ -74,4 +77,73 @@ var ( }, }, } + + ResourceDockerHostedStorage = &schema.Schema{ + Description: "The storage configuration of the repository docker hosted", + Type: schema.TypeList, + Required: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "blob_store_name": { + Description: "Blob store used to store repository contents", + Required: true, + Set: func(v interface{}) int { + return schema.HashString(strings.ToLower(v.(string))) + }, + Type: schema.TypeString, + }, + "strict_content_type_validation": { + Description: "Whether to validate uploaded content's MIME type appropriate for the repository format", + Required: true, + Type: schema.TypeBool, + }, + "write_policy": { + Description: "Controls if deployments of and updates to assets are allowed", + Default: "ALLOW", + Optional: true, + Type: schema.TypeString, + ValidateFunc: validation.StringInSlice([]string{ + "ALLOW", + "ALLOW_ONCE", + "DENY", + }, false), + }, + "latest_policy": { + Description: "Whether to allow redeploying the 'latest' tag but defer to the Deployment Policy for all other tags. Only usable with write_policy \"ALLOW_ONCE\"", + Optional: true, + Type: schema.TypeBool, + }, + }, + }, + } + DataSourceDockerHostedStorage = &schema.Schema{ + Description: "The storage configuration of the repository docker hosted", + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "blob_store_name": { + Description: "Blob store used to store repository contents", + Computed: true, + Type: schema.TypeString, + }, + "strict_content_type_validation": { + Description: "Whether to validate uploaded content's MIME type appropriate for the repository format", + Computed: true, + Type: schema.TypeBool, + }, + "write_policy": { + Description: "Controls if deployments of and updates to assets are allowed", + Computed: true, + Type: schema.TypeString, + }, + "latest_policy": { + Description: "Whether to allow redeploying the 'latest' tag but defer to the Deployment Policy for all other tags. Only usable with write_policy \"ALLOW_ONCE\"", + Computed: true, + Type: schema.TypeBool, + }, + }, + }, + } ) diff --git a/internal/services/repository/data_source_repository_docker_hosted.go b/internal/services/repository/data_source_repository_docker_hosted.go index 5f9750e6..814ecdad 100644 --- a/internal/services/repository/data_source_repository_docker_hosted.go +++ b/internal/services/repository/data_source_repository_docker_hosted.go @@ -19,7 +19,7 @@ func DataSourceRepositoryDockerHosted() *schema.Resource { // Hosted schemas "cleanup": repository.DataSourceCleanup, "component": repository.DataSourceComponent, - "storage": repository.DataSourceHostedStorage, + "storage": repository.DataSourceDockerHostedStorage, // Docker hosted schemas "docker": repository.DataSourceDocker, }, diff --git a/internal/services/repository/data_source_repository_docker_hosted_test.go b/internal/services/repository/data_source_repository_docker_hosted_test.go index bf3c7bc2..1a38a131 100644 --- a/internal/services/repository/data_source_repository_docker_hosted_test.go +++ b/internal/services/repository/data_source_repository_docker_hosted_test.go @@ -28,9 +28,10 @@ func TestAccDataSourceRepositoryDockerHosted(t *testing.T) { repo := repository.DockerHostedRepository{ Name: name, Online: true, - Storage: repository.HostedStorage{ + Storage: repository.DockerHostedStorage{ BlobStoreName: "default", StrictContentTypeValidation: false, + WritePolicy: "ALLOW", }, Docker: repository.Docker{ ForceBasicAuth: true, @@ -56,6 +57,7 @@ func TestAccDataSourceRepositoryDockerHosted(t *testing.T) { resource.TestCheckResourceAttr(dataSourceName, "docker.0.v1_enabled", strconv.FormatBool(repo.Docker.V1Enabled)), resource.TestCheckResourceAttr(dataSourceName, "storage.0.blob_store_name", repo.Storage.BlobStoreName), resource.TestCheckResourceAttr(dataSourceName, "storage.0.strict_content_type_validation", strconv.FormatBool(repo.Storage.StrictContentTypeValidation)), + resource.TestCheckResourceAttr(dataSourceName, "storage.0.write_policy", string(repo.Storage.WritePolicy)), ), ), }, diff --git a/internal/services/repository/flatten.go b/internal/services/repository/flatten.go index 07c8a915..86fc00df 100644 --- a/internal/services/repository/flatten.go +++ b/internal/services/repository/flatten.go @@ -212,6 +212,21 @@ func flattenHostedStorage(storage *repository.HostedStorage) []map[string]interf return []map[string]interface{}{data} } +func flattenDockerHostedStorage(dockerStorage *repository.DockerHostedStorage) []map[string]interface{} { + if dockerStorage == nil { + return nil + } + data := map[string]interface{}{ + "blob_store_name": dockerStorage.BlobStoreName, + "strict_content_type_validation": dockerStorage.StrictContentTypeValidation, + "write_policy": dockerStorage.WritePolicy, + } + if dockerStorage.LatestPolicy != nil { + data["latest_policy"] = dockerStorage.LatestPolicy + } + return []map[string]interface{}{data} +} + func flattenMaven(maven *repository.Maven) []map[string]interface{} { data := map[string]interface{}{ "version_policy": maven.VersionPolicy, diff --git a/internal/services/repository/resource_repository_docker_hosted.go b/internal/services/repository/resource_repository_docker_hosted.go index 901b0d3d..597c4201 100644 --- a/internal/services/repository/resource_repository_docker_hosted.go +++ b/internal/services/repository/resource_repository_docker_hosted.go @@ -30,7 +30,7 @@ func ResourceRepositoryDockerHosted() *schema.Resource { // Hosted schemas "cleanup": repositorySchema.ResourceCleanup, "component": repositorySchema.ResourceComponent, - "storage": repositorySchema.ResourceHostedStorage, + "storage": repositorySchema.ResourceDockerHostedStorage, // Docker hosted schemas "docker": repositorySchema.ResourceDocker, }, @@ -39,16 +39,15 @@ func ResourceRepositoryDockerHosted() *schema.Resource { func getDockerHostedRepositoryFromResourceData(resourceData *schema.ResourceData) repository.DockerHostedRepository { storageConfig := resourceData.Get("storage").([]interface{})[0].(map[string]interface{}) - writePolicy := repository.StorageWritePolicy(storageConfig["write_policy"].(string)) dockerConfig := resourceData.Get("docker").([]interface{})[0].(map[string]interface{}) repo := repository.DockerHostedRepository{ Name: resourceData.Get("name").(string), Online: resourceData.Get("online").(bool), - Storage: repository.HostedStorage{ + Storage: repository.DockerHostedStorage{ BlobStoreName: storageConfig["blob_store_name"].(string), StrictContentTypeValidation: storageConfig["strict_content_type_validation"].(bool), - WritePolicy: &writePolicy, + WritePolicy: repository.StorageWritePolicy(storageConfig["write_policy"].(string)), }, Docker: repository.Docker{ ForceBasicAuth: dockerConfig["force_basic_auth"].(bool), @@ -56,6 +55,10 @@ func getDockerHostedRepositoryFromResourceData(resourceData *schema.ResourceData }, } + if latestPolicy, ok := storageConfig["latest_policy"]; ok { + repo.Storage.LatestPolicy = tools.GetBoolPointer(latestPolicy.(bool)) + } + if httpPort, ok := dockerConfig["http_port"]; ok { if httpPort.(int) > 0 { repo.Docker.HTTPPort = tools.GetIntPointer(httpPort.(int)) @@ -109,7 +112,7 @@ func setDockerHostedRepositoryToResourceData(repo *repository.DockerHostedReposi return err } - if err := resourceData.Set("storage", flattenHostedStorage(&repo.Storage)); err != nil { + if err := resourceData.Set("storage", flattenDockerHostedStorage(&repo.Storage)); err != nil { return err } diff --git a/internal/services/repository/resource_repository_docker_hosted_test.go b/internal/services/repository/resource_repository_docker_hosted_test.go index b369e9df..a245f633 100644 --- a/internal/services/repository/resource_repository_docker_hosted_test.go +++ b/internal/services/repository/resource_repository_docker_hosted_test.go @@ -16,7 +16,7 @@ import ( ) func testAccResourceRepositoryDockerHosted(name string) repository.DockerHostedRepository { - writePolicy := repository.StorageWritePolicyAllow + latestPolicy := true return repository.DockerHostedRepository{ Name: name, @@ -27,10 +27,11 @@ func testAccResourceRepositoryDockerHosted(name string) repository.DockerHostedR HTTPSPort: tools.GetIntPointer(rand.Intn(999) + 33000), V1Enabled: false, }, - Storage: repository.HostedStorage{ + Storage: repository.DockerHostedStorage{ BlobStoreName: "default", StrictContentTypeValidation: true, - WritePolicy: &writePolicy, + WritePolicy: repository.StorageWritePolicyAllowOnce, + LatestPolicy: &latestPolicy, }, Cleanup: &repository.Cleanup{ PolicyNames: []string{"cleanup-weekly"}, @@ -77,7 +78,8 @@ func TestAccResourceRepositoryDockerHosted(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "storage.#", "1"), resource.TestCheckResourceAttr(resourceName, "storage.0.blob_store_name", repo.Storage.BlobStoreName), resource.TestCheckResourceAttr(resourceName, "storage.0.strict_content_type_validation", strconv.FormatBool(repo.Storage.StrictContentTypeValidation)), - resource.TestCheckResourceAttr(resourceName, "storage.0.write_policy", string(*repo.Storage.WritePolicy)), + resource.TestCheckResourceAttr(resourceName, "storage.0.write_policy", string(repo.Storage.WritePolicy)), + resource.TestCheckResourceAttr(resourceName, "storage.0.latest_policy", strconv.FormatBool(*repo.Storage.LatestPolicy)), resource.TestCheckResourceAttr(resourceName, "cleanup.#", "1"), resource.TestCheckResourceAttr(resourceName, "cleanup.0.policy_names.#", "1"), resource.TestCheckResourceAttr(resourceName, "cleanup.0.policy_names.0", repo.Cleanup.PolicyNames[0]), From 24a1eb20e154e180e477d96a2a1207709760f235 Mon Sep 17 00:00:00 2001 From: Alex Shearn <244545+shearn89@users.noreply.github.com> Date: Mon, 12 Aug 2024 12:51:00 +0100 Subject: [PATCH 11/11] Add support for mutual authentication via TLS (#459) Prior to this change, there was no way to pass in a client certificate if you had set up Nexus behind a load balancer with mutual auth configured. This change exposes some new configuration values that allow you to pass in a path to a file on disk containing your client key/cert (which can be in a single file) and optionally a Root CA. --- README.md | 29 +++++++++++++++++++++++++---- internal/provider/main.go | 34 +++++++++++++++++++++++++++++----- 2 files changed, 54 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 57b13aca..dd658bd9 100644 --- a/README.md +++ b/README.md @@ -27,13 +27,34 @@ Implemented and tested with Sonatype Nexus `3.70.1-02`. ```hcl provider "nexus" { - insecure = true - password = "admin123" - url = "https://127.0.0.1:8080" - username = "admin" + insecure = true + password = "admin123" + url = "https://127.0.0.1:8080" + username = "admin" } ``` +Optionally with mTLS if Nexus is deployed behind a reverse proxy: + +```hcl +provider "nexus" { + insecure = true + password = "admin123" + url = "https://127.0.0.1:8080" + username = "admin" + client_cert_path = "/path/to/client.crt" + client_key_path = "/path/to/client.key" + root_ca_path = "/path/to/root_ca.crt" +} +``` + +Note that the `root_ca_path` should contain ALL certificates required for +communication. It overrides the system CA store, rather than adding to it. + +You can point the `root_ca_path` to the system trust store if required, e.g.: + +`root_ca_path = "/etc/ssl/certs/ca-certificates.crt"` + ## Development ### Build diff --git a/internal/provider/main.go b/internal/provider/main.go index 6bb79628..0b0b70e3 100755 --- a/internal/provider/main.go +++ b/internal/provider/main.go @@ -178,6 +178,24 @@ func Provider() *schema.Provider { Optional: true, Type: schema.TypeInt, }, + "client_cert_path": { + Description: "Path to a client PEM certificate to load for mTLS. Reading environment variable NEXUS_CLIENT_CERT_PATH. Default:``", + DefaultFunc: schema.EnvDefaultFunc("NEXUS_CLIENT_CERT_PATH", ""), + Optional: true, + Type: schema.TypeString, + }, + "client_key_path": { + Description: "Path to a client PEM key to load for mTLS. Reading environment variable NEXUS_CLIENT_KEY_PATH. Default:``", + DefaultFunc: schema.EnvDefaultFunc("NEXUS_CLIENT_KEY_PATH", ""), + Optional: true, + Type: schema.TypeString, + }, + "root_ca_path": { + Description: "Path to a root CA certificate to load for mTLS. Reading environment variable NEXUS_ROOT_CA_PATH. Default:``", + DefaultFunc: schema.EnvDefaultFunc("NEXUS_ROOT_CA_PATH", ""), + Optional: true, + Type: schema.TypeString, + }, }, ConfigureFunc: providerConfigure, } @@ -185,12 +203,18 @@ func Provider() *schema.Provider { func providerConfigure(d *schema.ResourceData) (interface{}, error) { timeout := d.Get("timeout").(int) + clientCertPath := d.Get("client_cert_path").(string) + clientKeyPath := d.Get("client_key_path").(string) + rootCaPath := d.Get("root_ca_path").(string) config := client.Config{ - Insecure: d.Get("insecure").(bool), - Password: d.Get("password").(string), - URL: d.Get("url").(string), - Username: d.Get("username").(string), - Timeout: &timeout, + Insecure: d.Get("insecure").(bool), + Password: d.Get("password").(string), + URL: d.Get("url").(string), + Username: d.Get("username").(string), + Timeout: &timeout, + ClientCertificatePath: &clientCertPath, + ClientKeyPath: &clientKeyPath, + RootCAPath: &rootCaPath, } return nexus.NewClient(config), nil