@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
208 lines • 7.92 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.GameServerGroup = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides an GameLift Game Server Group resource.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.gamelift.GameServerGroup("example", {
* gameServerGroupName: "example",
* instanceDefinitions: [
* {
* instanceType: "c5.large",
* },
* {
* instanceType: "c5a.large",
* },
* ],
* launchTemplate: {
* id: exampleAwsLaunchTemplate.id,
* },
* maxSize: 1,
* minSize: 1,
* roleArn: exampleAwsIamRole.arn,
* }, {
* dependsOn: [exampleAwsIamRolePolicyAttachment],
* });
* ```
*
* Full usage:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.gamelift.GameServerGroup("example", {
* autoScalingPolicy: {
* estimatedInstanceWarmup: 60,
* targetTrackingConfiguration: {
* targetValue: 75,
* },
* },
* balancingStrategy: "SPOT_ONLY",
* gameServerGroupName: "example",
* gameServerProtectionPolicy: "FULL_PROTECTION",
* instanceDefinitions: [
* {
* instanceType: "c5.large",
* weightedCapacity: "1",
* },
* {
* instanceType: "c5.2xlarge",
* weightedCapacity: "2",
* },
* ],
* launchTemplate: {
* id: exampleAwsLaunchTemplate.id,
* version: "1",
* },
* maxSize: 1,
* minSize: 1,
* roleArn: exampleAwsIamRole.arn,
* tags: {
* Name: "example",
* },
* vpcSubnets: [
* "subnet-12345678",
* "subnet-23456789",
* ],
* }, {
* dependsOn: [exampleAwsIamRolePolicyAttachment],
* });
* ```
*
* ### Example IAM Role for GameLift Game Server Group
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const current = aws.getPartition({});
* const assumeRole = aws.iam.getPolicyDocument({
* statements: [{
* effect: "Allow",
* principals: [{
* type: "Service",
* identifiers: [
* "autoscaling.amazonaws.com",
* "gamelift.amazonaws.com",
* ],
* }],
* actions: ["sts:AssumeRole"],
* }],
* });
* const example = new aws.iam.Role("example", {
* assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json),
* name: "gamelift-game-server-group-example",
* });
* const exampleRolePolicyAttachment = new aws.iam.RolePolicyAttachment("example", {
* policyArn: current.then(current => `arn:${current.partition}:iam::aws:policy/GameLiftGameServerGroupPolicy`),
* role: example.name,
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import GameLift Game Server Group using the `name`. For example:
*
* ```sh
* $ pulumi import aws:gamelift/gameServerGroup:GameServerGroup example example
* ```
*/
class GameServerGroup extends pulumi.CustomResource {
/**
* Get an existing GameServerGroup 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 GameServerGroup(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of GameServerGroup. 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'] === GameServerGroup.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state?.arn;
resourceInputs["autoScalingGroupArn"] = state?.autoScalingGroupArn;
resourceInputs["autoScalingPolicy"] = state?.autoScalingPolicy;
resourceInputs["balancingStrategy"] = state?.balancingStrategy;
resourceInputs["gameServerGroupName"] = state?.gameServerGroupName;
resourceInputs["gameServerProtectionPolicy"] = state?.gameServerProtectionPolicy;
resourceInputs["instanceDefinitions"] = state?.instanceDefinitions;
resourceInputs["launchTemplate"] = state?.launchTemplate;
resourceInputs["maxSize"] = state?.maxSize;
resourceInputs["minSize"] = state?.minSize;
resourceInputs["region"] = state?.region;
resourceInputs["roleArn"] = state?.roleArn;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["vpcSubnets"] = state?.vpcSubnets;
}
else {
const args = argsOrState;
if (args?.gameServerGroupName === undefined && !opts.urn) {
throw new Error("Missing required property 'gameServerGroupName'");
}
if (args?.instanceDefinitions === undefined && !opts.urn) {
throw new Error("Missing required property 'instanceDefinitions'");
}
if (args?.launchTemplate === undefined && !opts.urn) {
throw new Error("Missing required property 'launchTemplate'");
}
if (args?.maxSize === undefined && !opts.urn) {
throw new Error("Missing required property 'maxSize'");
}
if (args?.minSize === undefined && !opts.urn) {
throw new Error("Missing required property 'minSize'");
}
if (args?.roleArn === undefined && !opts.urn) {
throw new Error("Missing required property 'roleArn'");
}
resourceInputs["autoScalingPolicy"] = args?.autoScalingPolicy;
resourceInputs["balancingStrategy"] = args?.balancingStrategy;
resourceInputs["gameServerGroupName"] = args?.gameServerGroupName;
resourceInputs["gameServerProtectionPolicy"] = args?.gameServerProtectionPolicy;
resourceInputs["instanceDefinitions"] = args?.instanceDefinitions;
resourceInputs["launchTemplate"] = args?.launchTemplate;
resourceInputs["maxSize"] = args?.maxSize;
resourceInputs["minSize"] = args?.minSize;
resourceInputs["region"] = args?.region;
resourceInputs["roleArn"] = args?.roleArn;
resourceInputs["tags"] = args?.tags;
resourceInputs["vpcSubnets"] = args?.vpcSubnets;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["autoScalingGroupArn"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(GameServerGroup.__pulumiType, name, resourceInputs, opts);
}
}
exports.GameServerGroup = GameServerGroup;
/** @internal */
GameServerGroup.__pulumiType = 'aws:gamelift/gameServerGroup:GameServerGroup';
//# sourceMappingURL=gameServerGroup.js.map
;