Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
### 12.11.4 (Mar 20, 2026). Tested on Artifactory 7.133.15 with Terraform 1.14.7 and OpenTofu 1.11.5
### 12.11.4 (Apr 27, 2026).

IMPROVEMENTS:

* resource/artifactory_ldap_group_setting_v2: Add `refresh_operation` attribute to allow users to configure how LDAP groups are refreshed (UPDATE, IMPORT, or UPDATE_AND_IMPORT) after resource creation or update. PR: [#1377](https://github.com/jfrog/terraform-provider-artifactory/pull/1377)
* resource/artifactory_archive_policy, resource/artifactory_package_cleanup_policy: Relax search criteria validation so **time-based** conditions (days or months) and **properties-based** conditions (`included_properties`) can be used together. **Version-based** condition (`keep_last_n_versions`) remains mutually exclusive and cannot be combined with time-based or properties-based conditions. For package cleanup policies, combined time + properties behavior follows Artifactory **7.129+** (AND semantics). JTFPR-173.
* resource/artifactory_remote_vcs_repository: Add `GITLAB` and `GITHUBENTERPRISE` to `vcs_git_provider` validation. Artifactory supports proxying GitLab and GitHub Enterprise in addition to existing providers; the attribute description was updated to list all supported providers. PR: [#1383](https://github.com/jfrog/terraform-provider-artifactory/pull/1383)


### 12.11.3 (Feb 11, 2026). Tested on Artifactory 7.133.8 with Terraform 1.14.4 and OpenTofu 1.11.4

FEATURES:
Expand Down
6 changes: 5 additions & 1 deletion docs/resources/ldap_group_setting_v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
page_title: "artifactory_ldap_group_setting_v2 Resource - terraform-provider-artifactory"
subcategory: "Configuration"
---

# Artifactory Ldap Group Setting v2 Resource

Provides an Artifactory LDAP Setting resource.
Provides an Artifactory LDAP Setting resource.

This resource can be used to manage Artifactory's LDAP Group settings for user authentication.

Expand All @@ -28,12 +29,14 @@ resource "artifactory_ldap_group_setting_v2" "ldap_group_name" {
filter = "(objectClass=groupOfNames)"
description_attribute = "description"
strategy = "STATIC"
refresh_operation = "UPDATE_AND_IMPORT"
}
```

## Argument reference

<!-- schema generated by tfplugindocs -->

## Schema

### Required
Expand All @@ -51,6 +54,7 @@ resource "artifactory_ldap_group_setting_v2" "ldap_group_name" {
- `force_attribute_search` (Boolean) This attribute is used in very specific cases of LDAP group settings. Don't switch it to `false`, unless instructed by the JFrog support team. Default value is `false`.
- `group_base_dn` (String) A search base for group entry DNs, relative to the DN on the LDAP server’s URL (and not relative to the LDAP Setting’s “Search Base”). Used when importing groups.
- `sub_tree` (Boolean) When set, enables deep search through the sub-tree of the LDAP URL + Search Base. `true` by default. `sub_tree` can be set to true only with `STATIC` or `DYNAMIC` strategy.
- `refresh_operation` (String) Operation used when refreshing LDAP groups after create/update. Valid values: `UPDATE`, `IMPORT`, `UPDATE_AND_IMPORT`. Defaults to `UPDATE_AND_IMPORT`.

### Read-Only

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ resource "artifactory_ldap_group_setting_v2" "ldap_group_name" {
filter = "(objectClass=groupOfNames)"
description_attribute = "description"
strategy = "STATIC"
}
refresh_operation = "UPDATE_AND_IMPORT"
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ type ArtifactoryLdapGroupSettingResourceModel struct {
Filter types.String `tfsdk:"filter"`
DescriptionAttribute types.String `tfsdk:"description_attribute"`
Strategy types.String `tfsdk:"strategy"`
RefreshOperation types.String `tfsdk:"refresh_operation"`
}

// ArtifactoryLdapGroupSettingResourceAPIModel describes the API data model.
Expand Down Expand Up @@ -154,6 +155,18 @@ func (r *ArtifactoryLdapGroupSettingResource) Schema(ctx context.Context, req re
stringvalidator.OneOf("STATIC", "DYNAMIC", "HIERARCHICAL"),
},
},
"refresh_operation": schema.StringAttribute{
MarkdownDescription: "Operation used when refreshing LDAP groups after create/update. Valid values: `UPDATE`, `IMPORT`, `UPDATE_AND_IMPORT`. Defaults to `UPDATE_AND_IMPORT`.",
Optional: true,
Computed: true,
Default: stringdefault.StaticString("UPDATE_AND_IMPORT"),
Validators: []validator.String{
stringvalidator.OneOf("UPDATE", "IMPORT", "UPDATE_AND_IMPORT"),
},
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
},
}
}
Expand Down Expand Up @@ -189,6 +202,10 @@ func (r *ArtifactoryLdapGroupSettingResource) Create(ctx context.Context, req re
DescriptionAttribute: data.DescriptionAttribute.ValueString(),
Strategy: data.Strategy.ValueString(),
}
refreshOperation := data.RefreshOperation.ValueString()
if refreshOperation == "" {
refreshOperation = "UPDATE_AND_IMPORT"
}

response, err := r.ProviderData.Client.R().
SetBody(ldapGroup).
Expand All @@ -210,8 +227,22 @@ func (r *ArtifactoryLdapGroupSettingResource) Create(ctx context.Context, req re
return
}

// Refresh LDAP group settings so the new configuration is applied
refreshResp, err := r.ProviderData.Client.R().
SetQueryParam("operation", refreshOperation).
Post(LdapGroupEndpoint + ldapGroup.Name + "/refresh")
if err != nil {
utilfw.UnableToCreateResourceError(resp, err.Error())
return
}
if refreshResp.StatusCode() != http.StatusOK || refreshResp.IsError() {
utilfw.UnableToCreateResourceError(resp, refreshResp.String())
return
}

// Assign the resource ID for the resource in the state
data.Id = types.StringValue(ldapGroup.Name)
data.RefreshOperation = types.StringValue(refreshOperation)

// Save data into Terraform state
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
Expand Down Expand Up @@ -251,9 +282,15 @@ func (r *ArtifactoryLdapGroupSettingResource) Read(ctx context.Context, req reso
return
}

// Preserve configured refresh_operation from state (API does not return it)
currentRefreshOperation := data.RefreshOperation

// Convert from the API data model to the Terraform data model
// and refresh any attribute values.
resp.Diagnostics.Append(data.ToState(ctx, ldapGroup)...)
if !currentRefreshOperation.IsNull() && !currentRefreshOperation.IsUnknown() {
data.RefreshOperation = currentRefreshOperation
}
if resp.Diagnostics.HasError() {
return
}
Expand Down Expand Up @@ -283,6 +320,10 @@ func (r *ArtifactoryLdapGroupSettingResource) Update(ctx context.Context, req re
DescriptionAttribute: data.DescriptionAttribute.ValueString(),
Strategy: data.Strategy.ValueString(),
}
refreshOperation := data.RefreshOperation.ValueString()
if refreshOperation == "" {
refreshOperation = "UPDATE_AND_IMPORT"
}

response, err := r.ProviderData.Client.R().
SetBody(ldapGroup).
Expand All @@ -303,11 +344,26 @@ func (r *ArtifactoryLdapGroupSettingResource) Update(ctx context.Context, req re
return
}

// Refresh LDAP group settings after update so changes take effect
refreshResp, err := r.ProviderData.Client.R().
SetQueryParam("operation", refreshOperation).
Post(LdapGroupEndpoint + ldapGroup.Name + "/refresh")
if err != nil {
utilfw.UnableToUpdateResourceError(resp, err.Error())
return
}
if refreshResp.StatusCode() != http.StatusOK || refreshResp.IsError() {
utilfw.UnableToUpdateResourceError(resp, refreshResp.String())
return
}

resp.Diagnostics.Append(data.ToState(ctx, ldapGroup)...)
if resp.Diagnostics.HasError() {
return
}

data.RefreshOperation = types.StringValue(refreshOperation)

// Save updated data into Terraform state
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
}
Expand Down
Loading