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",
},
});
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",
})
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, nil, 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
})
}
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" },
},
});
});
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());
}
}
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: {}
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 string
- The unique name of the resource.
- args StateConfigurationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args 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 string
- The unique name of the resource.
- args StateConfigurationArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args StateConfigurationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args 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",
});
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"),
})
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());
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")
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",
});
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
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
The StateConfiguration resource accepts the following input properties:
- Schedule
Expression string - Timing expression.
- Schedule
Type string - Timing type. Valid values:
rate
. - Targets string
- The Target resources. This field is in the format of JSON strings. For detailed definition instructions, please refer to Parameter.
- Template
Name string - The name of the template.
- Configure
Mode 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.
- Resource
Group stringId - The ID of the resource group.
- Dictionary<string, string>
- The tag of the resource.
- Template
Version string - The version number. If you do not specify this parameter, the system uses the latest version.
- Schedule
Expression string - Timing expression.
- Schedule
Type string - Timing type. Valid values:
rate
. - Targets string
- The Target resources. This field is in the format of JSON strings. For detailed definition instructions, please refer to Parameter.
- Template
Name string - The name of the template.
- Configure
Mode 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.
- Resource
Group stringId - The ID of the resource group.
- map[string]string
- The tag of the resource.
- Template
Version string - The version number. If you do not specify this parameter, the system uses the latest version.
- schedule
Expression String - Timing expression.
- schedule
Type String - Timing type. Valid values:
rate
. - targets String
- The Target resources. This field is in the format of JSON strings. For detailed definition instructions, please refer to Parameter.
- template
Name String - The name of the template.
- configure
Mode 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.
- resource
Group StringId - The ID of the resource group.
- Map<String,String>
- The tag of the resource.
- template
Version String - The version number. If you do not specify this parameter, the system uses the latest version.
- schedule
Expression string - Timing expression.
- schedule
Type string - Timing type. Valid values:
rate
. - targets string
- The Target resources. This field is in the format of JSON strings. For detailed definition instructions, please refer to Parameter.
- template
Name string - The name of the template.
- configure
Mode 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.
- resource
Group stringId - The ID of the resource group.
- {[key: string]: string}
- The tag of the resource.
- template
Version string - The version number. If you do not specify this parameter, the system uses the latest version.
- schedule_
expression str - Timing expression.
- schedule_
type str - Timing type. Valid values:
rate
. - targets str
- The Target resources. This field is in the format of JSON strings. For detailed definition instructions, please refer to Parameter.
- template_
name 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_ strid - The ID of the resource group.
- Mapping[str, str]
- The tag of the resource.
- template_
version str - The version number. If you do not specify this parameter, the system uses the latest version.
- schedule
Expression String - Timing expression.
- schedule
Type String - Timing type. Valid values:
rate
. - targets String
- The Target resources. This field is in the format of JSON strings. For detailed definition instructions, please refer to Parameter.
- template
Name String - The name of the template.
- configure
Mode 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.
- resource
Group StringId - The ID of the resource group.
- Map<String>
- The tag of the resource.
- template
Version 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)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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.
- Configure
Mode 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.
- Resource
Group stringId - The ID of the resource group.
- Schedule
Expression string - Timing expression.
- Schedule
Type string - Timing type. Valid values:
rate
. - 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.
- Template
Name string - The name of the template.
- Template
Version string - The version number. If you do not specify this parameter, the system uses the latest version.
- Configure
Mode 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.
- Resource
Group stringId - The ID of the resource group.
- Schedule
Expression string - Timing expression.
- Schedule
Type string - Timing type. Valid values:
rate
. - 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.
- Template
Name string - The name of the template.
- Template
Version string - The version number. If you do not specify this parameter, the system uses the latest version.
- configure
Mode 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.
- resource
Group StringId - The ID of the resource group.
- schedule
Expression String - Timing expression.
- schedule
Type String - Timing type. Valid values:
rate
. - 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.
- template
Name String - The name of the template.
- template
Version String - The version number. If you do not specify this parameter, the system uses the latest version.
- configure
Mode 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.
- resource
Group stringId - The ID of the resource group.
- schedule
Expression string - Timing expression.
- schedule
Type string - Timing type. Valid values:
rate
. - {[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.
- template
Name string - The name of the template.
- template
Version 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_ strid - The ID of the resource group.
- schedule_
expression str - Timing expression.
- schedule_
type str - Timing type. Valid values:
rate
. - 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 str - The name of the template.
- template_
version str - The version number. If you do not specify this parameter, the system uses the latest version.
- configure
Mode 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.
- resource
Group StringId - The ID of the resource group.
- schedule
Expression String - Timing expression.
- schedule
Type String - Timing type. Valid values:
rate
. - 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.
- template
Name String - The name of the template.
- template
Version 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>
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.