1. Packages
  2. Harness Provider
  3. API Docs
  4. platform
  5. getPolicySet
Harness v0.7.2 published on Tuesday, Apr 15, 2025 by Pulumi

harness.platform.getPolicySet

Explore with Pulumi AI

Harness v0.7.2 published on Tuesday, Apr 15, 2025 by Pulumi

Data source for retrieving a Harness policyset.

Example Usage

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

const test = harness.platform.getPolicySet({
    identifier: "harness_platform_policyset.test.identifier",
    name: "harness_platform_policyset.test.name",
    action: "onrun",
    type: "pipeline",
    enabled: true,
    policies: [{
        identifier: "always_run",
        severity: "warning",
    }],
});
Copy
import pulumi
import pulumi_harness as harness

test = harness.platform.get_policy_set(identifier="harness_platform_policyset.test.identifier",
    name="harness_platform_policyset.test.name",
    action="onrun",
    type="pipeline",
    enabled=True,
    policies=[{
        "identifier": "always_run",
        "severity": "warning",
    }])
Copy
package main

import (
	"github.com/pulumi/pulumi-harness/sdk/go/harness/platform"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := platform.LookupPolicySet(ctx, &platform.LookupPolicySetArgs{
			Identifier: "harness_platform_policyset.test.identifier",
			Name:       pulumi.StringRef("harness_platform_policyset.test.name"),
			Action:     "onrun",
			Type:       "pipeline",
			Enabled:    pulumi.BoolRef(true),
			Policies: []platform.GetPolicySetPolicy{
				{
					Identifier: "always_run",
					Severity:   "warning",
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Harness = Pulumi.Harness;

return await Deployment.RunAsync(() => 
{
    var test = Harness.Platform.GetPolicySet.Invoke(new()
    {
        Identifier = "harness_platform_policyset.test.identifier",
        Name = "harness_platform_policyset.test.name",
        Action = "onrun",
        Type = "pipeline",
        Enabled = true,
        Policies = new[]
        {
            new Harness.Platform.Inputs.GetPolicySetPolicyInputArgs
            {
                Identifier = "always_run",
                Severity = "warning",
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.harness.platform.PlatformFunctions;
import com.pulumi.harness.platform.inputs.GetPolicySetArgs;
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 test = PlatformFunctions.getPolicySet(GetPolicySetArgs.builder()
            .identifier("harness_platform_policyset.test.identifier")
            .name("harness_platform_policyset.test.name")
            .action("onrun")
            .type("pipeline")
            .enabled(true)
            .policies(GetPolicySetPolicyArgs.builder()
                .identifier("always_run")
                .severity("warning")
                .build())
            .build());

    }
}
Copy
variables:
  test:
    fn::invoke:
      function: harness:platform:getPolicySet
      arguments:
        identifier: harness_platform_policyset.test.identifier
        name: harness_platform_policyset.test.name
        action: onrun
        type: pipeline
        enabled: true
        policies:
          - identifier: always_run
            severity: warning
Copy

Using getPolicySet

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 getPolicySet(args: GetPolicySetArgs, opts?: InvokeOptions): Promise<GetPolicySetResult>
function getPolicySetOutput(args: GetPolicySetOutputArgs, opts?: InvokeOptions): Output<GetPolicySetResult>
Copy
def get_policy_set(action: Optional[str] = None,
                   enabled: Optional[bool] = None,
                   identifier: Optional[str] = None,
                   name: Optional[str] = None,
                   org_id: Optional[str] = None,
                   policies: Optional[Sequence[GetPolicySetPolicy]] = None,
                   project_id: Optional[str] = None,
                   type: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetPolicySetResult
def get_policy_set_output(action: Optional[pulumi.Input[str]] = None,
                   enabled: Optional[pulumi.Input[bool]] = None,
                   identifier: Optional[pulumi.Input[str]] = None,
                   name: Optional[pulumi.Input[str]] = None,
                   org_id: Optional[pulumi.Input[str]] = None,
                   policies: Optional[pulumi.Input[Sequence[pulumi.Input[GetPolicySetPolicyArgs]]]] = None,
                   project_id: Optional[pulumi.Input[str]] = None,
                   type: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetPolicySetResult]
Copy
func LookupPolicySet(ctx *Context, args *LookupPolicySetArgs, opts ...InvokeOption) (*LookupPolicySetResult, error)
func LookupPolicySetOutput(ctx *Context, args *LookupPolicySetOutputArgs, opts ...InvokeOption) LookupPolicySetResultOutput
Copy

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

public static class GetPolicySet 
{
    public static Task<GetPolicySetResult> InvokeAsync(GetPolicySetArgs args, InvokeOptions? opts = null)
    public static Output<GetPolicySetResult> Invoke(GetPolicySetInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetPolicySetResult> getPolicySet(GetPolicySetArgs args, InvokeOptions options)
public static Output<GetPolicySetResult> getPolicySet(GetPolicySetArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: harness:platform/getPolicySet:getPolicySet
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Action This property is required. string
Action code for the policyset.
Identifier
This property is required.
Changes to this property will trigger replacement.
string
Unique identifier of the resource.
Type This property is required. string
Type of the policyset.
Enabled bool
Enabled for the policyset.
Name string
Name of the resource.
OrgId string
Unique identifier of the organization.
Policies List<GetPolicySetPolicy>
List of policy identifiers / severity for the policyset.
ProjectId string
Unique identifier of the project.
Action This property is required. string
Action code for the policyset.
Identifier
This property is required.
Changes to this property will trigger replacement.
string
Unique identifier of the resource.
Type This property is required. string
Type of the policyset.
Enabled bool
Enabled for the policyset.
Name string
Name of the resource.
OrgId string
Unique identifier of the organization.
Policies []GetPolicySetPolicy
List of policy identifiers / severity for the policyset.
ProjectId string
Unique identifier of the project.
action This property is required. String
Action code for the policyset.
identifier
This property is required.
Changes to this property will trigger replacement.
String
Unique identifier of the resource.
type This property is required. String
Type of the policyset.
enabled Boolean
Enabled for the policyset.
name String
Name of the resource.
orgId String
Unique identifier of the organization.
policies List<GetPolicySetPolicy>
List of policy identifiers / severity for the policyset.
projectId String
Unique identifier of the project.
action This property is required. string
Action code for the policyset.
identifier
This property is required.
Changes to this property will trigger replacement.
string
Unique identifier of the resource.
type This property is required. string
Type of the policyset.
enabled boolean
Enabled for the policyset.
name string
Name of the resource.
orgId string
Unique identifier of the organization.
policies GetPolicySetPolicy[]
List of policy identifiers / severity for the policyset.
projectId string
Unique identifier of the project.
action This property is required. str
Action code for the policyset.
identifier
This property is required.
Changes to this property will trigger replacement.
str
Unique identifier of the resource.
type This property is required. str
Type of the policyset.
enabled bool
Enabled for the policyset.
name str
Name of the resource.
org_id str
Unique identifier of the organization.
policies Sequence[GetPolicySetPolicy]
List of policy identifiers / severity for the policyset.
project_id str
Unique identifier of the project.
action This property is required. String
Action code for the policyset.
identifier
This property is required.
Changes to this property will trigger replacement.
String
Unique identifier of the resource.
type This property is required. String
Type of the policyset.
enabled Boolean
Enabled for the policyset.
name String
Name of the resource.
orgId String
Unique identifier of the organization.
policies List<Property Map>
List of policy identifiers / severity for the policyset.
projectId String
Unique identifier of the project.

getPolicySet Result

The following output properties are available:

Action string
Action code for the policyset.
Description string
Description of the resource.
Id string
The provider-assigned unique ID for this managed resource.
Identifier string
Unique identifier of the resource.
Tags List<string>
Tags to associate with the resource.
Type string
Type of the policyset.
Enabled bool
Enabled for the policyset.
Name string
Name of the resource.
OrgId string
Unique identifier of the organization.
Policies List<GetPolicySetPolicy>
List of policy identifiers / severity for the policyset.
ProjectId string
Unique identifier of the project.
Action string
Action code for the policyset.
Description string
Description of the resource.
Id string
The provider-assigned unique ID for this managed resource.
Identifier string
Unique identifier of the resource.
Tags []string
Tags to associate with the resource.
Type string
Type of the policyset.
Enabled bool
Enabled for the policyset.
Name string
Name of the resource.
OrgId string
Unique identifier of the organization.
Policies []GetPolicySetPolicy
List of policy identifiers / severity for the policyset.
ProjectId string
Unique identifier of the project.
action String
Action code for the policyset.
description String
Description of the resource.
id String
The provider-assigned unique ID for this managed resource.
identifier String
Unique identifier of the resource.
tags List<String>
Tags to associate with the resource.
type String
Type of the policyset.
enabled Boolean
Enabled for the policyset.
name String
Name of the resource.
orgId String
Unique identifier of the organization.
policies List<GetPolicySetPolicy>
List of policy identifiers / severity for the policyset.
projectId String
Unique identifier of the project.
action string
Action code for the policyset.
description string
Description of the resource.
id string
The provider-assigned unique ID for this managed resource.
identifier string
Unique identifier of the resource.
tags string[]
Tags to associate with the resource.
type string
Type of the policyset.
enabled boolean
Enabled for the policyset.
name string
Name of the resource.
orgId string
Unique identifier of the organization.
policies GetPolicySetPolicy[]
List of policy identifiers / severity for the policyset.
projectId string
Unique identifier of the project.
action str
Action code for the policyset.
description str
Description of the resource.
id str
The provider-assigned unique ID for this managed resource.
identifier str
Unique identifier of the resource.
tags Sequence[str]
Tags to associate with the resource.
type str
Type of the policyset.
enabled bool
Enabled for the policyset.
name str
Name of the resource.
org_id str
Unique identifier of the organization.
policies Sequence[GetPolicySetPolicy]
List of policy identifiers / severity for the policyset.
project_id str
Unique identifier of the project.
action String
Action code for the policyset.
description String
Description of the resource.
id String
The provider-assigned unique ID for this managed resource.
identifier String
Unique identifier of the resource.
tags List<String>
Tags to associate with the resource.
type String
Type of the policyset.
enabled Boolean
Enabled for the policyset.
name String
Name of the resource.
orgId String
Unique identifier of the organization.
policies List<Property Map>
List of policy identifiers / severity for the policyset.
projectId String
Unique identifier of the project.

Supporting Types

GetPolicySetPolicy

Identifier This property is required. string
Account Identifier of the account
Severity This property is required. string
Policy failure response - 'warning' for continuation, 'error' for exit
Identifier This property is required. string
Account Identifier of the account
Severity This property is required. string
Policy failure response - 'warning' for continuation, 'error' for exit
identifier This property is required. String
Account Identifier of the account
severity This property is required. String
Policy failure response - 'warning' for continuation, 'error' for exit
identifier This property is required. string
Account Identifier of the account
severity This property is required. string
Policy failure response - 'warning' for continuation, 'error' for exit
identifier This property is required. str
Account Identifier of the account
severity This property is required. str
Policy failure response - 'warning' for continuation, 'error' for exit
identifier This property is required. String
Account Identifier of the account
severity This property is required. String
Policy failure response - 'warning' for continuation, 'error' for exit

Package Details

Repository
harness pulumi/pulumi-harness
License
Apache-2.0
Notes
This Pulumi package is based on the harness Terraform Provider.
Harness v0.7.2 published on Tuesday, Apr 15, 2025 by Pulumi