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 Team Resource #118

Merged
merged 51 commits into from
Aug 1, 2024
Merged

Add Team Resource #118

merged 51 commits into from
Aug 1, 2024

Conversation

ichung08
Copy link
Collaborator

@ichung08 ichung08 commented Jul 24, 2024

Description

Add support for team resource on terraform.

Supports:

🎟 Issue(s)

#112

🧪 Functional Testing

Create
Screenshot 2024-07-24 at 3 34 59 PM
Screenshot 2024-07-24 at 3 35 05 PM

Update
Screenshot 2024-07-24 at 4 05 17 PM
Screenshot 2024-07-24 at 4 05 32 PM

Delete
Screenshot 2024-07-24 at 4 06 06 PM

📸 Screenshots

📋 Checklist

  • Added/updated applicable tests
  • Added/updated examples in the examples/ directory
  • Updated any related documentation

@ichung08 ichung08 self-assigned this Jul 24, 2024
@ichung08 ichung08 linked an issue Jul 24, 2024 that may be closed by this pull request
Comment on lines 103 to 107
if orgRole != "" && orgRole != string(iam.ORGANIZATIONMEMBER) {
data.OrganizationRole = types.StringValue(orgRole)
} else {
data.OrganizationRole = types.StringNull()
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

wrote it this way because i kept hitting Provider produced inconsistent result after apply and because the API sets org role to org member automatically if org role is not provided

@ichung08
Copy link
Collaborator Author

ichung08 commented Jul 25, 2024

@vandyliu do we want to support update team roles in create and update?

Comment on lines 121 to 128
Computed: true,
MarkdownDescription: "The roles assigned to the workspaces",
},
"deployment_roles": resourceSchema.SetNestedAttribute{
NestedObject: resourceSchema.NestedAttributeObject{
Attributes: ResourceDeploymentRoleSchemaAttributes(),
},
Computed: true,
Copy link
Collaborator

Choose a reason for hiding this comment

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

should prob be optional or maybe even required but can be empty

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changed to optional - should not be required as teams don't have to have deployment_roles

MarkdownDescription: "The IDs of the users to add to the Team",
Optional: true,
Validators: []validator.Set{
setvalidator.SizeAtLeast(1),
Copy link
Collaborator

Choose a reason for hiding this comment

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

does it have to be 1, can we have empty team?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes we can have empty team - will change

@@ -0,0 +1,70 @@
package common
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added this file for shared role functions

needed to create a new directory because if i had it in utils i would hit an import cycle error since models, resources and utils reference each other in a cycle

@@ -47,11 +47,14 @@ func TestAccPreCheck(t *testing.T) {
}
}

func ProviderConfig(t *testing.T, isHosted bool) string {
func ProviderConfig(t *testing.T, isHosted bool, isScim bool) string {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added this param to the signature and had to update all the files accordingly (which is why all the test files were affected)

@ichung08 ichung08 requested review from sunkickr and a team as code owners July 30, 2024 23:55
},
},
}),
ExpectError: regexp.MustCompile("Invalid Configuration: Cannot create, update or delete a Team resource when SCIM is enabled"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you!

Copy link
Collaborator

@vandyliu vandyliu left a comment

Choose a reason for hiding this comment

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

one last comment but looks good

@ichung08 ichung08 enabled auto-merge (squash) July 31, 2024 19:04
@ichung08 ichung08 disabled auto-merge July 31, 2024 21:25
@ichung08 ichung08 enabled auto-merge (squash) July 31, 2024 22:27
@ichung08 ichung08 merged commit c9b9fb0 into main Aug 1, 2024
7 checks passed
@ichung08 ichung08 deleted the 112-add-team-resource branch August 1, 2024 00:48
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.

Add Team resource
3 participants