@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
100 lines • 4.11 kB
JavaScript
;
// *** 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.Association = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a License Manager association.
*
* > **Note:** License configurations can also be associated with launch templates by specifying the `licenseSpecifications` block for an `aws.ec2.LaunchTemplate`.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = aws.ec2.getAmi({
* mostRecent: true,
* owners: ["amazon"],
* filters: [{
* name: "name",
* values: ["amzn-ami-vpc-nat*"],
* }],
* });
* const exampleInstance = new aws.ec2.Instance("example", {
* ami: example.then(example => example.id),
* instanceType: aws.ec2.InstanceType.T2_Micro,
* });
* const exampleLicenseConfiguration = new aws.licensemanager.LicenseConfiguration("example", {
* name: "Example",
* licenseCountingType: "Instance",
* });
* const exampleAssociation = new aws.licensemanager.Association("example", {
* licenseConfigurationArn: exampleLicenseConfiguration.arn,
* resourceArn: exampleInstance.arn,
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import license configurations using `resource_arn,license_configuration_arn`. For example:
*
* ```sh
* $ pulumi import aws:licensemanager/association:Association example arn:aws:ec2:eu-west-1:123456789012:image/ami-123456789abcdef01,arn:aws:license-manager:eu-west-1:123456789012:license-configuration:lic-0123456789abcdef0123456789abcdef
* ```
*/
class Association extends pulumi.CustomResource {
/**
* Get an existing Association 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 Association(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Association. 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'] === Association.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["licenseConfigurationArn"] = state?.licenseConfigurationArn;
resourceInputs["region"] = state?.region;
resourceInputs["resourceArn"] = state?.resourceArn;
}
else {
const args = argsOrState;
if (args?.licenseConfigurationArn === undefined && !opts.urn) {
throw new Error("Missing required property 'licenseConfigurationArn'");
}
if (args?.resourceArn === undefined && !opts.urn) {
throw new Error("Missing required property 'resourceArn'");
}
resourceInputs["licenseConfigurationArn"] = args?.licenseConfigurationArn;
resourceInputs["region"] = args?.region;
resourceInputs["resourceArn"] = args?.resourceArn;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Association.__pulumiType, name, resourceInputs, opts);
}
}
exports.Association = Association;
/** @internal */
Association.__pulumiType = 'aws:licensemanager/association:Association';
//# sourceMappingURL=association.js.map