How to create user groups for dynatrace account and link users to it using terraform


I want to create and maintain user groups for my dynatrace account using terraform. Currently, they are all maintained manually using UI and we want to move this to terraform.

Now, I looked up resources in terraform-dynatrace provider and found this one to be related Terraform Registry but I dont understand the following things:
1 - There isn’t any resource example usage for this resource in the document. I want to just create a user group in one of my env (dev) for one group (with permission of viewer). It will be nice to know if someone can share a sample template for this setup.
2 - I suppose that after i make above user group, then i need to add users by using this resource Terraform Registry can someone confirm that?

and after i have user groups and users in terraform. Would they basically override my manual setup that is done using dynatrace account management UI? What will happen if in manual setup i have 3 groups and in terraform i have only one of them. Will it delete the remaining 2 or is it like OR logic and will just have all 3 of them?

Lastly, The terraform document for resource group mentions cluster api token and im not sure if that relates to dynatrace token or something else? Is it something different from api token?

Hello @saadrafique76,

Based on your screenshot, what you’re looking for is dynatrace_iam_user and dynatrace_iam_group.

The resources dynatrace_user and dynatrace_user_group are meant to be used in case you want to configure the same stuff for an on-premise installation of a Dynatrace Cluster.

If you have further questions, don’t hesitate to contact us directly by filing an issue in the official GitHub Repository for the Dynatrace Terraform Provider.


Thank you for your reply ! I will start looking into those resources and will direct my questions to your official GitHub Repository if needed.