UNPKG

@pulumi/aws

Version:

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

105 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.InstanceProfile = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides an IAM instance profile. * * > **NOTE:** When managing instance profiles, remember that the `name` attribute must always be unique. This means that even if you have different `role` or `path` values, duplicating an existing instance profile `name` will lead to an `EntityAlreadyExists` error. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const assumeRole = aws.iam.getPolicyDocument({ * statements: [{ * effect: "Allow", * principals: [{ * type: "Service", * identifiers: ["ec2.amazonaws.com"], * }], * actions: ["sts:AssumeRole"], * }], * }); * const role = new aws.iam.Role("role", { * name: "test_role", * path: "/", * assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json), * }); * const testProfile = new aws.iam.InstanceProfile("test_profile", { * name: "test_profile", * role: role.name, * }); * ``` * * ## Import * * Using `pulumi import`, import Instance Profiles using the `name`. For example: * * ```sh * $ pulumi import aws:iam/instanceProfile:InstanceProfile test_profile app-instance-profile-1 * ``` */ class InstanceProfile extends pulumi.CustomResource { /** * Get an existing InstanceProfile 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 InstanceProfile(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of InstanceProfile. 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'] === InstanceProfile.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state?.arn; resourceInputs["createDate"] = state?.createDate; resourceInputs["name"] = state?.name; resourceInputs["namePrefix"] = state?.namePrefix; resourceInputs["path"] = state?.path; resourceInputs["role"] = state?.role; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; resourceInputs["uniqueId"] = state?.uniqueId; } else { const args = argsOrState; resourceInputs["name"] = args?.name; resourceInputs["namePrefix"] = args?.namePrefix; resourceInputs["path"] = args?.path; resourceInputs["role"] = args?.role; resourceInputs["tags"] = args?.tags; resourceInputs["arn"] = undefined /*out*/; resourceInputs["createDate"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; resourceInputs["uniqueId"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(InstanceProfile.__pulumiType, name, resourceInputs, opts); } } exports.InstanceProfile = InstanceProfile; /** @internal */ InstanceProfile.__pulumiType = 'aws:iam/instanceProfile:InstanceProfile'; //# sourceMappingURL=instanceProfile.js.map