1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. oos
  5. StateConfiguration
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.oos.StateConfiguration

Explore with Pulumi AI

Provides a OOS State Configuration resource.

For information about OOS State Configuration and how to use it, see What is State Configuration.

NOTE: Available in v1.147.0+.

Example Usage

Basic Usage

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

const _default = alicloud.resourcemanager.getResourceGroups({});
const defaultStateConfiguration = new alicloud.oos.StateConfiguration("default", {
    templateName: "ACS-ECS-InventoryDataCollection",
    configureMode: "ApplyOnly",
    description: "terraform-example",
    scheduleType: "rate",
    scheduleExpression: "1 hour",
    resourceGroupId: _default.then(_default => _default.ids?.[0]),
    targets: "{\"Filters\": [{\"Type\": \"All\", \"Parameters\": {\"InstanceChargeType\": \"PrePaid\"}}], \"ResourceType\": \"ALIYUN::ECS::Instance\"}",
    parameters: "{\"policy\": {\"ACS:Application\": {\"Collection\": \"Enabled\"}}}",
    tags: {
        Created: "TF",
        For: "example",
    },
});
Copy
import pulumi
import pulumi_alicloud as alicloud

default = alicloud.resourcemanager.get_resource_groups()
default_state_configuration = alicloud.oos.StateConfiguration("default",
    template_name="ACS-ECS-InventoryDataCollection",
    configure_mode="ApplyOnly",
    description="terraform-example",
    schedule_type="rate",
    schedule_expression="1 hour",
    resource_group_id=default.ids[0],
    targets="{\"Filters\": [{\"Type\": \"All\", \"Parameters\": {\"InstanceChargeType\": \"PrePaid\"}}], \"ResourceType\": \"ALIYUN::ECS::Instance\"}",
    parameters="{\"policy\": {\"ACS:Application\": {\"Collection\": \"Enabled\"}}}",
    tags={
        "Created": "TF",
        "For": "example",
    })
Copy
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/oos"
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/resourcemanager"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_default, err := resourcemanager.GetResourceGroups(ctx, &resourcemanager.GetResourceGroupsArgs{}, nil)
		if err != nil {
			return err
		}
		_, err = oos.NewStateConfiguration(ctx, "default", &oos.StateConfigurationArgs{
			TemplateName:       pulumi.String("ACS-ECS-InventoryDataCollection"),
			ConfigureMode:      pulumi.String("ApplyOnly"),
			Description:        pulumi.String("terraform-example"),
			ScheduleType:       pulumi.String("rate"),
			ScheduleExpression: pulumi.String("1 hour"),
			ResourceGroupId:    pulumi.String(_default.Ids[0]),
			Targets:            pulumi.String("{\"Filters\": [{\"Type\": \"All\", \"Parameters\": {\"InstanceChargeType\": \"PrePaid\"}}], \"ResourceType\": \"ALIYUN::ECS::Instance\"}"),
			Parameters:         pulumi.String("{\"policy\": {\"ACS:Application\": {\"Collection\": \"Enabled\"}}}"),
			Tags: pulumi.StringMap{
				"Created": pulumi.String("TF"),
				"For":     pulumi.String("example"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var @default = AliCloud.ResourceManager.GetResourceGroups.Invoke();

    var defaultStateConfiguration = new AliCloud.Oos.StateConfiguration("default", new()
    {
        TemplateName = "ACS-ECS-InventoryDataCollection",
        ConfigureMode = "ApplyOnly",
        Description = "terraform-example",
        ScheduleType = "rate",
        ScheduleExpression = "1 hour",
        ResourceGroupId = @default.Apply(@default => @default.Apply(getResourceGroupsResult => getResourceGroupsResult.Ids[0])),
        Targets = "{\"Filters\": [{\"Type\": \"All\", \"Parameters\": {\"InstanceChargeType\": \"PrePaid\"}}], \"ResourceType\": \"ALIYUN::ECS::Instance\"}",
        Parameters = "{\"policy\": {\"ACS:Application\": {\"Collection\": \"Enabled\"}}}",
        Tags = 
        {
            { "Created", "TF" },
            { "For", "example" },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.resourcemanager.ResourcemanagerFunctions;
import com.pulumi.alicloud.resourcemanager.inputs.GetResourceGroupsArgs;
import com.pulumi.alicloud.oos.StateConfiguration;
import com.pulumi.alicloud.oos.StateConfigurationArgs;
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 default = ResourcemanagerFunctions.getResourceGroups();

        var defaultStateConfiguration = new StateConfiguration("defaultStateConfiguration", StateConfigurationArgs.builder()
            .templateName("ACS-ECS-InventoryDataCollection")
            .configureMode("ApplyOnly")
            .description("terraform-example")
            .scheduleType("rate")
            .scheduleExpression("1 hour")
            .resourceGroupId(default_.ids()[0])
            .targets("{\"Filters\": [{\"Type\": \"All\", \"Parameters\": {\"InstanceChargeType\": \"PrePaid\"}}], \"ResourceType\": \"ALIYUN::ECS::Instance\"}")
            .parameters("{\"policy\": {\"ACS:Application\": {\"Collection\": \"Enabled\"}}}")
            .tags(Map.ofEntries(
                Map.entry("Created", "TF"),
                Map.entry("For", "example")
            ))
            .build());

    }
}
Copy
resources:
  defaultStateConfiguration:
    type: alicloud:oos:StateConfiguration
    name: default
    properties:
      templateName: ACS-ECS-InventoryDataCollection
      configureMode: ApplyOnly
      description: terraform-example
      scheduleType: rate
      scheduleExpression: 1 hour
      resourceGroupId: ${default.ids[0]}
      targets: '{"Filters": [{"Type": "All", "Parameters": {"InstanceChargeType": "PrePaid"}}], "ResourceType": "ALIYUN::ECS::Instance"}'
      parameters: '{"policy": {"ACS:Application": {"Collection": "Enabled"}}}'
      tags:
        Created: TF
        For: example
variables:
  default:
    fn::invoke:
      function: alicloud:resourcemanager:getResourceGroups
      arguments: {}
Copy

Create StateConfiguration Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new StateConfiguration(name: string, args: StateConfigurationArgs, opts?: CustomResourceOptions);
@overload
def StateConfiguration(resource_name: str,
                       args: StateConfigurationArgs,
                       opts: Optional[ResourceOptions] = None)

@overload
def StateConfiguration(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       schedule_expression: Optional[str] = None,
                       schedule_type: Optional[str] = None,
                       targets: Optional[str] = None,
                       template_name: Optional[str] = None,
                       configure_mode: Optional[str] = None,
                       description: Optional[str] = None,
                       parameters: Optional[str] = None,
                       resource_group_id: Optional[str] = None,
                       tags: Optional[Mapping[str, str]] = None,
                       template_version: Optional[str] = None)
func NewStateConfiguration(ctx *Context, name string, args StateConfigurationArgs, opts ...ResourceOption) (*StateConfiguration, error)
public StateConfiguration(string name, StateConfigurationArgs args, CustomResourceOptions? opts = null)
public StateConfiguration(String name, StateConfigurationArgs args)
public StateConfiguration(String name, StateConfigurationArgs args, CustomResourceOptions options)
type: alicloud:oos:StateConfiguration
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. StateConfigurationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. StateConfigurationArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. StateConfigurationArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. StateConfigurationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. StateConfigurationArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var stateConfigurationResource = new AliCloud.Oos.StateConfiguration("stateConfigurationResource", new()
{
    ScheduleExpression = "string",
    ScheduleType = "string",
    Targets = "string",
    TemplateName = "string",
    ConfigureMode = "string",
    Description = "string",
    Parameters = "string",
    ResourceGroupId = "string",
    Tags = 
    {
        { "string", "string" },
    },
    TemplateVersion = "string",
});
Copy
example, err := oos.NewStateConfiguration(ctx, "stateConfigurationResource", &oos.StateConfigurationArgs{
	ScheduleExpression: pulumi.String("string"),
	ScheduleType:       pulumi.String("string"),
	Targets:            pulumi.String("string"),
	TemplateName:       pulumi.String("string"),
	ConfigureMode:      pulumi.String("string"),
	Description:        pulumi.String("string"),
	Parameters:         pulumi.String("string"),
	ResourceGroupId:    pulumi.String("string"),
	Tags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	TemplateVersion: pulumi.String("string"),
})
Copy
var stateConfigurationResource = new StateConfiguration("stateConfigurationResource", StateConfigurationArgs.builder()
    .scheduleExpression("string")
    .scheduleType("string")
    .targets("string")
    .templateName("string")
    .configureMode("string")
    .description("string")
    .parameters("string")
    .resourceGroupId("string")
    .tags(Map.of("string", "string"))
    .templateVersion("string")
    .build());
Copy
state_configuration_resource = alicloud.oos.StateConfiguration("stateConfigurationResource",
    schedule_expression="string",
    schedule_type="string",
    targets="string",
    template_name="string",
    configure_mode="string",
    description="string",
    parameters="string",
    resource_group_id="string",
    tags={
        "string": "string",
    },
    template_version="string")
Copy
const stateConfigurationResource = new alicloud.oos.StateConfiguration("stateConfigurationResource", {
    scheduleExpression: "string",
    scheduleType: "string",
    targets: "string",
    templateName: "string",
    configureMode: "string",
    description: "string",
    parameters: "string",
    resourceGroupId: "string",
    tags: {
        string: "string",
    },
    templateVersion: "string",
});
Copy
type: alicloud:oos:StateConfiguration
properties:
    configureMode: string
    description: string
    parameters: string
    resourceGroupId: string
    scheduleExpression: string
    scheduleType: string
    tags:
        string: string
    targets: string
    templateName: string
    templateVersion: string
Copy

StateConfiguration Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The StateConfiguration resource accepts the following input properties:

ScheduleExpression This property is required. string
Timing expression.
ScheduleType This property is required. string
Timing type. Valid values: rate.
Targets This property is required. string
The Target resources. This field is in the format of JSON strings. For detailed definition instructions, please refer to Parameter.
TemplateName
This property is required.
Changes to this property will trigger replacement.
string
The name of the template.
ConfigureMode string
Configuration mode. Valid values: ApplyAndAutoCorrect, ApplyAndMonitor, ApplyOnly.
Description string
The description of the resource.
Parameters string
The parameter of the Template. This field is in the format of JSON strings. For detailed definition instructions, please refer to Metadata types that are supported by a configuration list.
ResourceGroupId string
The ID of the resource group.
Tags Dictionary<string, string>
The tag of the resource.
TemplateVersion Changes to this property will trigger replacement. string
The version number. If you do not specify this parameter, the system uses the latest version.
ScheduleExpression This property is required. string
Timing expression.
ScheduleType This property is required. string
Timing type. Valid values: rate.
Targets This property is required. string
The Target resources. This field is in the format of JSON strings. For detailed definition instructions, please refer to Parameter.
TemplateName
This property is required.
Changes to this property will trigger replacement.
string
The name of the template.
ConfigureMode string
Configuration mode. Valid values: ApplyAndAutoCorrect, ApplyAndMonitor, ApplyOnly.
Description string
The description of the resource.
Parameters string
The parameter of the Template. This field is in the format of JSON strings. For detailed definition instructions, please refer to Metadata types that are supported by a configuration list.
ResourceGroupId string
The ID of the resource group.
Tags map[string]string
The tag of the resource.
TemplateVersion Changes to this property will trigger replacement. string
The version number. If you do not specify this parameter, the system uses the latest version.
scheduleExpression This property is required. String
Timing expression.
scheduleType This property is required. String
Timing type. Valid values: rate.
targets This property is required. String
The Target resources. This field is in the format of JSON strings. For detailed definition instructions, please refer to Parameter.
templateName
This property is required.
Changes to this property will trigger replacement.
String
The name of the template.
configureMode String
Configuration mode. Valid values: ApplyAndAutoCorrect, ApplyAndMonitor, ApplyOnly.
description String
The description of the resource.
parameters String
The parameter of the Template. This field is in the format of JSON strings. For detailed definition instructions, please refer to Metadata types that are supported by a configuration list.
resourceGroupId String
The ID of the resource group.
tags Map<String,String>
The tag of the resource.
templateVersion Changes to this property will trigger replacement. String
The version number. If you do not specify this parameter, the system uses the latest version.
scheduleExpression This property is required. string
Timing expression.
scheduleType This property is required. string
Timing type. Valid values: rate.
targets This property is required. string
The Target resources. This field is in the format of JSON strings. For detailed definition instructions, please refer to Parameter.
templateName
This property is required.
Changes to this property will trigger replacement.
string
The name of the template.
configureMode string
Configuration mode. Valid values: ApplyAndAutoCorrect, ApplyAndMonitor, ApplyOnly.
description string
The description of the resource.
parameters string
The parameter of the Template. This field is in the format of JSON strings. For detailed definition instructions, please refer to Metadata types that are supported by a configuration list.
resourceGroupId string
The ID of the resource group.
tags {[key: string]: string}
The tag of the resource.
templateVersion Changes to this property will trigger replacement. string
The version number. If you do not specify this parameter, the system uses the latest version.
schedule_expression This property is required. str
Timing expression.
schedule_type This property is required. str
Timing type. Valid values: rate.
targets This property is required. str
The Target resources. This field is in the format of JSON strings. For detailed definition instructions, please refer to Parameter.
template_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the template.
configure_mode str
Configuration mode. Valid values: ApplyAndAutoCorrect, ApplyAndMonitor, ApplyOnly.
description str
The description of the resource.
parameters str
The parameter of the Template. This field is in the format of JSON strings. For detailed definition instructions, please refer to Metadata types that are supported by a configuration list.
resource_group_id str
The ID of the resource group.
tags Mapping[str, str]
The tag of the resource.
template_version Changes to this property will trigger replacement. str
The version number. If you do not specify this parameter, the system uses the latest version.
scheduleExpression This property is required. String
Timing expression.
scheduleType This property is required. String
Timing type. Valid values: rate.
targets This property is required. String
The Target resources. This field is in the format of JSON strings. For detailed definition instructions, please refer to Parameter.
templateName
This property is required.
Changes to this property will trigger replacement.
String
The name of the template.
configureMode String
Configuration mode. Valid values: ApplyAndAutoCorrect, ApplyAndMonitor, ApplyOnly.
description String
The description of the resource.
parameters String
The parameter of the Template. This field is in the format of JSON strings. For detailed definition instructions, please refer to Metadata types that are supported by a configuration list.
resourceGroupId String
The ID of the resource group.
tags Map<String>
The tag of the resource.
templateVersion Changes to this property will trigger replacement. String
The version number. If you do not specify this parameter, the system uses the latest version.

Outputs

All input properties are implicitly available as output properties. Additionally, the StateConfiguration resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing StateConfiguration Resource

Get an existing StateConfiguration resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: StateConfigurationState, opts?: CustomResourceOptions): StateConfiguration
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        configure_mode: Optional[str] = None,
        description: Optional[str] = None,
        parameters: Optional[str] = None,
        resource_group_id: Optional[str] = None,
        schedule_expression: Optional[str] = None,
        schedule_type: Optional[str] = None,
        tags: Optional[Mapping[str, str]] = None,
        targets: Optional[str] = None,
        template_name: Optional[str] = None,
        template_version: Optional[str] = None) -> StateConfiguration
func GetStateConfiguration(ctx *Context, name string, id IDInput, state *StateConfigurationState, opts ...ResourceOption) (*StateConfiguration, error)
public static StateConfiguration Get(string name, Input<string> id, StateConfigurationState? state, CustomResourceOptions? opts = null)
public static StateConfiguration get(String name, Output<String> id, StateConfigurationState state, CustomResourceOptions options)
resources:  _:    type: alicloud:oos:StateConfiguration    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
ConfigureMode string
Configuration mode. Valid values: ApplyAndAutoCorrect, ApplyAndMonitor, ApplyOnly.
Description string
The description of the resource.
Parameters string
The parameter of the Template. This field is in the format of JSON strings. For detailed definition instructions, please refer to Metadata types that are supported by a configuration list.
ResourceGroupId string
The ID of the resource group.
ScheduleExpression string
Timing expression.
ScheduleType string
Timing type. Valid values: rate.
Tags Dictionary<string, string>
The tag of the resource.
Targets string
The Target resources. This field is in the format of JSON strings. For detailed definition instructions, please refer to Parameter.
TemplateName Changes to this property will trigger replacement. string
The name of the template.
TemplateVersion Changes to this property will trigger replacement. string
The version number. If you do not specify this parameter, the system uses the latest version.
ConfigureMode string
Configuration mode. Valid values: ApplyAndAutoCorrect, ApplyAndMonitor, ApplyOnly.
Description string
The description of the resource.
Parameters string
The parameter of the Template. This field is in the format of JSON strings. For detailed definition instructions, please refer to Metadata types that are supported by a configuration list.
ResourceGroupId string
The ID of the resource group.
ScheduleExpression string
Timing expression.
ScheduleType string
Timing type. Valid values: rate.
Tags map[string]string
The tag of the resource.
Targets string
The Target resources. This field is in the format of JSON strings. For detailed definition instructions, please refer to Parameter.
TemplateName Changes to this property will trigger replacement. string
The name of the template.
TemplateVersion Changes to this property will trigger replacement. string
The version number. If you do not specify this parameter, the system uses the latest version.
configureMode String
Configuration mode. Valid values: ApplyAndAutoCorrect, ApplyAndMonitor, ApplyOnly.
description String
The description of the resource.
parameters String
The parameter of the Template. This field is in the format of JSON strings. For detailed definition instructions, please refer to Metadata types that are supported by a configuration list.
resourceGroupId String
The ID of the resource group.
scheduleExpression String
Timing expression.
scheduleType String
Timing type. Valid values: rate.
tags Map<String,String>
The tag of the resource.
targets String
The Target resources. This field is in the format of JSON strings. For detailed definition instructions, please refer to Parameter.
templateName Changes to this property will trigger replacement. String
The name of the template.
templateVersion Changes to this property will trigger replacement. String
The version number. If you do not specify this parameter, the system uses the latest version.
configureMode string
Configuration mode. Valid values: ApplyAndAutoCorrect, ApplyAndMonitor, ApplyOnly.
description string
The description of the resource.
parameters string
The parameter of the Template. This field is in the format of JSON strings. For detailed definition instructions, please refer to Metadata types that are supported by a configuration list.
resourceGroupId string
The ID of the resource group.
scheduleExpression string
Timing expression.
scheduleType string
Timing type. Valid values: rate.
tags {[key: string]: string}
The tag of the resource.
targets string
The Target resources. This field is in the format of JSON strings. For detailed definition instructions, please refer to Parameter.
templateName Changes to this property will trigger replacement. string
The name of the template.
templateVersion Changes to this property will trigger replacement. string
The version number. If you do not specify this parameter, the system uses the latest version.
configure_mode str
Configuration mode. Valid values: ApplyAndAutoCorrect, ApplyAndMonitor, ApplyOnly.
description str
The description of the resource.
parameters str
The parameter of the Template. This field is in the format of JSON strings. For detailed definition instructions, please refer to Metadata types that are supported by a configuration list.
resource_group_id str
The ID of the resource group.
schedule_expression str
Timing expression.
schedule_type str
Timing type. Valid values: rate.
tags Mapping[str, str]
The tag of the resource.
targets str
The Target resources. This field is in the format of JSON strings. For detailed definition instructions, please refer to Parameter.
template_name Changes to this property will trigger replacement. str
The name of the template.
template_version Changes to this property will trigger replacement. str
The version number. If you do not specify this parameter, the system uses the latest version.
configureMode String
Configuration mode. Valid values: ApplyAndAutoCorrect, ApplyAndMonitor, ApplyOnly.
description String
The description of the resource.
parameters String
The parameter of the Template. This field is in the format of JSON strings. For detailed definition instructions, please refer to Metadata types that are supported by a configuration list.
resourceGroupId String
The ID of the resource group.
scheduleExpression String
Timing expression.
scheduleType String
Timing type. Valid values: rate.
tags Map<String>
The tag of the resource.
targets String
The Target resources. This field is in the format of JSON strings. For detailed definition instructions, please refer to Parameter.
templateName Changes to this property will trigger replacement. String
The name of the template.
templateVersion Changes to this property will trigger replacement. String
The version number. If you do not specify this parameter, the system uses the latest version.

Import

OOS State Configuration can be imported using the id, e.g.

$ pulumi import alicloud:oos/stateConfiguration:StateConfiguration example <id>
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.