UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

275 lines (274 loc) 9.96 kB
import * as pulumi from "@pulumi/pulumi"; import { input as inputs, output as outputs } from "../types"; /** * Manages an AS configuration resource within HuaweiCloud. * * ## Example Usage * ### Basic AS Configuration * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const flavorId = config.requireObject("flavorId"); * const imageId = config.requireObject("imageId"); * const sshKey = config.requireObject("sshKey"); * const securityGroupId = config.requireObject("securityGroupId"); * const myAsConfig = new huaweicloud.as.Configuration("myAsConfig", { * scalingConfigurationName: "my_as_config", * instanceConfig: { * flavor: flavorId, * image: imageId, * keyName: sshKey, * securityGroupIds: [securityGroupId], * disks: [{ * size: 40, * volumeType: "SSD", * diskType: "SYS", * }], * }, * }); * ``` * ### AS Configuration With Encrypted Data Disk * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const flavorId = config.requireObject("flavorId"); * const imageId = config.requireObject("imageId"); * const sshKey = config.requireObject("sshKey"); * const kmsId = config.requireObject("kmsId"); * const securityGroupId = config.requireObject("securityGroupId"); * const myAsConfig = new huaweicloud.as.Configuration("myAsConfig", { * scalingConfigurationName: "my_as_config", * instanceConfig: { * flavor: flavorId, * image: imageId, * keyName: sshKey, * securityGroupIds: [securityGroupId], * disks: [ * { * size: 40, * volumeType: "SSD", * diskType: "SYS", * }, * { * size: 100, * volumeType: "SSD", * diskType: "DATA", * kmsId: kmsId, * }, * ], * }, * }); * ``` * ### AS Configuration With User Data and Metadata * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as fs from "fs"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const flavorId = config.requireObject("flavorId"); * const imageId = config.requireObject("imageId"); * const sshKey = config.requireObject("sshKey"); * const securityGroupId = config.requireObject("securityGroupId"); * const myAsConfig = new huaweicloud.as.Configuration("myAsConfig", { * scalingConfigurationName: "my_as_config", * instanceConfig: { * flavor: flavorId, * image: imageId, * keyName: sshKey, * securityGroupIds: [securityGroupId], * userData: fs.readFileSync("userdata.txt"), * disks: [{ * size: 40, * volumeType: "SSD", * diskType: "SYS", * }], * metadata: { * some_key: "some_value", * }, * }, * }); * ``` * ### AS Configuration uses password authentication for Windows ECS * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const flavorId = config.requireObject("flavorId"); * const windowsImageId = config.requireObject("windowsImageId"); * const securityGroupId = config.requireObject("securityGroupId"); * const adminPass = config.requireObject("adminPass"); * const myAsConfig = new huaweicloud.as.Configuration("myAsConfig", { * scalingConfigurationName: "my_as_config", * instanceConfig: { * flavor: flavorId, * image: windowsImageId, * securityGroupIds: [securityGroupId], * adminPass: adminPass, * disks: [{ * size: 40, * volumeType: "SSD", * diskType: "SYS", * }], * }, * }); * ``` * ### AS Configuration uses the existing instance specifications as the template * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const instanceId = config.requireObject("instanceId"); * const sshKey = config.requireObject("sshKey"); * const securityGroupId = config.requireObject("securityGroupId"); * const myAsConfig = new huaweicloud.as.Configuration("myAsConfig", { * scalingConfigurationName: "my_as_config", * instanceConfig: { * instanceId: instanceId, * keyName: sshKey, * securityGroupIds: [securityGroupId], * }, * }); * ``` * * ## Import * * AS configurations can be imported by their `id`, e.g. bash * * ```sh * $ pulumi import huaweicloud:As/configuration:Configuration test <id> * ``` * * Note that the imported state may not be identical to your resource definition, due to `instance_config.0.instance_id`, `instance_config.0.admin_pass`, `instance_config.0.user_data`, and `instance_config.0.metadata` are missing from the API response. You can ignore changes after importing an AS configuration as below. hcl resource "huaweicloud_as_configuration" "test" { * * ... * * lifecycle { * * ignore_changes = [ * * instance_config.0.instance_id, * * instance_config.0.admin_pass, * * instance_config.0.user_data, * * instance_config.0.metadata, * * ] * * } } */ export declare class Configuration extends pulumi.CustomResource { /** * Get an existing Configuration resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: ConfigurationState, opts?: pulumi.CustomResourceOptions): Configuration; /** * Returns true if the given object is an instance of Configuration. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is Configuration; /** * The creation time of the AS configuration, in UTC format. */ readonly createTime: pulumi.Output<string>; /** * Specifies the information about instance configuration. * The instanceConfig structure is documented below. * Changing this will create a new resource. */ readonly instanceConfig: pulumi.Output<outputs.As.ConfigurationInstanceConfig>; /** * Specifies the region in which to create the AS configuration. * If omitted, the provider-level region will be used. Changing this will create a new resource. */ readonly region: pulumi.Output<string>; /** * Specifies the AS configuration name. * The name contains only letters, digits, underscores (_), and hyphens (-), and cannot exceed `64` characters. * Changing this will create a new resource. */ readonly scalingConfigurationName: pulumi.Output<string>; /** * The AS configuration status, the value can be **Bound** or **Unbound**. */ readonly status: pulumi.Output<string>; /** * Create a Configuration resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: ConfigurationArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Configuration resources. */ export interface ConfigurationState { /** * The creation time of the AS configuration, in UTC format. */ createTime?: pulumi.Input<string>; /** * Specifies the information about instance configuration. * The instanceConfig structure is documented below. * Changing this will create a new resource. */ instanceConfig?: pulumi.Input<inputs.As.ConfigurationInstanceConfig>; /** * Specifies the region in which to create the AS configuration. * If omitted, the provider-level region will be used. Changing this will create a new resource. */ region?: pulumi.Input<string>; /** * Specifies the AS configuration name. * The name contains only letters, digits, underscores (_), and hyphens (-), and cannot exceed `64` characters. * Changing this will create a new resource. */ scalingConfigurationName?: pulumi.Input<string>; /** * The AS configuration status, the value can be **Bound** or **Unbound**. */ status?: pulumi.Input<string>; } /** * The set of arguments for constructing a Configuration resource. */ export interface ConfigurationArgs { /** * Specifies the information about instance configuration. * The instanceConfig structure is documented below. * Changing this will create a new resource. */ instanceConfig: pulumi.Input<inputs.As.ConfigurationInstanceConfig>; /** * Specifies the region in which to create the AS configuration. * If omitted, the provider-level region will be used. Changing this will create a new resource. */ region?: pulumi.Input<string>; /** * Specifies the AS configuration name. * The name contains only letters, digits, underscores (_), and hyphens (-), and cannot exceed `64` characters. * Changing this will create a new resource. */ scalingConfigurationName: pulumi.Input<string>; }