1. Packages
  2. Scaleway
  3. API Docs
  4. autoscaling
  5. getInstancePolicy
Viewing docs for Scaleway v1.44.1
published on Monday, Mar 9, 2026 by pulumiverse
scaleway logo
Viewing docs for Scaleway v1.44.1
published on Monday, Mar 9, 2026 by pulumiverse

    Gets information about an Autoscaling Instance policy.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as scaleway from "@pulumiverse/scaleway";
    
    // Get info by name (instance_group_id is required when using name)
    const byName = scaleway.autoscaling.getInstancePolicy({
        name: "my-instance-policy",
        instanceGroupId: main.id,
    });
    // Get info by ID
    const byId = scaleway.autoscaling.getInstancePolicy({
        instancePolicyId: "11111111-1111-1111-1111-111111111111",
    });
    
    import pulumi
    import pulumi_scaleway as scaleway
    
    # Get info by name (instance_group_id is required when using name)
    by_name = scaleway.autoscaling.get_instance_policy(name="my-instance-policy",
        instance_group_id=main["id"])
    # Get info by ID
    by_id = scaleway.autoscaling.get_instance_policy(instance_policy_id="11111111-1111-1111-1111-111111111111")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway/autoscaling"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Get info by name (instance_group_id is required when using name)
    		_, err := autoscaling.LookupInstancePolicy(ctx, &autoscaling.LookupInstancePolicyArgs{
    			Name:            pulumi.StringRef("my-instance-policy"),
    			InstanceGroupId: pulumi.StringRef(main.Id),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// Get info by ID
    		_, err = autoscaling.LookupInstancePolicy(ctx, &autoscaling.LookupInstancePolicyArgs{
    			InstancePolicyId: pulumi.StringRef("11111111-1111-1111-1111-111111111111"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Scaleway = Pulumi.Scaleway;
    
    return await Deployment.RunAsync(() => 
    {
        // Get info by name (instance_group_id is required when using name)
        var byName = Scaleway.Autoscaling.GetInstancePolicy.Invoke(new()
        {
            Name = "my-instance-policy",
            InstanceGroupId = main.Id,
        });
    
        // Get info by ID
        var byId = Scaleway.Autoscaling.GetInstancePolicy.Invoke(new()
        {
            InstancePolicyId = "11111111-1111-1111-1111-111111111111",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.scaleway.autoscaling.AutoscalingFunctions;
    import com.pulumi.scaleway.autoscaling.inputs.GetInstancePolicyArgs;
    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) {
            // Get info by name (instance_group_id is required when using name)
            final var byName = AutoscalingFunctions.getInstancePolicy(GetInstancePolicyArgs.builder()
                .name("my-instance-policy")
                .instanceGroupId(main.id())
                .build());
    
            // Get info by ID
            final var byId = AutoscalingFunctions.getInstancePolicy(GetInstancePolicyArgs.builder()
                .instancePolicyId("11111111-1111-1111-1111-111111111111")
                .build());
    
        }
    }
    
    variables:
      # Get info by name (instance_group_id is required when using name)
      byName:
        fn::invoke:
          function: scaleway:autoscaling:getInstancePolicy
          arguments:
            name: my-instance-policy
            instanceGroupId: ${main.id}
      # Get info by ID
      byId:
        fn::invoke:
          function: scaleway:autoscaling:getInstancePolicy
          arguments:
            instancePolicyId: 11111111-1111-1111-1111-111111111111
    

    Using getInstancePolicy

    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 getInstancePolicy(args: GetInstancePolicyArgs, opts?: InvokeOptions): Promise<GetInstancePolicyResult>
    function getInstancePolicyOutput(args: GetInstancePolicyOutputArgs, opts?: InvokeOptions): Output<GetInstancePolicyResult>
    def get_instance_policy(instance_group_id: Optional[str] = None,
                            instance_policy_id: Optional[str] = None,
                            name: Optional[str] = None,
                            zone: Optional[str] = None,
                            opts: Optional[InvokeOptions] = None) -> GetInstancePolicyResult
    def get_instance_policy_output(instance_group_id: Optional[pulumi.Input[str]] = None,
                            instance_policy_id: Optional[pulumi.Input[str]] = None,
                            name: Optional[pulumi.Input[str]] = None,
                            zone: Optional[pulumi.Input[str]] = None,
                            opts: Optional[InvokeOptions] = None) -> Output[GetInstancePolicyResult]
    func LookupInstancePolicy(ctx *Context, args *LookupInstancePolicyArgs, opts ...InvokeOption) (*LookupInstancePolicyResult, error)
    func LookupInstancePolicyOutput(ctx *Context, args *LookupInstancePolicyOutputArgs, opts ...InvokeOption) LookupInstancePolicyResultOutput

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

    public static class GetInstancePolicy 
    {
        public static Task<GetInstancePolicyResult> InvokeAsync(GetInstancePolicyArgs args, InvokeOptions? opts = null)
        public static Output<GetInstancePolicyResult> Invoke(GetInstancePolicyInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetInstancePolicyResult> getInstancePolicy(GetInstancePolicyArgs args, InvokeOptions options)
    public static Output<GetInstancePolicyResult> getInstancePolicy(GetInstancePolicyArgs args, InvokeOptions options)
    
    fn::invoke:
      function: scaleway:autoscaling/getInstancePolicy:getInstancePolicy
      arguments:
        # arguments dictionary

    The following arguments are supported:

    InstanceGroupId string
    The ID of the Instance group the policy belongs to. Required when looking up by name.
    InstancePolicyId string
    The ID of the Instance policy. Only one of name and instance_policy_id should be specified.
    Name string
    The name of the Instance policy. Only one of name and instance_policy_id should be specified. When using name, instance_group_id is required.
    Zone string
    zone) The zone in which the Instance policy exists.
    InstanceGroupId string
    The ID of the Instance group the policy belongs to. Required when looking up by name.
    InstancePolicyId string
    The ID of the Instance policy. Only one of name and instance_policy_id should be specified.
    Name string
    The name of the Instance policy. Only one of name and instance_policy_id should be specified. When using name, instance_group_id is required.
    Zone string
    zone) The zone in which the Instance policy exists.
    instanceGroupId String
    The ID of the Instance group the policy belongs to. Required when looking up by name.
    instancePolicyId String
    The ID of the Instance policy. Only one of name and instance_policy_id should be specified.
    name String
    The name of the Instance policy. Only one of name and instance_policy_id should be specified. When using name, instance_group_id is required.
    zone String
    zone) The zone in which the Instance policy exists.
    instanceGroupId string
    The ID of the Instance group the policy belongs to. Required when looking up by name.
    instancePolicyId string
    The ID of the Instance policy. Only one of name and instance_policy_id should be specified.
    name string
    The name of the Instance policy. Only one of name and instance_policy_id should be specified. When using name, instance_group_id is required.
    zone string
    zone) The zone in which the Instance policy exists.
    instance_group_id str
    The ID of the Instance group the policy belongs to. Required when looking up by name.
    instance_policy_id str
    The ID of the Instance policy. Only one of name and instance_policy_id should be specified.
    name str
    The name of the Instance policy. Only one of name and instance_policy_id should be specified. When using name, instance_group_id is required.
    zone str
    zone) The zone in which the Instance policy exists.
    instanceGroupId String
    The ID of the Instance group the policy belongs to. Required when looking up by name.
    instancePolicyId String
    The ID of the Instance policy. Only one of name and instance_policy_id should be specified.
    name String
    The name of the Instance policy. Only one of name and instance_policy_id should be specified. When using name, instance_group_id is required.
    zone String
    zone) The zone in which the Instance policy exists.

    getInstancePolicy Result

    The following output properties are available:

    Action string
    Id string
    The provider-assigned unique ID for this managed resource.
    Metrics List<Pulumiverse.Scaleway.Autoscaling.Outputs.GetInstancePolicyMetric>
    Priority int
    ProjectId string
    Type string
    Value int
    InstanceGroupId string
    InstancePolicyId string
    Name string
    Zone string
    Action string
    Id string
    The provider-assigned unique ID for this managed resource.
    Metrics []GetInstancePolicyMetric
    Priority int
    ProjectId string
    Type string
    Value int
    InstanceGroupId string
    InstancePolicyId string
    Name string
    Zone string
    action String
    id String
    The provider-assigned unique ID for this managed resource.
    metrics List<GetInstancePolicyMetric>
    priority Integer
    projectId String
    type String
    value Integer
    instanceGroupId String
    instancePolicyId String
    name String
    zone String
    action string
    id string
    The provider-assigned unique ID for this managed resource.
    metrics GetInstancePolicyMetric[]
    priority number
    projectId string
    type string
    value number
    instanceGroupId string
    instancePolicyId string
    name string
    zone string
    action str
    id str
    The provider-assigned unique ID for this managed resource.
    metrics Sequence[GetInstancePolicyMetric]
    priority int
    project_id str
    type str
    value int
    instance_group_id str
    instance_policy_id str
    name str
    zone str
    action String
    id String
    The provider-assigned unique ID for this managed resource.
    metrics List<Property Map>
    priority Number
    projectId String
    type String
    value Number
    instanceGroupId String
    instancePolicyId String
    name String
    zone String

    Supporting Types

    GetInstancePolicyMetric

    Aggregate string
    How the values sampled for the metric should be aggregated
    CockpitMetricName string
    Custom metric to use for this policy. This must be stored in Scaleway Cockpit. The metric forms the basis of the condition that will be checked to determine whether a scaling action should be triggered
    ManagedMetric string
    Managed metric to use for this policy. These are available by default in Cockpit without any configuration or node_exporter. The chosen metric forms the basis of the condition that will be checked to determine whether a scaling action should be triggered
    Name string
    The name of the Instance policy. Only one of name and instance_policy_id should be specified. When using name, instance_group_id is required.
    Operator string
    Operator used when comparing the threshold value of the chosen metric to the actual sampled and aggregated value
    SamplingRangeMin int
    Interval of time, in minutes, during which metric is sampled
    Threshold int
    Threshold value to measure the aggregated sampled metric value against. Combined with the operator field, determines whether a scaling action should be triggered
    Aggregate string
    How the values sampled for the metric should be aggregated
    CockpitMetricName string
    Custom metric to use for this policy. This must be stored in Scaleway Cockpit. The metric forms the basis of the condition that will be checked to determine whether a scaling action should be triggered
    ManagedMetric string
    Managed metric to use for this policy. These are available by default in Cockpit without any configuration or node_exporter. The chosen metric forms the basis of the condition that will be checked to determine whether a scaling action should be triggered
    Name string
    The name of the Instance policy. Only one of name and instance_policy_id should be specified. When using name, instance_group_id is required.
    Operator string
    Operator used when comparing the threshold value of the chosen metric to the actual sampled and aggregated value
    SamplingRangeMin int
    Interval of time, in minutes, during which metric is sampled
    Threshold int
    Threshold value to measure the aggregated sampled metric value against. Combined with the operator field, determines whether a scaling action should be triggered
    aggregate String
    How the values sampled for the metric should be aggregated
    cockpitMetricName String
    Custom metric to use for this policy. This must be stored in Scaleway Cockpit. The metric forms the basis of the condition that will be checked to determine whether a scaling action should be triggered
    managedMetric String
    Managed metric to use for this policy. These are available by default in Cockpit without any configuration or node_exporter. The chosen metric forms the basis of the condition that will be checked to determine whether a scaling action should be triggered
    name String
    The name of the Instance policy. Only one of name and instance_policy_id should be specified. When using name, instance_group_id is required.
    operator String
    Operator used when comparing the threshold value of the chosen metric to the actual sampled and aggregated value
    samplingRangeMin Integer
    Interval of time, in minutes, during which metric is sampled
    threshold Integer
    Threshold value to measure the aggregated sampled metric value against. Combined with the operator field, determines whether a scaling action should be triggered
    aggregate string
    How the values sampled for the metric should be aggregated
    cockpitMetricName string
    Custom metric to use for this policy. This must be stored in Scaleway Cockpit. The metric forms the basis of the condition that will be checked to determine whether a scaling action should be triggered
    managedMetric string
    Managed metric to use for this policy. These are available by default in Cockpit without any configuration or node_exporter. The chosen metric forms the basis of the condition that will be checked to determine whether a scaling action should be triggered
    name string
    The name of the Instance policy. Only one of name and instance_policy_id should be specified. When using name, instance_group_id is required.
    operator string
    Operator used when comparing the threshold value of the chosen metric to the actual sampled and aggregated value
    samplingRangeMin number
    Interval of time, in minutes, during which metric is sampled
    threshold number
    Threshold value to measure the aggregated sampled metric value against. Combined with the operator field, determines whether a scaling action should be triggered
    aggregate str
    How the values sampled for the metric should be aggregated
    cockpit_metric_name str
    Custom metric to use for this policy. This must be stored in Scaleway Cockpit. The metric forms the basis of the condition that will be checked to determine whether a scaling action should be triggered
    managed_metric str
    Managed metric to use for this policy. These are available by default in Cockpit without any configuration or node_exporter. The chosen metric forms the basis of the condition that will be checked to determine whether a scaling action should be triggered
    name str
    The name of the Instance policy. Only one of name and instance_policy_id should be specified. When using name, instance_group_id is required.
    operator str
    Operator used when comparing the threshold value of the chosen metric to the actual sampled and aggregated value
    sampling_range_min int
    Interval of time, in minutes, during which metric is sampled
    threshold int
    Threshold value to measure the aggregated sampled metric value against. Combined with the operator field, determines whether a scaling action should be triggered
    aggregate String
    How the values sampled for the metric should be aggregated
    cockpitMetricName String
    Custom metric to use for this policy. This must be stored in Scaleway Cockpit. The metric forms the basis of the condition that will be checked to determine whether a scaling action should be triggered
    managedMetric String
    Managed metric to use for this policy. These are available by default in Cockpit without any configuration or node_exporter. The chosen metric forms the basis of the condition that will be checked to determine whether a scaling action should be triggered
    name String
    The name of the Instance policy. Only one of name and instance_policy_id should be specified. When using name, instance_group_id is required.
    operator String
    Operator used when comparing the threshold value of the chosen metric to the actual sampled and aggregated value
    samplingRangeMin Number
    Interval of time, in minutes, during which metric is sampled
    threshold Number
    Threshold value to measure the aggregated sampled metric value against. Combined with the operator field, determines whether a scaling action should be triggered

    Package Details

    Repository
    scaleway pulumiverse/pulumi-scaleway
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the scaleway Terraform Provider.
    scaleway logo
    Viewing docs for Scaleway v1.44.1
    published on Monday, Mar 9, 2026 by pulumiverse
      Try Pulumi Cloud free. Your team will thank you.