Viewing docs for Harness v0.17.8
published on Friday, Nov 6, 2026 by Pulumi
published on Friday, Nov 6, 2026 by Pulumi
Viewing docs for Harness v0.17.8
published on Friday, Nov 6, 2026 by Pulumi
published on Friday, Nov 6, 2026 by Pulumi
Datasource for listing Harness AutoStopping rules.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as harness from "@pulumi/harness";
export = async () => {
// Returns all autostopping rules without any filtering.
const all = await harness.autostopping.getRules({});
// Returns only rules of kind "instance"
const byInstanceKind = await harness.autostopping.getRules({
kind: "instance",
});
// Returns only rules of kind "k8s"
const byK8sKind = await harness.autostopping.getRules({
kind: "k8s",
});
// Returns rules whose name starts with "myname-" followed by any characters.
// Regex: "myname-.*" matches e.g. "myname-prod", "myname-01", "myname-anything".
const byNamePrefix = await harness.autostopping.getRules({
name: "myname-.*",
});
// Returns rules whose name starts with "app" or "svc" followed by any characters.
// Regex: "^(app|svc).*" matches e.g. "app-prod", "svc-backend", "appserver" but NOT "myapp".
const byNameRegex = await harness.autostopping.getRules({
name: "^(app|svc).*",
});
return {
allRules: all.rules,
allRuleIds: .map(r => (r.id)),
byInstanceKind: byInstanceKind.rules,
byInstanceKindIds: .map(r => (r.id)),
k8sRules: byK8sKind.rules,
k8sRuleIds: .map(r => (r.id)),
rulesByNamePrefix: byNamePrefix.rules,
rulesByNamePrefixIds: .map(r => (r.id)),
rulesByNameRegex: byNameRegex.rules,
rulesByNameRegexIds: .map(r => (r.id)),
};
}
import pulumi
import pulumi_harness as harness
# Returns all autostopping rules without any filtering.
all = harness.autostopping.get_rules()
pulumi.export("allRules", all.rules)
pulumi.export("allRuleIds", [r.id for r in all.rules])
# Returns only rules of kind "instance"
by_instance_kind = harness.autostopping.get_rules(kind="instance")
pulumi.export("byInstanceKind", by_instance_kind.rules)
pulumi.export("byInstanceKindIds", [r.id for r in by_instance_kind.rules])
# Returns only rules of kind "k8s"
by_k8s_kind = harness.autostopping.get_rules(kind="k8s")
pulumi.export("k8sRules", by_k8s_kind.rules)
pulumi.export("k8sRuleIds", [r.id for r in by_k8s_kind.rules])
# Returns rules whose name starts with "myname-" followed by any characters.
# Regex: "myname-.*" matches e.g. "myname-prod", "myname-01", "myname-anything".
by_name_prefix = harness.autostopping.get_rules(name="myname-.*")
pulumi.export("rulesByNamePrefix", by_name_prefix.rules)
pulumi.export("rulesByNamePrefixIds", [r.id for r in by_name_prefix.rules])
# Returns rules whose name starts with "app" or "svc" followed by any characters.
# Regex: "^(app|svc).*" matches e.g. "app-prod", "svc-backend", "appserver" but NOT "myapp".
by_name_regex = harness.autostopping.get_rules(name="^(app|svc).*")
pulumi.export("rulesByNameRegex", by_name_regex.rules)
pulumi.export("rulesByNameRegexIds", [r.id for r in by_name_regex.rules])
Example coming soon!
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Harness = Pulumi.Harness;
return await Deployment.RunAsync(() =>
{
// Returns all autostopping rules without any filtering.
var all = Harness.Autostopping.GetRules.Invoke();
// Returns only rules of kind "instance"
var byInstanceKind = Harness.Autostopping.GetRules.Invoke(new()
{
Kind = "instance",
});
// Returns only rules of kind "k8s"
var byK8sKind = Harness.Autostopping.GetRules.Invoke(new()
{
Kind = "k8s",
});
// Returns rules whose name starts with "myname-" followed by any characters.
// Regex: "myname-.*" matches e.g. "myname-prod", "myname-01", "myname-anything".
var byNamePrefix = Harness.Autostopping.GetRules.Invoke(new()
{
Name = "myname-.*",
});
// Returns rules whose name starts with "app" or "svc" followed by any characters.
// Regex: "^(app|svc).*" matches e.g. "app-prod", "svc-backend", "appserver" but NOT "myapp".
var byNameRegex = Harness.Autostopping.GetRules.Invoke(new()
{
Name = "^(app|svc).*",
});
return new Dictionary<string, object?>
{
["allRules"] = all.Apply(getRulesResult => getRulesResult.Rules),
["allRuleIds"] = .Select(r =>
{
return r.Id;
}).ToList(),
["byInstanceKind"] = byInstanceKind.Apply(getRulesResult => getRulesResult.Rules),
["byInstanceKindIds"] = .Select(r =>
{
return r.Id;
}).ToList(),
["k8sRules"] = byK8sKind.Apply(getRulesResult => getRulesResult.Rules),
["k8sRuleIds"] = .Select(r =>
{
return r.Id;
}).ToList(),
["rulesByNamePrefix"] = byNamePrefix.Apply(getRulesResult => getRulesResult.Rules),
["rulesByNamePrefixIds"] = .Select(r =>
{
return r.Id;
}).ToList(),
["rulesByNameRegex"] = byNameRegex.Apply(getRulesResult => getRulesResult.Rules),
["rulesByNameRegexIds"] = .Select(r =>
{
return r.Id;
}).ToList(),
};
});
Example coming soon!
Example coming soon!
terraform {
required_providers {
harness = {
source = "pulumi/harness"
}
}
}
data "harness_autostopping_rules" "all" {
}
data "harness_autostopping_rules" "byInstanceKind" {
kind = "instance"
}
data "harness_autostopping_rules" "byK8sKind" {
kind = "k8s"
}
data "harness_autostopping_rules" "byNamePrefix" {
name = "myname-.*"
}
data "harness_autostopping_rules" "byNameRegex" {
name = "^(app|svc).*"
}
# Returns all autostopping rules without any filtering.
output "allRules" {
value = data.harness_autostopping_rules.all.rules
}
# get the rule ids as a list of integers
output "allRuleIds" {
value = [for r in data.harness_autostopping_rules.all.rules : r.id]
}
# Returns only rules of kind "instance"
output "byInstanceKind" {
value = data.harness_autostopping_rules.byInstanceKind.rules
}
# get the rule ids as a list of integers
output "byInstanceKindIds" {
value = [for r in data.harness_autostopping_rules.byInstanceKind.rules : r.id]
}
# Returns only rules of kind "k8s"
output "k8sRules" {
value = data.harness_autostopping_rules.byK8sKind.rules
}
# get the rule ids as a list of integers
output "k8sRuleIds" {
value = [for r in data.harness_autostopping_rules.byK8sKind.rules : r.id]
}
# Returns rules whose name starts with "myname-" followed by any characters.
# Regex: "myname-.*" matches e.g. "myname-prod", "myname-01", "myname-anything".
output "rulesByNamePrefix" {
value = data.harness_autostopping_rules.byNamePrefix.rules
}
# get the rule ids as a list of integers
output "rulesByNamePrefixIds" {
value = [for r in data.harness_autostopping_rules.byNamePrefix.rules : r.id]
}
# Returns rules whose name starts with "app" or "svc" followed by any characters.
# Regex: "^(app|svc).*" matches e.g. "app-prod", "svc-backend", "appserver" but NOT "myapp".
output "rulesByNameRegex" {
value = data.harness_autostopping_rules.byNameRegex.rules
}
# get the rule ids as a list of integers
output "rulesByNameRegexIds" {
value = [for r in data.harness_autostopping_rules.byNameRegex.rules : r.id]
}
Using getRules
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 getRules(args: GetRulesArgs, opts?: InvokeOptions): Promise<GetRulesResult>
function getRulesOutput(args: GetRulesOutputArgs, opts?: InvokeOutputOptions): Output<GetRulesResult>def get_rules(kind: Optional[str] = None,
name: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetRulesResult
def get_rules_output(kind: pulumi.Input[Optional[str]] = None,
name: pulumi.Input[Optional[str]] = None,
opts: Optional[InvokeOutputOptions] = None) -> Output[GetRulesResult]func GetRules(ctx *Context, args *GetRulesArgs, opts ...InvokeOption) (*GetRulesResult, error)
func GetRulesOutput(ctx *Context, args *GetRulesOutputArgs, opts ...InvokeOption) GetRulesResultOutput> Note: This function is named GetRules in the Go SDK.
public static class GetRules
{
public static Task<GetRulesResult> InvokeAsync(GetRulesArgs args, InvokeOptions? opts = null)
public static Output<GetRulesResult> Invoke(GetRulesInvokeArgs args, InvokeOptions? opts = null)
public static Output<GetRulesResult> Invoke(GetRulesInvokeArgs args, InvokeOutputOptions opts)
}public static CompletableFuture<GetRulesResult> getRules(GetRulesArgs args, InvokeOptions options)
public static Output<GetRulesResult> getRules(GetRulesArgs args, InvokeOptions options)
public static Output<GetRulesResult> getRules(GetRulesArgs args, InvokeOutputOptions options)
fn::invoke:
function: harness:autostopping/getRules:getRules
arguments:
# arguments dictionarydata "harness_autostopping_get_rules" "name" {
# arguments
}The following arguments are supported:
getRules Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Rules
List<Get
Rules Rule> - List of AutoStopping rules.
- Kind string
- Return rules matching provided kind.
- Name string
- Filter by rule name using a regular expression. e.g. "^myname-." or "^(app|svc).".
- Id string
- The provider-assigned unique ID for this managed resource.
- Rules
[]Get
Rules Rule - List of AutoStopping rules.
- Kind string
- Return rules matching provided kind.
- Name string
- Filter by rule name using a regular expression. e.g. "^myname-." or "^(app|svc).".
- id string
- The provider-assigned unique ID for this managed resource.
- rules list(object)
- List of AutoStopping rules.
- kind string
- Return rules matching provided kind.
- name string
- Filter by rule name using a regular expression. e.g. "^myname-." or "^(app|svc).".
- id String
- The provider-assigned unique ID for this managed resource.
- rules
List<Get
Rules Rule> - List of AutoStopping rules.
- kind String
- Return rules matching provided kind.
- name String
- Filter by rule name using a regular expression. e.g. "^myname-." or "^(app|svc).".
- id string
- The provider-assigned unique ID for this managed resource.
- rules
Get
Rules Rule[] - List of AutoStopping rules.
- kind string
- Return rules matching provided kind.
- name string
- Filter by rule name using a regular expression. e.g. "^myname-." or "^(app|svc).".
- id str
- The provider-assigned unique ID for this managed resource.
- rules
Sequence[Get
Rules Rule] - List of AutoStopping rules.
- kind str
- Return rules matching provided kind.
- name str
- Filter by rule name using a regular expression. e.g. "^myname-." or "^(app|svc).".
- id String
- The provider-assigned unique ID for this managed resource.
- rules List<Property Map>
- List of AutoStopping rules.
- kind String
- Return rules matching provided kind.
- name String
- Filter by rule name using a regular expression. e.g. "^myname-." or "^(app|svc).".
Supporting Types
GetRulesRule
- Cloud
Connector stringId - Id of the cloud connector.
- Id double
- Unique identifier of the rule.
- Kind string
- Kind of the rule.
- Name string
- Name of the rule.
- Cloud
Connector stringId - Id of the cloud connector.
- Id float64
- Unique identifier of the rule.
- Kind string
- Kind of the rule.
- Name string
- Name of the rule.
- cloud_
connector_ stringid - Id of the cloud connector.
- id number
- Unique identifier of the rule.
- kind string
- Kind of the rule.
- name string
- Name of the rule.
- cloud
Connector StringId - Id of the cloud connector.
- id Double
- Unique identifier of the rule.
- kind String
- Kind of the rule.
- name String
- Name of the rule.
- cloud
Connector stringId - Id of the cloud connector.
- id number
- Unique identifier of the rule.
- kind string
- Kind of the rule.
- name string
- Name of the rule.
- cloud_
connector_ strid - Id of the cloud connector.
- id float
- Unique identifier of the rule.
- kind str
- Kind of the rule.
- name str
- Name of the rule.
- cloud
Connector StringId - Id of the cloud connector.
- id Number
- Unique identifier of the rule.
- kind String
- Kind of the rule.
- name String
- Name of the rule.
Package Details
- Repository
- harness pulumi/pulumi-harness
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
harnessTerraform Provider.
Viewing docs for Harness v0.17.8
published on Friday, Nov 6, 2026 by Pulumi
published on Friday, Nov 6, 2026 by Pulumi