diff --git a/CHANGELOG.md b/CHANGELOG.md index 1656a2d2a..f69e16a6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 12.2.0 (October 14, 2024). Tested on Artifactory 7.90.14 with Terraform 1.9.7 and OpenTofu 1.8.3 + +IMPROVEMENTS: + +* resource/artifactory_local_repository_multi_replication: Add `disable_proxy` attribute to `replication` to support not using proxy. Issue: [#1088](https://github.com/jfrog/terraform-provider-artifactory/issues/1088) PR: [#1095](https://github.com/jfrog/terraform-provider-artifactory/pull/1095) + ## 12.1.1 (October 2, 2024). Tested on Artifactory 7.90.13 with Terraform 1.9.6 and OpenTofu 1.8.2 IMPROVEMENTS: diff --git a/docs/resources/local_repository_multi_replication.md b/docs/resources/local_repository_multi_replication.md index 1fefd9859..0182d7a8c 100644 --- a/docs/resources/local_repository_multi_replication.md +++ b/docs/resources/local_repository_multi_replication.md @@ -11,7 +11,7 @@ See the [Official Documentation](https://www.jfrog.com/confluence/display/JFROG/ This resource replaces `artifactory_push_replication` and used to create a replication of one local repository to multiple repositories on the remote server. -~> This resource requires Artifactory Enterprise license. Use `artifactory_local_repository_single_replication` with other licenses. +~>This resource requires Artifactory Enterprise license. Use `artifactory_local_repository_single_replication` with other licenses. ## Example Usage @@ -55,12 +55,13 @@ resource "artifactory_local_repository_multi_replication" "foo-rep" { password = "$var.artifactory_password" enabled = true } - replication { - url = "${var.artifactory_url}/artifactory/${artifactory_local_maven_repository.provider_test_dest1.key}" - username = "$var.artifactory_username" - password = "$var.artifactory_password" - enabled = true - } + + replication { + url = "${var.artifactory_url}/artifactory/${artifactory_local_maven_repository.provider_test_dest1.key}" + username = "$var.artifactory_username" + password = "$var.artifactory_password" + enabled = true + } } ``` @@ -83,6 +84,7 @@ The following arguments are supported: * `include_path_prefix_pattern` - (Optional) List of artifact patterns to include when evaluating artifact requests in the form of `x/y/**/z/*`. When used, only artifacts matching one of the include patterns are served. By default, all artifacts are included `(**/*)`. * `exclude_path_prefix_pattern` - (Optional) List of artifact patterns to exclude when evaluating artifact requests, in the form of `x/y/**/z/*`. By default, no artifacts are excluded. * `proxy` - (Optional) Proxy key from Artifactory Proxies settings. The proxy configuration will be used when communicating with the remote instance. + * `disable_proxy` - (Optional) When set to `true`, the `proxy` attribute will be ignored (from version 7.41.7). The default value is `false`. * `replication_key` - (Computed) Replication ID, the value is unknown until the resource is created. Can't be set or updated. * `check_binary_existence_in_filestore` - (Optional) Enabling the `check_binary_existence_in_filestore` flag requires an Enterprise Plus license. When true, enables distributed checksum storage. For more information, see [Optimizing Repository Replication with Checksum-Based Storage](https://www.jfrog.com/confluence/display/JFROG/Repository+Replication#RepositoryReplication-OptimizingRepositoryReplicationUsingStorageLevelSynchronizationOptions). diff --git a/pkg/artifactory/resource/replication/resource_artifactory_local_repository_multi_replication.go b/pkg/artifactory/resource/replication/resource_artifactory_local_repository_multi_replication.go index 27d9ea3a2..ec18a2f9c 100644 --- a/pkg/artifactory/resource/replication/resource_artifactory_local_repository_multi_replication.go +++ b/pkg/artifactory/resource/replication/resource_artifactory_local_repository_multi_replication.go @@ -69,7 +69,8 @@ func (m LocalRepositoryMultiReplicationResourceModel) toAPIModel(_ context.Conte ExcludePathPrefixPattern: attrs["exclude_path_prefix_pattern"].(types.String).ValueString(), CheckBinaryExistenceInFilestore: attrs["check_binary_existence_in_filestore"].(types.Bool).ValueBool(), }, - Proxy: attrs["proxy"].(types.String).ValueString(), + Proxy: attrs["proxy"].(types.String).ValueString(), + DisableProxy: attrs["disable_proxy"].(types.Bool).ValueBool(), } }, ) @@ -96,6 +97,7 @@ var replicationResourceModelAttributeTypes map[string]attr.Type = map[string]att "exclude_path_prefix_pattern": types.StringType, "check_binary_existence_in_filestore": types.BoolType, "proxy": types.StringType, + "disable_proxy": types.BoolType, "replication_key": types.StringType, } @@ -143,6 +145,7 @@ func (m *LocalRepositoryMultiReplicationResourceModel) fromAPIModel(_ context.Co "exclude_path_prefix_pattern": types.StringValue(replication.ExcludePathPrefixPattern), "check_binary_existence_in_filestore": types.BoolValue(replication.CheckBinaryExistenceInFilestore), "proxy": types.StringValue(replication.ProxyRef), + "disable_proxy": types.BoolValue(replication.DisableProxy), "replication_key": types.StringValue(replication.ReplicationKey), }, ) @@ -189,11 +192,13 @@ type ReplicationGetAPIModel struct { ReplicationAPIModel ProxyRef string `json:"proxyRef"` ReplicationKey string `json:"replicationKey"` + DisableProxy bool `json:"disableProxy"` } type ReplicationUpdateAPIModel struct { ReplicationAPIModel - Proxy string `json:"proxy"` + Proxy string `json:"proxy"` + DisableProxy bool `json:"disableProxy"` } type LocalMultiReplicationUpdateAPIModel struct { @@ -208,6 +213,7 @@ func (r *LocalRepositoryMultiReplicationResource) Metadata(ctx context.Context, func (r *LocalRepositoryMultiReplicationResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { resp.Schema = schema.Schema{ + Version: 0, Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, @@ -325,6 +331,12 @@ func (r *LocalRepositoryMultiReplicationResource) Schema(ctx context.Context, re }, Description: "A proxy configuration to use when communicating with the remote instance.", }, + "disable_proxy": schema.BoolAttribute{ + Optional: true, + Computed: true, + Default: booldefault.StaticBool(false), + MarkdownDescription: "When set to `true`, the `proxy` attribute will be ignored (from version 7.41.7). The default value is `false`.", + }, "replication_key": schema.StringAttribute{ Computed: true, Description: "Replication ID. The ID is known only after the replication is created, for this reason it's `Computed` and can not be set by the user in HCL.", diff --git a/pkg/artifactory/resource/replication/resource_artifactory_local_repository_multi_replication_test.go b/pkg/artifactory/resource/replication/resource_artifactory_local_repository_multi_replication_test.go index d09005121..37a623d33 100644 --- a/pkg/artifactory/resource/replication/resource_artifactory_local_repository_multi_replication_test.go +++ b/pkg/artifactory/resource/replication/resource_artifactory_local_repository_multi_replication_test.go @@ -266,7 +266,7 @@ func TestAccLocalMultiReplication_full(t *testing.T) { url = "https://dummyurl.com/" username = "{{ .username }}" password = "Passw0rd!" - proxy = artifactory_proxy.{{ .proxy }}.key + disable_proxy = true enabled = false socket_timeout_millis = 16000 sync_deletes = true @@ -312,7 +312,7 @@ func TestAccLocalMultiReplication_full(t *testing.T) { resource.TestCheckResourceAttr(fqrn, "replication.0.check_binary_existence_in_filestore", "true"), resource.TestCheckResourceAttr(fqrn, "replication.1.username", acctest.RtDefaultUser), resource.TestCheckResourceAttr(fqrn, "replication.1.password", "Passw0rd!"), - resource.TestCheckResourceAttr(fqrn, "replication.1.proxy", testProxy), + resource.TestCheckResourceAttr(fqrn, "replication.1.disable_proxy", "true"), resource.TestCheckResourceAttr(fqrn, "replication.1.enabled", "false"), resource.TestCheckResourceAttr(fqrn, "replication.1.check_binary_existence_in_filestore", "true"), resource.TestCheckTypeSetElemAttr(fqrn, "replication.*.*", acctest.GetArtifactoryUrl(t)),