Skip to content

Commit

Permalink
Merge pull request #187 from jfrog/GH-169-add-group-member-resource
Browse files Browse the repository at this point in the history
Add platform_group_members resource
  • Loading branch information
alexhung authored Jan 3, 2025
2 parents 93552d9 + d5398ea commit e520a9a
Show file tree
Hide file tree
Showing 14 changed files with 680 additions and 86 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 2.2.0 (January 3, 2025). Tested on Artifactory 7.98.12 with Terraform 1.10.3 and OpenTofu 1.8.8

FEATURES:

**New Resource:**

* `platform_group_members` - Resource to manage group membership. Issue: [#169](https://github.com/jfrog/terraform-provider-platform/issues/169) PR: [#187](https://github.com/jfrog/terraform-provider-platform/pull/187)

IMPROVEMENTS:

* resource/platform_group: Add `use_group_members_resource` attribute to control if the resource uses `members` attribute or not. Issue: [#169](https://github.com/jfrog/terraform-provider-platform/issues/169) PR: [#187](https://github.com/jfrog/terraform-provider-platform/pull/187)

## 2.1.0 (December 20, 2024). Tested on Artifactory 7.98.11 with Terraform 1.10.3 and OpenTofu 1.8.7

FEATURES:
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ terraform {
required_providers {
artifactory = {
source = "registry.terraform.io/jfrog/artifactory"
version = "9.9.0"
version = "12.7.1"
}
platform = {
source = "registry.terraform.io/jfrog/platform"
version = "1.0.0"
version = "2.2.0"
}
}
}
Expand Down Expand Up @@ -104,7 +104,7 @@ See the [contribution guide](CONTRIBUTIONS.md).

## License

Copyright (c) 2024 JFrog.
Copyright (c) 2025 JFrog.

Apache 2.0 licensed, see [LICENSE][LICENSE] file.

Expand Down
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ terraform {
required_providers {
artifactory = {
source = "jfrog/artifactory"
version = "10.5.1"
version = "12.7.1"
}
platform = {
source = "jfrog/platform"
version = "1.6.0"
version = "2.2.0"
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion docs/resources/group.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ resource "platform_group" "my-group" {
- `auto_join` (Boolean) When this parameter is set, any new users defined in the system are automatically assigned to this group.
- `description` (String) A description for the group.
- `external_id` (String) New external group ID used to configure the corresponding group in Azure AD.
- `members` (Set of String) List of users assigned to the group.
- `members` (Set of String, Deprecated) List of users assigned to the group.
- `use_group_members_resource` (Boolean) When set to `true`, this resource will ignore the `members` attributes and allow memberships to be managed by `platform_group_members` resource instead. Default value is `true`.

### Read-Only

Expand Down
38 changes: 38 additions & 0 deletions docs/resources/group_members.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "platform_group_members Resource - terraform-provider-platform"
subcategory: ""
description: |-
Provides a resource to manage group membership. See JFrog documentation https://jfrog.com/help/r/jfrog-platform-administration-documentation/assign-users-to-groups for more details.
---

# platform_group_members (Resource)

Provides a resource to manage group membership. See [JFrog documentation](https://jfrog.com/help/r/jfrog-platform-administration-documentation/assign-users-to-groups) for more details.

## Example Usage

```terraform
resource "platform_group" "my-group" {
name = "my-group"
description = "My group"
external_id = "My Azure ID"
auto_join = true
admin_privileges = false
}
resource "platform_group_members" "my-group-members" {
name = platform_group.my-group.name
members = [
"admin"
]
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `members` (Set of String) List of users assigned to the group.
- `name` (String) Name of the group.
4 changes: 2 additions & 2 deletions examples/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ terraform {
required_providers {
artifactory = {
source = "jfrog/artifactory"
version = "10.5.1"
version = "12.7.1"
}
platform = {
source = "jfrog/platform"
version = "1.6.0"
version = "2.2.0"
}
}
}
Expand Down
14 changes: 14 additions & 0 deletions examples/resources/platform_group_members/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
resource "platform_group" "my-group" {
name = "my-group"
description = "My group"
external_id = "My Azure ID"
auto_join = true
admin_privileges = false
}

resource "platform_group_members" "my-group-members" {
name = platform_group.my-group.name
members = [
"admin"
]
}
1 change: 1 addition & 0 deletions pkg/platform/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func (p *PlatformProvider) Resources(ctx context.Context) []func() resource.Reso
NewLicenseResource,
NewGlobalRoleResource,
NewGroupResource,
NewGroupMembersResource,
NewHTTPSSOSettingsResource,
NewOIDCConfigurationResource,
NewOIDCIdentityMappingResource,
Expand Down
2 changes: 1 addition & 1 deletion pkg/platform/resource_aws_iam_role_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestAccAWSIAMRole_full(t *testing.T) {

id, _, _ := testutil.MkNames("test-user-upgrade-", "artifactory_managed_user")
username := fmt.Sprintf("dummy_user%d", id)
email := fmt.Sprintf(username + "@test.com")
email := username + "@test.com"

temp := `
resource "artifactory_managed_user" "{{ .username }}" {
Expand Down
Loading

0 comments on commit e520a9a

Please sign in to comment.