1. Registry
  2. Packages
  3. Incident Provider
  4. API Docs
  5. getPolicy
Viewing docs for incident 7.0.0
published on Friday, Sep 11, 2026 by incident-io
Viewing docs for incident 7.0.0
published on Friday, Sep 11, 2026 by incident-io

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as incident from "@pulumi/incident";
    
    // Look up a policy by name, to reference one the dashboard owns rather than
    // managing it here.
    const postmortems = incident.getPolicy({
        name: "Post-mortems within 5 working days",
    });
    // Or by ID, for example one copied out of your organisation's settings.
    const followups = incident.getPolicy({
        id: "01FCNDV6P870EA6S7TK1DSYD5H",
    });
    export const postmortemPolicyType = postmortems.then(postmortems => postmortems.policyType);
    
    import pulumi
    import pulumi_incident as incident
    
    # Look up a policy by name, to reference one the dashboard owns rather than
    # managing it here.
    postmortems = incident.get_policy(name="Post-mortems within 5 working days")
    # Or by ID, for example one copied out of your organisation's settings.
    followups = incident.get_policy(id="01FCNDV6P870EA6S7TK1DSYD5H")
    pulumi.export("postmortemPolicyType", postmortems.policy_type)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/incident/v7/incident"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Look up a policy by name, to reference one the dashboard owns rather than
    		// managing it here.
    		postmortems, err := incident.LookupPolicy(ctx, &incident.LookupPolicyArgs{
    			Name: pulumi.StringRef("Post-mortems within 5 working days"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// Or by ID, for example one copied out of your organisation's settings.
    		_, err = incident.LookupPolicy(ctx, &incident.LookupPolicyArgs{
    			Id: pulumi.StringRef("01FCNDV6P870EA6S7TK1DSYD5H"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("postmortemPolicyType", postmortems.PolicyType)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Incident = Pulumi.Incident;
    
    return await Deployment.RunAsync(() => 
    {
        // Look up a policy by name, to reference one the dashboard owns rather than
        // managing it here.
        var postmortems = Incident.GetPolicy.Invoke(new()
        {
            Name = "Post-mortems within 5 working days",
        });
    
        // Or by ID, for example one copied out of your organisation's settings.
        var followups = Incident.GetPolicy.Invoke(new()
        {
            Id = "01FCNDV6P870EA6S7TK1DSYD5H",
        });
    
        return new Dictionary<string, object?>
        {
            ["postmortemPolicyType"] = postmortems.Apply(getPolicyResult => getPolicyResult.PolicyType),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.incident.IncidentFunctions;
    import com.pulumi.incident.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) {
            // Look up a policy by name, to reference one the dashboard owns rather than
            // managing it here.
            final var postmortems = IncidentFunctions.getPolicy(GetPolicyArgs.builder()
                .name("Post-mortems within 5 working days")
                .build());
    
            // Or by ID, for example one copied out of your organisation's settings.
            final var followups = IncidentFunctions.getPolicy(GetPolicyArgs.builder()
                .id("01FCNDV6P870EA6S7TK1DSYD5H")
                .build());
    
            ctx.export("postmortemPolicyType", postmortems.policyType());
        }
    }
    
    variables:
      # Look up a policy by name, to reference one the dashboard owns rather than
      # managing it here.
      postmortems:
        fn::invoke:
          function: incident:getPolicy
          arguments:
            name: Post-mortems within 5 working days
      # Or by ID, for example one copied out of your organisation's settings.
      followups:
        fn::invoke:
          function: incident:getPolicy
          arguments:
            id: 01FCNDV6P870EA6S7TK1DSYD5H
    outputs:
      postmortemPolicyType: ${postmortems.policyType}
    
    Example coming soon!
    

    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?: InvokeOutputOptions): Output<GetPolicyResult>
    def get_policy(id: Optional[str] = None,
                   name: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetPolicyResult
    def get_policy_output(id: pulumi.Input[Optional[str]] = None,
                   name: pulumi.Input[Optional[str]] = None,
                   opts: Optional[InvokeOutputOptions] = 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 Output<GetPolicyResult> Invoke(GetPolicyInvokeArgs args, InvokeOutputOptions opts)
    }
    public static CompletableFuture<GetPolicyResult> getPolicy(GetPolicyArgs args, InvokeOptions options)
    public static Output<GetPolicyResult> getPolicy(GetPolicyArgs args, InvokeOptions options)
    public static Output<GetPolicyResult> getPolicy(GetPolicyArgs args, InvokeOutputOptions options)
    
    fn::invoke:
      function: incident:index/getPolicy:getPolicy
      arguments:
        # arguments dictionary
    data "incident_get_policy" "name" {
        # arguments
    }

    The following arguments are supported:

    Id string
    Unique ID of the policy
    Name string
    Human readable name of the policy
    Id string
    Unique ID of the policy
    Name string
    Human readable name of the policy
    id string
    Unique ID of the policy
    name string
    Human readable name of the policy
    id String
    Unique ID of the policy
    name String
    Human readable name of the policy
    id string
    Unique ID of the policy
    name string
    Human readable name of the policy
    id str
    Unique ID of the policy
    name str
    Human readable name of the policy
    id String
    Unique ID of the policy
    name String
    Human readable name of the policy

    getPolicy Result

    The following output properties are available:

    Description string
    Human readable description of the policy
    Id string
    Unique ID of the policy
    Name string
    Human readable name of the policy
    PolicyType string
    Type of the policy, specifying what this applies to. Possible values are: debrief, follow_up, on_call_readiness, post_mortem, schedule, vacation_conflict.
    Status string
    Disabled policies stop evaluating but keep their config. Possible values are: enabled, disabled.
    Description string
    Human readable description of the policy
    Id string
    Unique ID of the policy
    Name string
    Human readable name of the policy
    PolicyType string
    Type of the policy, specifying what this applies to. Possible values are: debrief, follow_up, on_call_readiness, post_mortem, schedule, vacation_conflict.
    Status string
    Disabled policies stop evaluating but keep their config. Possible values are: enabled, disabled.
    description string
    Human readable description of the policy
    id string
    Unique ID of the policy
    name string
    Human readable name of the policy
    policy_type string
    Type of the policy, specifying what this applies to. Possible values are: debrief, follow_up, on_call_readiness, post_mortem, schedule, vacation_conflict.
    status string
    Disabled policies stop evaluating but keep their config. Possible values are: enabled, disabled.
    description String
    Human readable description of the policy
    id String
    Unique ID of the policy
    name String
    Human readable name of the policy
    policyType String
    Type of the policy, specifying what this applies to. Possible values are: debrief, follow_up, on_call_readiness, post_mortem, schedule, vacation_conflict.
    status String
    Disabled policies stop evaluating but keep their config. Possible values are: enabled, disabled.
    description string
    Human readable description of the policy
    id string
    Unique ID of the policy
    name string
    Human readable name of the policy
    policyType string
    Type of the policy, specifying what this applies to. Possible values are: debrief, follow_up, on_call_readiness, post_mortem, schedule, vacation_conflict.
    status string
    Disabled policies stop evaluating but keep their config. Possible values are: enabled, disabled.
    description str
    Human readable description of the policy
    id str
    Unique ID of the policy
    name str
    Human readable name of the policy
    policy_type str
    Type of the policy, specifying what this applies to. Possible values are: debrief, follow_up, on_call_readiness, post_mortem, schedule, vacation_conflict.
    status str
    Disabled policies stop evaluating but keep their config. Possible values are: enabled, disabled.
    description String
    Human readable description of the policy
    id String
    Unique ID of the policy
    name String
    Human readable name of the policy
    policyType String
    Type of the policy, specifying what this applies to. Possible values are: debrief, follow_up, on_call_readiness, post_mortem, schedule, vacation_conflict.
    status String
    Disabled policies stop evaluating but keep their config. Possible values are: enabled, disabled.

    Package Details

    Repository
    incident incident-io/terraform-provider-incident
    License
    Notes
    This Pulumi package is based on the incident Terraform Provider.
    Viewing docs for incident 7.0.0
    published on Friday, Sep 11, 2026 by incident-io

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial