/
amiFromInstance.ts
321 lines (312 loc) · 14.3 KB
/
amiFromInstance.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
import * as utilities from "../utilities";
/**
* The "AMI from instance" resource allows the creation of an Amazon Machine
* Image (AMI) modelled after an existing EBS-backed EC2 instance.
*
* The created AMI will refer to implicitly-created snapshots of the instance's
* EBS volumes and mimick its assigned block device configuration at the time
* the resource is created.
*
* This resource is best applied to an instance that is stopped when this instance
* is created, so that the contents of the created image are predictable. When
* applied to an instance that is running, *the instance will be stopped before taking
* the snapshots and then started back up again*, resulting in a period of
* downtime.
*
* Note that the source instance is inspected only at the initial creation of this
* resource. Ongoing updates to the referenced instance will not be propagated into
* the generated AMI. Users may taint or otherwise recreate the resource in order
* to produce a fresh snapshot.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.ec2.AmiFromInstance("example", {
* sourceInstanceId: "i-xxxxxxxx",
* });
* ```
*
* > This content is derived from https://github.com/terraform-providers/terraform-provider-aws/blob/master/website/docs/r/ami_from_instance.html.markdown.
*/
export class AmiFromInstance extends pulumi.CustomResource {
/**
* Get an existing AmiFromInstance 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.
*/
public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: AmiFromInstanceState, opts?: pulumi.CustomResourceOptions): AmiFromInstance {
return new AmiFromInstance(name, <any>state, { ...opts, id: id });
}
/** @internal */
public static readonly __pulumiType = 'aws:ec2/amiFromInstance:AmiFromInstance';
/**
* Returns true if the given object is an instance of AmiFromInstance. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
public static isInstance(obj: any): obj is AmiFromInstance {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === AmiFromInstance.__pulumiType;
}
/**
* Machine architecture for created instances. Defaults to "x8664".
*/
public /*out*/ readonly architecture!: pulumi.Output<string>;
/**
* A longer, human-readable description for the AMI.
*/
public readonly description!: pulumi.Output<string | undefined>;
/**
* Nested block describing an EBS block device that should be
* attached to created instances. The structure of this block is described below.
*/
public readonly ebsBlockDevices!: pulumi.Output<outputs.ec2.AmiFromInstanceEbsBlockDevice[]>;
/**
* Specifies whether enhanced networking with ENA is enabled. Defaults to `false`.
*/
public /*out*/ readonly enaSupport!: pulumi.Output<boolean>;
/**
* Nested block describing an ephemeral block device that
* should be attached to created instances. The structure of this block is described below.
*/
public readonly ephemeralBlockDevices!: pulumi.Output<outputs.ec2.AmiFromInstanceEphemeralBlockDevice[]>;
/**
* Path to an S3 object containing an image manifest, e.g. created
* by the `ec2-upload-bundle` command in the EC2 command line tools.
*/
public /*out*/ readonly imageLocation!: pulumi.Output<string>;
/**
* The id of the kernel image (AKI) that will be used as the paravirtual
* kernel in created instances.
*/
public /*out*/ readonly kernelId!: pulumi.Output<string>;
public /*out*/ readonly manageEbsSnapshots!: pulumi.Output<boolean>;
/**
* A region-unique name for the AMI.
*/
public readonly name!: pulumi.Output<string>;
/**
* The id of an initrd image (ARI) that will be used when booting the
* created instances.
*/
public /*out*/ readonly ramdiskId!: pulumi.Output<string>;
/**
* The name of the root device (for example, `/dev/sda1`, or `/dev/xvda`).
*/
public /*out*/ readonly rootDeviceName!: pulumi.Output<string>;
public /*out*/ readonly rootSnapshotId!: pulumi.Output<string>;
/**
* Boolean that overrides the behavior of stopping
* the instance before snapshotting. This is risky since it may cause a snapshot of an
* inconsistent filesystem state, but can be used to avoid downtime if the user otherwise
* guarantees that no filesystem writes will be underway at the time of snapshot.
*/
public readonly snapshotWithoutReboot!: pulumi.Output<boolean | undefined>;
/**
* The id of the instance to use as the basis of the AMI.
*/
public readonly sourceInstanceId!: pulumi.Output<string>;
/**
* When set to "simple" (the default), enables enhanced networking
* for created instances. No other value is supported at this time.
*/
public /*out*/ readonly sriovNetSupport!: pulumi.Output<string>;
/**
* A mapping of tags to assign to the resource.
*/
public readonly tags!: pulumi.Output<{[key: string]: any} | undefined>;
/**
* Keyword to choose what virtualization mode created instances
* will use. Can be either "paravirtual" (the default) or "hvm". The choice of virtualization type
* changes the set of further arguments that are required, as described below.
*/
public /*out*/ readonly virtualizationType!: pulumi.Output<string>;
/**
* Create a AmiFromInstance 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: AmiFromInstanceArgs, opts?: pulumi.CustomResourceOptions)
constructor(name: string, argsOrState?: AmiFromInstanceArgs | AmiFromInstanceState, opts?: pulumi.CustomResourceOptions) {
let inputs: pulumi.Inputs = {};
if (opts && opts.id) {
const state = argsOrState as AmiFromInstanceState | undefined;
inputs["architecture"] = state ? state.architecture : undefined;
inputs["description"] = state ? state.description : undefined;
inputs["ebsBlockDevices"] = state ? state.ebsBlockDevices : undefined;
inputs["enaSupport"] = state ? state.enaSupport : undefined;
inputs["ephemeralBlockDevices"] = state ? state.ephemeralBlockDevices : undefined;
inputs["imageLocation"] = state ? state.imageLocation : undefined;
inputs["kernelId"] = state ? state.kernelId : undefined;
inputs["manageEbsSnapshots"] = state ? state.manageEbsSnapshots : undefined;
inputs["name"] = state ? state.name : undefined;
inputs["ramdiskId"] = state ? state.ramdiskId : undefined;
inputs["rootDeviceName"] = state ? state.rootDeviceName : undefined;
inputs["rootSnapshotId"] = state ? state.rootSnapshotId : undefined;
inputs["snapshotWithoutReboot"] = state ? state.snapshotWithoutReboot : undefined;
inputs["sourceInstanceId"] = state ? state.sourceInstanceId : undefined;
inputs["sriovNetSupport"] = state ? state.sriovNetSupport : undefined;
inputs["tags"] = state ? state.tags : undefined;
inputs["virtualizationType"] = state ? state.virtualizationType : undefined;
} else {
const args = argsOrState as AmiFromInstanceArgs | undefined;
if (!args || args.sourceInstanceId === undefined) {
throw new Error("Missing required property 'sourceInstanceId'");
}
inputs["description"] = args ? args.description : undefined;
inputs["ebsBlockDevices"] = args ? args.ebsBlockDevices : undefined;
inputs["ephemeralBlockDevices"] = args ? args.ephemeralBlockDevices : undefined;
inputs["name"] = args ? args.name : undefined;
inputs["snapshotWithoutReboot"] = args ? args.snapshotWithoutReboot : undefined;
inputs["sourceInstanceId"] = args ? args.sourceInstanceId : undefined;
inputs["tags"] = args ? args.tags : undefined;
inputs["architecture"] = undefined /*out*/;
inputs["enaSupport"] = undefined /*out*/;
inputs["imageLocation"] = undefined /*out*/;
inputs["kernelId"] = undefined /*out*/;
inputs["manageEbsSnapshots"] = undefined /*out*/;
inputs["ramdiskId"] = undefined /*out*/;
inputs["rootDeviceName"] = undefined /*out*/;
inputs["rootSnapshotId"] = undefined /*out*/;
inputs["sriovNetSupport"] = undefined /*out*/;
inputs["virtualizationType"] = undefined /*out*/;
}
if (!opts) {
opts = {}
}
if (!opts.version) {
opts.version = utilities.getVersion();
}
super(AmiFromInstance.__pulumiType, name, inputs, opts);
}
}
/**
* Input properties used for looking up and filtering AmiFromInstance resources.
*/
export interface AmiFromInstanceState {
/**
* Machine architecture for created instances. Defaults to "x8664".
*/
readonly architecture?: pulumi.Input<string>;
/**
* A longer, human-readable description for the AMI.
*/
readonly description?: pulumi.Input<string>;
/**
* Nested block describing an EBS block device that should be
* attached to created instances. The structure of this block is described below.
*/
readonly ebsBlockDevices?: pulumi.Input<pulumi.Input<inputs.ec2.AmiFromInstanceEbsBlockDevice>[]>;
/**
* Specifies whether enhanced networking with ENA is enabled. Defaults to `false`.
*/
readonly enaSupport?: pulumi.Input<boolean>;
/**
* Nested block describing an ephemeral block device that
* should be attached to created instances. The structure of this block is described below.
*/
readonly ephemeralBlockDevices?: pulumi.Input<pulumi.Input<inputs.ec2.AmiFromInstanceEphemeralBlockDevice>[]>;
/**
* Path to an S3 object containing an image manifest, e.g. created
* by the `ec2-upload-bundle` command in the EC2 command line tools.
*/
readonly imageLocation?: pulumi.Input<string>;
/**
* The id of the kernel image (AKI) that will be used as the paravirtual
* kernel in created instances.
*/
readonly kernelId?: pulumi.Input<string>;
readonly manageEbsSnapshots?: pulumi.Input<boolean>;
/**
* A region-unique name for the AMI.
*/
readonly name?: pulumi.Input<string>;
/**
* The id of an initrd image (ARI) that will be used when booting the
* created instances.
*/
readonly ramdiskId?: pulumi.Input<string>;
/**
* The name of the root device (for example, `/dev/sda1`, or `/dev/xvda`).
*/
readonly rootDeviceName?: pulumi.Input<string>;
readonly rootSnapshotId?: pulumi.Input<string>;
/**
* Boolean that overrides the behavior of stopping
* the instance before snapshotting. This is risky since it may cause a snapshot of an
* inconsistent filesystem state, but can be used to avoid downtime if the user otherwise
* guarantees that no filesystem writes will be underway at the time of snapshot.
*/
readonly snapshotWithoutReboot?: pulumi.Input<boolean>;
/**
* The id of the instance to use as the basis of the AMI.
*/
readonly sourceInstanceId?: pulumi.Input<string>;
/**
* When set to "simple" (the default), enables enhanced networking
* for created instances. No other value is supported at this time.
*/
readonly sriovNetSupport?: pulumi.Input<string>;
/**
* A mapping of tags to assign to the resource.
*/
readonly tags?: pulumi.Input<{[key: string]: any}>;
/**
* Keyword to choose what virtualization mode created instances
* will use. Can be either "paravirtual" (the default) or "hvm". The choice of virtualization type
* changes the set of further arguments that are required, as described below.
*/
readonly virtualizationType?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a AmiFromInstance resource.
*/
export interface AmiFromInstanceArgs {
/**
* A longer, human-readable description for the AMI.
*/
readonly description?: pulumi.Input<string>;
/**
* Nested block describing an EBS block device that should be
* attached to created instances. The structure of this block is described below.
*/
readonly ebsBlockDevices?: pulumi.Input<pulumi.Input<inputs.ec2.AmiFromInstanceEbsBlockDevice>[]>;
/**
* Nested block describing an ephemeral block device that
* should be attached to created instances. The structure of this block is described below.
*/
readonly ephemeralBlockDevices?: pulumi.Input<pulumi.Input<inputs.ec2.AmiFromInstanceEphemeralBlockDevice>[]>;
/**
* A region-unique name for the AMI.
*/
readonly name?: pulumi.Input<string>;
/**
* Boolean that overrides the behavior of stopping
* the instance before snapshotting. This is risky since it may cause a snapshot of an
* inconsistent filesystem state, but can be used to avoid downtime if the user otherwise
* guarantees that no filesystem writes will be underway at the time of snapshot.
*/
readonly snapshotWithoutReboot?: pulumi.Input<boolean>;
/**
* The id of the instance to use as the basis of the AMI.
*/
readonly sourceInstanceId: pulumi.Input<string>;
/**
* A mapping of tags to assign to the resource.
*/
readonly tags?: pulumi.Input<{[key: string]: any}>;
}