Skip to content

Commit 8e1e80d

Browse files
authored
Merge pull request #1095 from jfrog/GH-1088-add-disable-proxy-attribute-to-replication
Add 'disable_proxy' attribute to artifactory_local_repository_multi_replication to support not using proxy
2 parents 86eb867 + 3adfec6 commit 8e1e80d

4 files changed

+31
-11
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 12.2.0 (October 14, 2024). Tested on Artifactory 7.90.14 with Terraform 1.9.7 and OpenTofu 1.8.3
2+
3+
IMPROVEMENTS:
4+
5+
* 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)
6+
17
## 12.1.1 (October 2, 2024). Tested on Artifactory 7.90.13 with Terraform 1.9.6 and OpenTofu 1.8.2
28

39
IMPROVEMENTS:

docs/resources/local_repository_multi_replication.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ See the [Official Documentation](https://www.jfrog.com/confluence/display/JFROG/
1111

1212
This resource replaces `artifactory_push_replication` and used to create a replication of one local repository to multiple repositories on the remote server.
1313

14-
~> This resource requires Artifactory Enterprise license. Use `artifactory_local_repository_single_replication` with other licenses.
14+
~>This resource requires Artifactory Enterprise license. Use `artifactory_local_repository_single_replication` with other licenses.
1515

1616
## Example Usage
1717

@@ -55,12 +55,13 @@ resource "artifactory_local_repository_multi_replication" "foo-rep" {
5555
password = "$var.artifactory_password"
5656
enabled = true
5757
}
58-
replication {
59-
url = "${var.artifactory_url}/artifactory/${artifactory_local_maven_repository.provider_test_dest1.key}"
60-
username = "$var.artifactory_username"
61-
password = "$var.artifactory_password"
62-
enabled = true
63-
}
58+
59+
replication {
60+
url = "${var.artifactory_url}/artifactory/${artifactory_local_maven_repository.provider_test_dest1.key}"
61+
username = "$var.artifactory_username"
62+
password = "$var.artifactory_password"
63+
enabled = true
64+
}
6465
}
6566
```
6667

@@ -83,6 +84,7 @@ The following arguments are supported:
8384
* `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 `(**/*)`.
8485
* `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.
8586
* `proxy` - (Optional) Proxy key from Artifactory Proxies settings. The proxy configuration will be used when communicating with the remote instance.
87+
* `disable_proxy` - (Optional) When set to `true`, the `proxy` attribute will be ignored (from version 7.41.7). The default value is `false`.
8688
* `replication_key` - (Computed) Replication ID, the value is unknown until the resource is created. Can't be set or updated.
8789
* `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).
8890

pkg/artifactory/resource/replication/resource_artifactory_local_repository_multi_replication.go

+14-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ func (m LocalRepositoryMultiReplicationResourceModel) toAPIModel(_ context.Conte
6969
ExcludePathPrefixPattern: attrs["exclude_path_prefix_pattern"].(types.String).ValueString(),
7070
CheckBinaryExistenceInFilestore: attrs["check_binary_existence_in_filestore"].(types.Bool).ValueBool(),
7171
},
72-
Proxy: attrs["proxy"].(types.String).ValueString(),
72+
Proxy: attrs["proxy"].(types.String).ValueString(),
73+
DisableProxy: attrs["disable_proxy"].(types.Bool).ValueBool(),
7374
}
7475
},
7576
)
@@ -96,6 +97,7 @@ var replicationResourceModelAttributeTypes map[string]attr.Type = map[string]att
9697
"exclude_path_prefix_pattern": types.StringType,
9798
"check_binary_existence_in_filestore": types.BoolType,
9899
"proxy": types.StringType,
100+
"disable_proxy": types.BoolType,
99101
"replication_key": types.StringType,
100102
}
101103

@@ -143,6 +145,7 @@ func (m *LocalRepositoryMultiReplicationResourceModel) fromAPIModel(_ context.Co
143145
"exclude_path_prefix_pattern": types.StringValue(replication.ExcludePathPrefixPattern),
144146
"check_binary_existence_in_filestore": types.BoolValue(replication.CheckBinaryExistenceInFilestore),
145147
"proxy": types.StringValue(replication.ProxyRef),
148+
"disable_proxy": types.BoolValue(replication.DisableProxy),
146149
"replication_key": types.StringValue(replication.ReplicationKey),
147150
},
148151
)
@@ -189,11 +192,13 @@ type ReplicationGetAPIModel struct {
189192
ReplicationAPIModel
190193
ProxyRef string `json:"proxyRef"`
191194
ReplicationKey string `json:"replicationKey"`
195+
DisableProxy bool `json:"disableProxy"`
192196
}
193197

194198
type ReplicationUpdateAPIModel struct {
195199
ReplicationAPIModel
196-
Proxy string `json:"proxy"`
200+
Proxy string `json:"proxy"`
201+
DisableProxy bool `json:"disableProxy"`
197202
}
198203

199204
type LocalMultiReplicationUpdateAPIModel struct {
@@ -208,6 +213,7 @@ func (r *LocalRepositoryMultiReplicationResource) Metadata(ctx context.Context,
208213

209214
func (r *LocalRepositoryMultiReplicationResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
210215
resp.Schema = schema.Schema{
216+
Version: 0,
211217
Attributes: map[string]schema.Attribute{
212218
"id": schema.StringAttribute{
213219
Computed: true,
@@ -325,6 +331,12 @@ func (r *LocalRepositoryMultiReplicationResource) Schema(ctx context.Context, re
325331
},
326332
Description: "A proxy configuration to use when communicating with the remote instance.",
327333
},
334+
"disable_proxy": schema.BoolAttribute{
335+
Optional: true,
336+
Computed: true,
337+
Default: booldefault.StaticBool(false),
338+
MarkdownDescription: "When set to `true`, the `proxy` attribute will be ignored (from version 7.41.7). The default value is `false`.",
339+
},
328340
"replication_key": schema.StringAttribute{
329341
Computed: true,
330342
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.",

pkg/artifactory/resource/replication/resource_artifactory_local_repository_multi_replication_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ func TestAccLocalMultiReplication_full(t *testing.T) {
266266
url = "https://dummyurl.com/"
267267
username = "{{ .username }}"
268268
password = "Passw0rd!"
269-
proxy = artifactory_proxy.{{ .proxy }}.key
269+
disable_proxy = true
270270
enabled = false
271271
socket_timeout_millis = 16000
272272
sync_deletes = true
@@ -312,7 +312,7 @@ func TestAccLocalMultiReplication_full(t *testing.T) {
312312
resource.TestCheckResourceAttr(fqrn, "replication.0.check_binary_existence_in_filestore", "true"),
313313
resource.TestCheckResourceAttr(fqrn, "replication.1.username", acctest.RtDefaultUser),
314314
resource.TestCheckResourceAttr(fqrn, "replication.1.password", "Passw0rd!"),
315-
resource.TestCheckResourceAttr(fqrn, "replication.1.proxy", testProxy),
315+
resource.TestCheckResourceAttr(fqrn, "replication.1.disable_proxy", "true"),
316316
resource.TestCheckResourceAttr(fqrn, "replication.1.enabled", "false"),
317317
resource.TestCheckResourceAttr(fqrn, "replication.1.check_binary_existence_in_filestore", "true"),
318318
resource.TestCheckTypeSetElemAttr(fqrn, "replication.*.*", acctest.GetArtifactoryUrl(t)),

0 commit comments

Comments
 (0)