Skip to content

Commit

Permalink
Merge pull request #155 from jfrog/add-group-resource
Browse files Browse the repository at this point in the history
Add 'platform_group' resource
  • Loading branch information
alexhung authored Nov 15, 2024
2 parents 3522d2e + dd1acfd commit 7b25c3e
Show file tree
Hide file tree
Showing 10 changed files with 691 additions and 7 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 1.17.0 (November 15, 2024). Tested on Artifactory 7.98.8 with Terraform 1.9.8 and OpenTofu 1.8.5

FEATURES:

**New Resource:**

* `platform_group` - Resource to manage Group, using [Platform API](https://jfrog.com/help/r/jfrog-rest-apis/groups). This replaces the `artifactory_group` resource in [Artifactory provider](https://registry.terraform.io/providers/jfrog/artifactory/latest/docs/resources/group), which uses the (deprecated) Artifactory Security API. PR: [#155](https://github.com/jfrog/terraform-provider-platform/pull/155)

## 1.16.0 (November 1, 2024). Tested on Artifactory 7.98.7 with Terraform 1.9.8 and OpenTofu 1.8.4

IMPROVEMENTS:
Expand Down
54 changes: 54 additions & 0 deletions docs/resources/group.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "platform_group Resource - terraform-provider-platform"
subcategory: ""
description: |-
Provides a group resource. This can be used to create and manage groups. A group represents a role in the system and is assigned a set of permissions.
---

# platform_group (Resource)

Provides a group resource. This can be used to create and manage groups. A group represents a role in the system and is assigned a set of permissions.

## 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
members = [
"admin"
]
}
```

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

### Required

- `name` (String) Name of the group.

### Optional

- `admin_privileges` (Boolean) Any users added to this group will automatically be assigned with admin privileges in the system.
- `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.

### Read-Only

- `realm` (String) The realm for the group.
- `realm_attributes` (String) The realm for the group.

## Import

Import is supported using the following syntax:

```shell
terraform import platform_group.my-group my-group
```
1 change: 1 addition & 0 deletions examples/resources/platform_group/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import platform_group.my-group my-group
10 changes: 10 additions & 0 deletions examples/resources/platform_group/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resource "platform_group" "my-group" {
name = "my-group"
description = "My group"
external_id = "My Azure ID"
auto_join = true
admin_privileges = false
members = [
"admin"
]
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/hashicorp/terraform-plugin-framework-validators v0.15.0
github.com/hashicorp/terraform-plugin-go v0.25.0
github.com/hashicorp/terraform-plugin-testing v1.10.0
github.com/jfrog/terraform-provider-shared v1.26.0
github.com/jfrog/terraform-provider-shared v1.27.0
github.com/samber/lo v1.47.0
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM=
github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
github.com/jfrog/terraform-provider-shared v1.26.0 h1:xfJfKcgejlFkIyo6VLJPzNtEVfbTYIiGKD2PWysdgw4=
github.com/jfrog/terraform-provider-shared v1.26.0/go.mod h1:IPwXN48K3uzJNDmT2x6zFGa5IS0KG2AK7jnQR2H4G1A=
github.com/jfrog/terraform-provider-shared v1.27.0 h1:ivXga2hsXnIJF/gevPZyXXqDm82v5PQ3sy/x3kDk+nA=
github.com/jfrog/terraform-provider-shared v1.27.0/go.mod h1:LpjcFuDzCW5+gdQs1LAjgMESKuYd3ZqJazoIGt0uv9Q=
github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c=
github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo=
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
Expand Down
1 change: 1 addition & 0 deletions pkg/platform/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ func (p *PlatformProvider) Resources(ctx context.Context) []func() resource.Reso
NewAWSIAMRoleResource,
NewLicenseResource,
NewGlobalRoleResource,
NewGroupResource,
NewOIDCConfigurationResource,
NewOIDCIdentityMappingResource,
NewMyJFrogIPAllowListResource,
Expand Down
Loading

0 comments on commit 7b25c3e

Please sign in to comment.