UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

107 lines 4.16 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.InstanceState = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides an EC2 instance state resource. This allows managing an instance power state. * * > **NOTE on Instance State Management:** AWS does not currently have an EC2 API operation to determine an instance has finished processing user data. As a result, this resource can interfere with user data processing. For example, this resource may stop an instance while the user data script is in mid run. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const ubuntu = aws.ec2.getAmi({ * mostRecent: true, * filters: [ * { * name: "name", * values: ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"], * }, * { * name: "virtualization-type", * values: ["hvm"], * }, * ], * owners: ["099720109477"], * }); * const test = new aws.ec2.Instance("test", { * ami: ubuntu.then(ubuntu => ubuntu.id), * instanceType: aws.ec2.InstanceType.T3_Micro, * tags: { * Name: "HelloWorld", * }, * }); * const testInstanceState = new aws.ec2transitgateway.InstanceState("test", { * instanceId: test.id, * state: "stopped", * }); * ``` * * ## Import * * Using `pulumi import`, import `aws_ec2_instance_state` using the `instance_id` attribute. For example: * * ```sh * $ pulumi import aws:ec2transitgateway/instanceState:InstanceState test i-02cae6557dfcf2f96 * ``` */ class InstanceState extends pulumi.CustomResource { /** * Get an existing InstanceState 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, id, state, opts) { return new InstanceState(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of InstanceState. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === InstanceState.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["force"] = state?.force; resourceInputs["instanceId"] = state?.instanceId; resourceInputs["region"] = state?.region; resourceInputs["state"] = state?.state; } else { const args = argsOrState; if (args?.instanceId === undefined && !opts.urn) { throw new Error("Missing required property 'instanceId'"); } if (args?.state === undefined && !opts.urn) { throw new Error("Missing required property 'state'"); } resourceInputs["force"] = args?.force; resourceInputs["instanceId"] = args?.instanceId; resourceInputs["region"] = args?.region; resourceInputs["state"] = args?.state; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(InstanceState.__pulumiType, name, resourceInputs, opts); } } exports.InstanceState = InstanceState; /** @internal */ InstanceState.__pulumiType = 'aws:ec2transitgateway/instanceState:InstanceState'; //# sourceMappingURL=instanceState.js.map