1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. oos
  5. StateConfiguration
Alibaba Cloud v3.51.0 published on Saturday, Mar 23, 2024 by Pulumi

alicloud.oos.StateConfiguration

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.51.0 published on Saturday, Mar 23, 2024 by Pulumi

    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 defaultResourceGroups = alicloud.resourcemanager.getResourceGroups({});
    const defaultStateConfiguration = new alicloud.oos.StateConfiguration("defaultStateConfiguration", {
        templateName: "ACS-ECS-InventoryDataCollection",
        configureMode: "ApplyOnly",
        description: "terraform-example",
        scheduleType: "rate",
        scheduleExpression: "1 hour",
        resourceGroupId: defaultResourceGroups.then(defaultResourceGroups => defaultResourceGroups.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_resource_groups = alicloud.resourcemanager.get_resource_groups()
    default_state_configuration = alicloud.oos.StateConfiguration("defaultStateConfiguration",
        template_name="ACS-ECS-InventoryDataCollection",
        configure_mode="ApplyOnly",
        description="terraform-example",
        schedule_type="rate",
        schedule_expression="1 hour",
        resource_group_id=default_resource_groups.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 {
    		defaultResourceGroups, err := resourcemanager.GetResourceGroups(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		_, err = oos.NewStateConfiguration(ctx, "defaultStateConfiguration", &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(defaultResourceGroups.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.Map{
    				"Created": pulumi.Any("TF"),
    				"For":     pulumi.Any("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 defaultResourceGroups = AliCloud.ResourceManager.GetResourceGroups.Invoke();
    
        var defaultStateConfiguration = new AliCloud.Oos.StateConfiguration("defaultStateConfiguration", new()
        {
            TemplateName = "ACS-ECS-InventoryDataCollection",
            ConfigureMode = "ApplyOnly",
            Description = "terraform-example",
            ScheduleType = "rate",
            ScheduleExpression = "1 hour",
            ResourceGroupId = defaultResourceGroups.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 defaultResourceGroups = ResourcemanagerFunctions.getResourceGroups();
    
            var defaultStateConfiguration = new StateConfiguration("defaultStateConfiguration", StateConfigurationArgs.builder()        
                .templateName("ACS-ECS-InventoryDataCollection")
                .configureMode("ApplyOnly")
                .description("terraform-example")
                .scheduleType("rate")
                .scheduleExpression("1 hour")
                .resourceGroupId(defaultResourceGroups.applyValue(getResourceGroupsResult -> getResourceGroupsResult.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
        properties:
          templateName: ACS-ECS-InventoryDataCollection
          configureMode: ApplyOnly
          description: terraform-example
          scheduleType: rate
          scheduleExpression: 1 hour
          resourceGroupId: ${defaultResourceGroups.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:
      defaultResourceGroups:
        fn::invoke:
          Function: alicloud:resourcemanager:getResourceGroups
          Arguments: {}
    

    Create StateConfiguration Resource

    new StateConfiguration(name: string, args: StateConfigurationArgs, opts?: CustomResourceOptions);
    @overload
    def StateConfiguration(resource_name: 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, Any]] = None,
                           targets: Optional[str] = None,
                           template_name: Optional[str] = None,
                           template_version: Optional[str] = None)
    @overload
    def StateConfiguration(resource_name: str,
                           args: StateConfigurationArgs,
                           opts: Optional[ResourceOptions] = 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.
    
    
    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.

    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:

    ScheduleExpression string
    Timing expression.
    ScheduleType 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.
    TemplateName 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, object>
    The tag of the resource.
    TemplateVersion string
    The version number. If you do not specify this parameter, the system uses the latest version.
    ScheduleExpression string
    Timing expression.
    ScheduleType 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.
    TemplateName 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]interface{}
    The tag of the resource.
    TemplateVersion string
    The version number. If you do not specify this parameter, the system uses the latest version.
    scheduleExpression String
    Timing expression.
    scheduleType 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.
    templateName 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,Object>
    The tag of the resource.
    templateVersion String
    The version number. If you do not specify this parameter, the system uses the latest version.
    scheduleExpression string
    Timing expression.
    scheduleType 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.
    templateName 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]: any}
    The tag of the resource.
    templateVersion 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_id str
    The ID of the resource group.
    tags Mapping[str, Any]
    The tag of the resource.
    template_version str
    The version number. If you do not specify this parameter, the system uses the latest version.
    scheduleExpression String
    Timing expression.
    scheduleType 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.
    templateName 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<Any>
    The tag of the resource.
    templateVersion 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, Any]] = 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.
    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, object>
    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 string
    The name of the template.
    TemplateVersion 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]interface{}
    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 string
    The name of the template.
    TemplateVersion 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,Object>
    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 String
    The name of the template.
    templateVersion 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]: any}
    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 string
    The name of the template.
    templateVersion 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, Any]
    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.
    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<Any>
    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 String
    The name of the template.
    templateVersion 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>
    

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.51.0 published on Saturday, Mar 23, 2024 by Pulumi