1. Packages
  2. Dynatrace
  3. API Docs
  4. getIamPolicy
Dynatrace v0.27.0 published on Friday, Mar 21, 2025 by Pulumiverse

dynatrace.getIamPolicy

Explore with Pulumi AI

Dynatrace v0.27.0 published on Friday, Mar 21, 2025 by Pulumiverse

Dynatrace SaaS only

To utilize this resource, please define the environment variables DT_CLIENT_ID, DT_CLIENT_SECRET, DT_ACCOUNT_ID with an OAuth client including the following permissions: Allow IAM policy configuration for environments (iam-policies-management) and View environments (account-env-read).

The IAM policy data source allows the policy UUID to be retrieved by its name and account/environment (exclude for global).

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as dynatrace from "@pulumi/dynatrace";

const appengineadmin = dynatrace.getIamPolicy({
    name: "AppEngine - Admin",
});
export const policies = appengineadmin;
Copy
import pulumi
import pulumi_dynatrace as dynatrace

appengineadmin = dynatrace.get_iam_policy(name="AppEngine - Admin")
pulumi.export("policies", appengineadmin)
Copy
package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumiverse/pulumi-dynatrace/sdk/go/dynatrace"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		appengineadmin, err := dynatrace.LookupIamPolicy(ctx, &dynatrace.LookupIamPolicyArgs{
			Name: "AppEngine - Admin",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("policies", appengineadmin)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Dynatrace = Pulumi.Dynatrace;

return await Deployment.RunAsync(() => 
{
    var appengineadmin = Dynatrace.GetIamPolicy.Invoke(new()
    {
        Name = "AppEngine - Admin",
    });

    return new Dictionary<string, object?>
    {
        ["policies"] = appengineadmin,
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.dynatrace.DynatraceFunctions;
import com.pulumi.dynatrace.inputs.GetIamPolicyArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var appengineadmin = DynatraceFunctions.getIamPolicy(GetIamPolicyArgs.builder()
            .name("AppEngine - Admin")
            .build());

        ctx.export("policies", appengineadmin.applyValue(getIamPolicyResult -> getIamPolicyResult));
    }
}
Copy
variables:
  appengineadmin:
    fn::invoke:
      function: dynatrace:getIamPolicy
      arguments:
        name: AppEngine - Admin
outputs:
  policies: ${appengineadmin}
Copy

Example Output

Changes to Outputs:
  + policies = {
      + account     = null
      + environment = null
      + id          = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX#-#global#-#global"
      + name        = "AppEngine - Admin"
      + uuid        = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
    }

Using getIamPolicy

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getIamPolicy(args: GetIamPolicyArgs, opts?: InvokeOptions): Promise<GetIamPolicyResult>
function getIamPolicyOutput(args: GetIamPolicyOutputArgs, opts?: InvokeOptions): Output<GetIamPolicyResult>
Copy
def get_iam_policy(account: Optional[str] = None,
                   environment: Optional[str] = None,
                   name: Optional[str] = None,
                   uuid: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetIamPolicyResult
def get_iam_policy_output(account: Optional[pulumi.Input[str]] = None,
                   environment: Optional[pulumi.Input[str]] = None,
                   name: Optional[pulumi.Input[str]] = None,
                   uuid: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetIamPolicyResult]
Copy
func LookupIamPolicy(ctx *Context, args *LookupIamPolicyArgs, opts ...InvokeOption) (*LookupIamPolicyResult, error)
func LookupIamPolicyOutput(ctx *Context, args *LookupIamPolicyOutputArgs, opts ...InvokeOption) LookupIamPolicyResultOutput
Copy

> Note: This function is named LookupIamPolicy in the Go SDK.

public static class GetIamPolicy 
{
    public static Task<GetIamPolicyResult> InvokeAsync(GetIamPolicyArgs args, InvokeOptions? opts = null)
    public static Output<GetIamPolicyResult> Invoke(GetIamPolicyInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetIamPolicyResult> getIamPolicy(GetIamPolicyArgs args, InvokeOptions options)
public static Output<GetIamPolicyResult> getIamPolicy(GetIamPolicyArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: dynatrace:index/getIamPolicy:getIamPolicy
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
The name of the policy
Account string
The account that policiy is defined for. Omit if the policy is not defined for an account but for an environment or is global
Environment string
The environment that policiy is defined for. Omit if the policy is not defined for an environment but for an account or is global
Uuid string
The UUID of the policy
Name This property is required. string
The name of the policy
Account string
The account that policiy is defined for. Omit if the policy is not defined for an account but for an environment or is global
Environment string
The environment that policiy is defined for. Omit if the policy is not defined for an environment but for an account or is global
Uuid string
The UUID of the policy
name This property is required. String
The name of the policy
account String
The account that policiy is defined for. Omit if the policy is not defined for an account but for an environment or is global
environment String
The environment that policiy is defined for. Omit if the policy is not defined for an environment but for an account or is global
uuid String
The UUID of the policy
name This property is required. string
The name of the policy
account string
The account that policiy is defined for. Omit if the policy is not defined for an account but for an environment or is global
environment string
The environment that policiy is defined for. Omit if the policy is not defined for an environment but for an account or is global
uuid string
The UUID of the policy
name This property is required. str
The name of the policy
account str
The account that policiy is defined for. Omit if the policy is not defined for an account but for an environment or is global
environment str
The environment that policiy is defined for. Omit if the policy is not defined for an environment but for an account or is global
uuid str
The UUID of the policy
name This property is required. String
The name of the policy
account String
The account that policiy is defined for. Omit if the policy is not defined for an account but for an environment or is global
environment String
The environment that policiy is defined for. Omit if the policy is not defined for an environment but for an account or is global
uuid String
The UUID of the policy

getIamPolicy Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
Name string
The name of the policy
Uuid string
The UUID of the policy
Account string
The account that policiy is defined for. Omit if the policy is not defined for an account but for an environment or is global
Environment string
The environment that policiy is defined for. Omit if the policy is not defined for an environment but for an account or is global
Id string
The provider-assigned unique ID for this managed resource.
Name string
The name of the policy
Uuid string
The UUID of the policy
Account string
The account that policiy is defined for. Omit if the policy is not defined for an account but for an environment or is global
Environment string
The environment that policiy is defined for. Omit if the policy is not defined for an environment but for an account or is global
id String
The provider-assigned unique ID for this managed resource.
name String
The name of the policy
uuid String
The UUID of the policy
account String
The account that policiy is defined for. Omit if the policy is not defined for an account but for an environment or is global
environment String
The environment that policiy is defined for. Omit if the policy is not defined for an environment but for an account or is global
id string
The provider-assigned unique ID for this managed resource.
name string
The name of the policy
uuid string
The UUID of the policy
account string
The account that policiy is defined for. Omit if the policy is not defined for an account but for an environment or is global
environment string
The environment that policiy is defined for. Omit if the policy is not defined for an environment but for an account or is global
id str
The provider-assigned unique ID for this managed resource.
name str
The name of the policy
uuid str
The UUID of the policy
account str
The account that policiy is defined for. Omit if the policy is not defined for an account but for an environment or is global
environment str
The environment that policiy is defined for. Omit if the policy is not defined for an environment but for an account or is global
id String
The provider-assigned unique ID for this managed resource.
name String
The name of the policy
uuid String
The UUID of the policy
account String
The account that policiy is defined for. Omit if the policy is not defined for an account but for an environment or is global
environment String
The environment that policiy is defined for. Omit if the policy is not defined for an environment but for an account or is global

Package Details

Repository
dynatrace pulumiverse/pulumi-dynatrace
License
Apache-2.0
Notes
This Pulumi package is based on the dynatrace Terraform Provider.
Dynatrace v0.27.0 published on Friday, Mar 21, 2025 by Pulumiverse