Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hcp_group_members resource #783

Conversation

squaresurf
Copy link
Member

🛠️ Description

Jira: https://hashicorp.atlassian.net/browse/HCPIE-1023

The resource hcp_group_members allows users to manage the members in an hcp_group (resource/data source are added in another PR).

🏗️ Acceptance tests

  • Are there any feature flags that are required to use this functionality? No
  • Have you added an acceptance test for the functionality being added? Yes
  • Have you run the acceptance tests on this branch? Yes

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccGroupMembersResource'
==> Checking that code complies with gofmt requirements...
golangci-lint run --config ./golangci-config.yml
TF_ACC=1 go test ./internal/... -v -run=TestAccGroupMembersResource -timeout 360m -parallel=10
?       github.com/hashicorp/terraform-provider-hcp/internal/clients/iampolicy  [no test files]
?       github.com/hashicorp/terraform-provider-hcp/internal/clients/packerv1   [no test files]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-hcp/internal/clients    (cached) [no tests to run]
?       github.com/hashicorp/terraform-provider-hcp/internal/clients/packerv2   [no test files]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-hcp/internal/consul     (cached) [no tests to run]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-hcp/internal/hcpvalidator       (cached) [no tests to run]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-hcp/internal/input      (cached) [no tests to run]
?       github.com/hashicorp/terraform-provider-hcp/internal/provider   [no test files]
?       github.com/hashicorp/terraform-provider-hcp/internal/provider/acctest   [no test files]
?       github.com/hashicorp/terraform-provider-hcp/internal/provider/customtypes       [no test files]
?       github.com/hashicorp/terraform-provider-hcp/internal/provider/modifiers [no test files]
?       github.com/hashicorp/terraform-provider-hcp/internal/provider/packer    [no test files]
?       github.com/hashicorp/terraform-provider-hcp/internal/provider/packer/testutils  [no test files]
?       github.com/hashicorp/terraform-provider-hcp/internal/provider/packer/testutils/configbuilder    [no test files]
?       github.com/hashicorp/terraform-provider-hcp/internal/provider/packer/testutils/configbuilder/packerconfig       [no test files]
?       github.com/hashicorp/terraform-provider-hcp/internal/provider/packer/testutils/testclient       [no test files]
?       github.com/hashicorp/terraform-provider-hcp/internal/provider/packer/testutils/testcheck        [no test files]
?       github.com/hashicorp/terraform-provider-hcp/internal/provider/packer/utils      [no test files]
?       github.com/hashicorp/terraform-provider-hcp/internal/provider/packer/utils/base [no test files]
?       github.com/hashicorp/terraform-provider-hcp/internal/provider/packer/utils/location     [no test files]
authznew "github.com/hashicorp/cloud-resource-manager/pkg/authz"
=== RUN   TestAccGroupMembersResource
--- PASS: TestAccGroupMembersResource (17.73s)
PASS
ok      github.com/hashicorp/terraform-provider-hcp/internal/provider/iam       18.240s
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-hcp/internal/provider/logstreaming      0.712s [no tests to run]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-hcp/internal/provider/packer/sources/artifact   0.980s [no tests to run]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-hcp/internal/provider/packer/sources/version    1.166s [no tests to run]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-hcp/internal/provider/resourcemanager   0.704s [no tests to run]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-hcp/internal/provider/vaultsecrets      0.447s [no tests to run]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-hcp/internal/provider/webhook   0.920s [no tests to run]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-hcp/internal/provider/webhook/validator (cached) [no tests to run]
testing: warning: no tests to run
PASS
ok      github.com/hashicorp/terraform-provider-hcp/internal/providersdkv2      1.147s [no tests to run]

@squaresurf squaresurf requested review from a team as code owners March 12, 2024 21:35
@squaresurf squaresurf force-pushed the HCPIE-1023-resource-hcp-group-members branch from 7b3c40b to bc08d21 Compare March 13, 2024 17:01
Copy link
Contributor

@itsjaspermilan itsjaspermilan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Approving for now but left some small comments 🙂

internal/provider/iam/resource_group_members.go Outdated Show resolved Hide resolved
internal/provider/iam/resource_group_members.go Outdated Show resolved Hide resolved
"group": schema.StringAttribute{
Required: true,
Description: fmt.Sprintf("The group's resource name in the format `%s`",
"iam/organization/<organization_id>/group/<name>"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to ignore this one, thought it might make things more clear!

Suggested change
"iam/organization/<organization_id>/group/<name>"),
"iam/organization/<organization_id>/group/<resource_name>"),

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I nearly did that, but thought that a resource_name was that whole path 🤔 . Should I replace the whole path with <resource_name>?

Copy link
Contributor

@itsjaspermilan itsjaspermilan Mar 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question! I think maybe we can follow how we label it in the portal? If to the user a resource_name is the full iam/organization/<organization_id>/group/<name> then I think we can leave it as is. 🤔

)

func TestAccGroupMembersResource(t *testing.T) {
groupName := "iam/organization/d11d7309-5072-44f9-aaea-c8f37c09a8b5/group/group_members_terraform_resource_test"
Copy link
Contributor

@JolisaBrownHashiCorp JolisaBrownHashiCorp Mar 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might help to add a comment that this group lives in the int tooling account just for documentation/readability.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add a comment here. I did have a bit of a comment here for a while, then realized this is a public repo and we may not want to reveal too much.

@squaresurf squaresurf force-pushed the HCPIE-1023-resource-hcp-group-members branch 6 times, most recently from 78343a0 to 9edc869 Compare March 14, 2024 18:14
@squaresurf squaresurf force-pushed the HCPIE-1023-resource-hcp-group-members branch from 9edc869 to 7da6939 Compare March 14, 2024 18:51
@squaresurf squaresurf merged commit ca6b547 into iam-groups-resources-hcpie-1016 Mar 14, 2024
5 checks passed
@squaresurf squaresurf deleted the HCPIE-1023-resource-hcp-group-members branch March 14, 2024 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants