StrongDM v1.26.0 published on Friday, Mar 21, 2025 by Piers Karsenbarg
sdm.getPolicy
Explore with Pulumi AI
Policy is a collection of one or more statements that enforce fine-grained access control for the users of an organization.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as sdm from "@pulumi/sdm";
const policy = sdm.getPolicy({
    name: "policy-query",
});
import pulumi
import pulumi_sdm as sdm
policy = sdm.get_policy(name="policy-query")
package main
import (
	"github.com/pierskarsenbarg/pulumi-sdm/sdk/go/sdm"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := sdm.LookupPolicy(ctx, &sdm.LookupPolicyArgs{
			Name: pulumi.StringRef("policy-query"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Sdm = Pulumi.Sdm;
return await Deployment.RunAsync(() => 
{
    var policy = Sdm.GetPolicy.Invoke(new()
    {
        Name = "policy-query",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.sdm.SdmFunctions;
import com.pulumi.sdm.inputs.GetPolicyArgs;
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 policy = SdmFunctions.getPolicy(GetPolicyArgs.builder()
            .name("policy-query")
            .build());
    }
}
variables:
  policy:
    fn::invoke:
      function: sdm:getPolicy
      arguments:
        name: policy-query
Using getPolicy
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 getPolicy(args: GetPolicyArgs, opts?: InvokeOptions): Promise<GetPolicyResult>
function getPolicyOutput(args: GetPolicyOutputArgs, opts?: InvokeOptions): Output<GetPolicyResult>def get_policy(description: Optional[str] = None,
               id: Optional[str] = None,
               name: Optional[str] = None,
               policy: Optional[str] = None,
               opts: Optional[InvokeOptions] = None) -> GetPolicyResult
def get_policy_output(description: Optional[pulumi.Input[str]] = None,
               id: Optional[pulumi.Input[str]] = None,
               name: Optional[pulumi.Input[str]] = None,
               policy: Optional[pulumi.Input[str]] = None,
               opts: Optional[InvokeOptions] = None) -> Output[GetPolicyResult]func LookupPolicy(ctx *Context, args *LookupPolicyArgs, opts ...InvokeOption) (*LookupPolicyResult, error)
func LookupPolicyOutput(ctx *Context, args *LookupPolicyOutputArgs, opts ...InvokeOption) LookupPolicyResultOutput> Note: This function is named LookupPolicy in the Go SDK.
public static class GetPolicy 
{
    public static Task<GetPolicyResult> InvokeAsync(GetPolicyArgs args, InvokeOptions? opts = null)
    public static Output<GetPolicyResult> Invoke(GetPolicyInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetPolicyResult> getPolicy(GetPolicyArgs args, InvokeOptions options)
public static Output<GetPolicyResult> getPolicy(GetPolicyArgs args, InvokeOptions options)
fn::invoke:
  function: sdm:index/getPolicy:getPolicy
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Description string
- Optional description of the Policy.
- Id string
- Unique identifier of the Policy.
- Name string
- Unique human-readable name of the Policy.
- Policy string
- The content of the Policy, in Cedar policy language.
- Description string
- Optional description of the Policy.
- Id string
- Unique identifier of the Policy.
- Name string
- Unique human-readable name of the Policy.
- Policy string
- The content of the Policy, in Cedar policy language.
- description String
- Optional description of the Policy.
- id String
- Unique identifier of the Policy.
- name String
- Unique human-readable name of the Policy.
- policy String
- The content of the Policy, in Cedar policy language.
- description string
- Optional description of the Policy.
- id string
- Unique identifier of the Policy.
- name string
- Unique human-readable name of the Policy.
- policy string
- The content of the Policy, in Cedar policy language.
- description str
- Optional description of the Policy.
- id str
- Unique identifier of the Policy.
- name str
- Unique human-readable name of the Policy.
- policy str
- The content of the Policy, in Cedar policy language.
- description String
- Optional description of the Policy.
- id String
- Unique identifier of the Policy.
- name String
- Unique human-readable name of the Policy.
- policy String
- The content of the Policy, in Cedar policy language.
getPolicy Result
The following output properties are available:
- Ids List<string>
- a list of strings of ids of data sources that match the given arguments.
- Policies
List<PiersKarsenbarg. Sdm. Outputs. Get Policy Policy> 
- A list where each element has the following attributes:
- Description string
- Optional description of the Policy.
- Id string
- Unique identifier of the Policy.
- Name string
- Unique human-readable name of the Policy.
- Policy string
- The content of the Policy, in Cedar policy language.
- Ids []string
- a list of strings of ids of data sources that match the given arguments.
- Policies
[]GetPolicy Policy 
- A list where each element has the following attributes:
- Description string
- Optional description of the Policy.
- Id string
- Unique identifier of the Policy.
- Name string
- Unique human-readable name of the Policy.
- Policy string
- The content of the Policy, in Cedar policy language.
- ids List<String>
- a list of strings of ids of data sources that match the given arguments.
- policies
List<GetPolicy Policy> 
- A list where each element has the following attributes:
- description String
- Optional description of the Policy.
- id String
- Unique identifier of the Policy.
- name String
- Unique human-readable name of the Policy.
- policy String
- The content of the Policy, in Cedar policy language.
- ids string[]
- a list of strings of ids of data sources that match the given arguments.
- policies
GetPolicy Policy[] 
- A list where each element has the following attributes:
- description string
- Optional description of the Policy.
- id string
- Unique identifier of the Policy.
- name string
- Unique human-readable name of the Policy.
- policy string
- The content of the Policy, in Cedar policy language.
- ids Sequence[str]
- a list of strings of ids of data sources that match the given arguments.
- policies
Sequence[GetPolicy Policy] 
- A list where each element has the following attributes:
- description str
- Optional description of the Policy.
- id str
- Unique identifier of the Policy.
- name str
- Unique human-readable name of the Policy.
- policy str
- The content of the Policy, in Cedar policy language.
- ids List<String>
- a list of strings of ids of data sources that match the given arguments.
- policies List<Property Map>
- A list where each element has the following attributes:
- description String
- Optional description of the Policy.
- id String
- Unique identifier of the Policy.
- name String
- Unique human-readable name of the Policy.
- policy String
- The content of the Policy, in Cedar policy language.
Supporting Types
GetPolicyPolicy  
- Description string
- Optional description of the Policy.
- Id string
- Unique identifier of the Policy.
- Name string
- Unique human-readable name of the Policy.
- Policy string
- The content of the Policy, in Cedar policy language.
- Description string
- Optional description of the Policy.
- Id string
- Unique identifier of the Policy.
- Name string
- Unique human-readable name of the Policy.
- Policy string
- The content of the Policy, in Cedar policy language.
- description String
- Optional description of the Policy.
- id String
- Unique identifier of the Policy.
- name String
- Unique human-readable name of the Policy.
- policy String
- The content of the Policy, in Cedar policy language.
- description string
- Optional description of the Policy.
- id string
- Unique identifier of the Policy.
- name string
- Unique human-readable name of the Policy.
- policy string
- The content of the Policy, in Cedar policy language.
- description str
- Optional description of the Policy.
- id str
- Unique identifier of the Policy.
- name str
- Unique human-readable name of the Policy.
- policy str
- The content of the Policy, in Cedar policy language.
- description String
- Optional description of the Policy.
- id String
- Unique identifier of the Policy.
- name String
- Unique human-readable name of the Policy.
- policy String
- The content of the Policy, in Cedar policy language.
Package Details
- Repository
- sdm pierskarsenbarg/pulumi-sdm
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the sdmTerraform Provider.
