Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 11 additions & 16 deletions awsx-classic/apigateway/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -631,24 +631,16 @@ export function createAPI(parent: pulumi.Resource, name: string, args: APIArgs,
const deployment = new aws.apigateway.Deployment(name, {
...args.deploymentArgs,
restApi: restAPI,
// Note: Set to empty to avoid creating an implicit stage, we'll create it explicitly below instead.
stageName: "",
// Note: We set `variables` here because it forces recreation of the Deployment object
// whenever the body hash changes. Because we use a blank stage name above, there will
// not actually be any stage created in AWS, and thus these variables will not actually
// end up anywhere. But this will still cause the right replacement of the Deployment
// when needed. The Stage allocated below will be the stable stage that always points
// to the latest deployment of the API.
variables: { version },
variables: {
version: version,
},
description: args.deploymentArgs?.description,
}, {
parent,
dependsOn: apiPolicy ? [apiPolicy] : [],
});

const permissions = createLambdaPermissions(parent, deployment, name, swaggerLambdas);

// Expose the URL that the API is served at.
const url = pulumi.interpolate`${deployment.invokeUrl}${stageName}/`;
const permissions = createLambdaPermissions(parent, restAPI, name, swaggerLambdas);

// Create a stage, which is an addressable instance of the Rest API. Set it to point at the latest deployment.
const stage = new aws.apigateway.Stage(name, {
Expand All @@ -658,6 +650,9 @@ export function createAPI(parent: pulumi.Resource, name: string, args: APIArgs,
stageName: stageName,
}, { parent, dependsOn: permissions });

// Expose the URL that the API is served at.
const url = pulumi.interpolate`${stage.invokeUrl}${stageName}/`;

return {
restAPI,
deployment,
Expand All @@ -669,7 +664,7 @@ export function createAPI(parent: pulumi.Resource, name: string, args: APIArgs,
};
}

function createLambdaPermissions(parent: pulumi.Resource, deployment: aws.apigateway.Deployment, name: string, swaggerLambdas: SwaggerLambdas) {
function createLambdaPermissions(parent: pulumi.Resource, restAPI: aws.apigateway.RestApi, name: string, swaggerLambdas: SwaggerLambdas) {
const permissions: aws.lambda.Permission[] = [];
for (const [path, lambdas] of swaggerLambdas) {
for (const [method, lambda] of lambdas) {
Expand All @@ -683,7 +678,7 @@ function createLambdaPermissions(parent: pulumi.Resource, deployment: aws.apigat
// path on the API. We allow any stage instead of encoding the one known stage that will be
// deployed by Pulumi because the API Gateway console "Test" feature invokes the route
// handler with the fake stage `test-invoke-stage`.
sourceArn: pulumi.interpolate`${deployment.executionArn}*/${methodAndPath}`,
sourceArn: pulumi.interpolate`${restAPI.executionArn}*/${methodAndPath}`,
}, { parent }));
}
}
Expand Down Expand Up @@ -1084,7 +1079,7 @@ function addStaticRouteToSwaggerSpec(
}, { parent });
const attachment = new aws.iam.RolePolicyAttachment(key, {
role: role,
policyArn: aws.iam.ManagedPolicies.AmazonS3FullAccess,
policyArn: aws.iam.ManagedPolicy.AmazonS3FullAccess,
}, { parent });

return role;
Expand Down
2 changes: 1 addition & 1 deletion awsx-classic/autoscaling/launchConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class AutoScalingLaunchConfiguration extends pulumi.ComponentResource {
}

public static defaultInstanceProfilePolicyARNs() {
return [aws.iam.ManagedPolicies.AmazonEC2ContainerServiceforEC2Role, aws.iam.ManagedPolicies.AmazonEC2ReadOnlyAccess];
return [aws.iam.ManagedPolicy.AmazonEC2ContainerServiceforEC2Role, aws.iam.ManagedPolicy.AmazonEC2ReadOnlyAccess];
}

/**
Expand Down
9 changes: 3 additions & 6 deletions awsx-classic/ecs/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,9 @@ export function computeImageFromAsset(
throw new Error("Expected registry ID to be defined during push");
}

const credentials = await aws.ecr.getCredentials({ registryId: registryId }, { parent, async: true });
const decodedCredentials = Buffer.from(credentials.authorizationToken, "base64").toString();
const [username, password] = decodedCredentials.split(":");
if (!password || !username) {
throw new Error("Invalid credentials");
}
const credentials = await aws.ecr.getAuthorizationToken({ registryId: registryId }, { parent, async: true });
const username = credentials.userName;
const password = credentials.password;
return {
registry: credentials.proxyEndpoint,
username: username,
Expand Down
7 changes: 1 addition & 6 deletions awsx-classic/ecs/taskDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export abstract class TaskDefinition extends pulumi.ComponentResource {
public static defaultExecutionRolePolicyARNs() {
return [
"arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy",
aws.iam.ManagedPolicies.AWSLambdaBasicExecutionRole,
aws.iam.ManagedPolicy.AWSLambdaBasicExecutionRole,
];
}
}
Expand Down Expand Up @@ -337,11 +337,6 @@ export interface TaskDefinitionArgs {
*/
family?: pulumi.Input<string>;

/**
* Configuration block(s) with Inference Accelerators settings. Detailed below.
*/
inferenceAccelerators?: pulumi.Input<pulumi.Input<aws.types.input.ecs.TaskDefinitionInferenceAccelerator>[]>;

/**
* The IPC resource namespace to be used for the containers in the task The valid values are `host`, `task`, and `none`.
*/
Expand Down
41 changes: 22 additions & 19 deletions awsx-classic/package.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
{
"name": "@pulumi/awsx",
"version": "${VERSION}",
"name": "@pulumi/awsx-classic",
"version": "2.0.0-alpha.0",
"description": "Pulumi Amazon Web Services (AWS) infrastructure components.",
"license": "Apache-2.0",
"bin": "bin/index.js",
"keywords": [
"pulumi",
"aws",
"awsx"
],
"homepage": "https://pulumi.com",
"homepage": "https://pulumi.io",
"repository": "https://github.com/pulumi/pulumi-awsx",
"license": "Apache-2.0",
"scripts": {
"lint": "tslint -c tslint.json -p tsconfig.json"
"build": "tsc",
"install-tools": "go mod download",
"test": "jest",
"lint": "tslint --project .",
"format": "prettier --write ."
},
"dependencies": {
"@aws-sdk/client-ecs": "^3.405.0",
"@pulumi/aws": "^6.0.2",
"@pulumi/docker": "4.5.8",
"@pulumi/pulumi": "^3.34.0",
"aws-lambda": "^1.0.7",
"docker-classic": "npm:@pulumi/[email protected]",
"mime": "^3.0.0"
"@pulumi/aws": "7.0.0-alpha.2",
"@pulumi/pulumi": "^3.0.0"
},
"devDependencies": {
"@types/aws-lambda": "^8.10.23",
"@types/aws-sdk": "^2.7.0",
"@types/mime": "^3.0.0",
"@types/node": "^17.0.21",
"tslint": "^5.11.0",
"typedoc": "^0.13.0",
"typescript": "^4.6.2"
"@types/node": "^18.0.0",
"typescript": "^4.6.2",
"jest": "^27.0.0",
"ts-jest": "^27.0.0",
"tslint": "^6.1.0",
"prettier": "^2.0.0"
},
"engines": {
"node": ">=14"
}
}
37 changes: 15 additions & 22 deletions awsx-classic/tests/package.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,31 @@
{
"name": "@pulumi/awsx",
"version": "${VERSION}",
"description": "A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.",
"name": "@pulumi/awsx-classic-tests",
"version": "2.0.0-alpha.0",
"description": "Tests for Pulumi Amazon Web Services (AWS) infrastructure components.",
"keywords": [
"pulumi",
"aws"
"aws",
"awsx",
"testing"
],
"homepage": "https://pulumi.io",
"repository": "https://github.com/pulumi/pulumi-aws",
"repository": "https://github.com/pulumi/pulumi-awsx",
"license": "Apache-2.0",
"scripts": {
"test": "jest",
"build": "tsc"
},
"dependencies": {
"@pulumi/pulumi": "^3.0.0",
"@pulumi/aws": "^6.0.0",
"builtin-modules": "3.0.0",
"mime": "^2.0.0",
"resolve": "^1.7.1",
"mocha": "^3.5.0",
"chai": "^4.2.0",
"proxyquire": "^2.1.0",
"semver": "^6.0.0",
"js-combinatorics": "^0.5.4"
"@pulumi/aws": "7.0.0-alpha.2",
"@pulumi/pulumi": "^3.0.0"
},
"devDependencies": {
"@types/mime": "^2.0.0",
"@types/mocha": "^2.2.42",
"@types/node": "^18.0.0",
"@types/semver": "^6.0.0",
"@types/js-combinatorics": "^0.5.31",
"typescript": "^4.6.2"
"typescript": "^4.6.2",
"jest": "^27.0.0",
"ts-jest": "^27.0.0"
},
"pulumi": {
"resource": true
"engines": {
"node": ">=14"
}
}
7 changes: 4 additions & 3 deletions awsx/ec2/vpc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,10 @@ describe("child resource api", () => {
case "aws:index/getAvailabilityZones:getAvailabilityZones":
const result: pulumiAws.GetAvailabilityZonesResult = {
id: "mocked-az-result",
zoneIds: [1, 2, 3].map((i) => `${pulumiAws.USEast1Region}${i}`),
names: [1, 2, 3].map((i) => `${pulumiAws.USEast1Region}${i}`),
groupNames: [1, 2, 3].map((i) => `${pulumiAws.USEast1Region}${i}`),
region: pulumiAws.Region.USEast1,
zoneIds: [1, 2, 3].map((i) => `${pulumiAws.Region.USEast1}${i}`),
names: [1, 2, 3].map((i) => `${pulumiAws.Region.USEast1}${i}`),
groupNames: [1, 2, 3].map((i) => `${pulumiAws.Region.USEast1}${i}`),
};
return result;
default:
Expand Down
2 changes: 1 addition & 1 deletion awsx/ecr/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export function getDockerCredentials(
registryId = hostnameParts[0];
}

const ecrCredentials = aws.ecr.getCredentialsOutput({ registryId: registryId }, opts);
const ecrCredentials = aws.ecr.getAuthorizationTokenOutput({ registryId: registryId }, opts);

return ecrCredentials.apply((creds) => {
const decodedCredentials = Buffer.from(creds.authorizationToken, "base64").toString();
Expand Down
7 changes: 3 additions & 4 deletions awsx/ecr/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ function buildLifecyclePolicy(
function convertRules(
rules: pulumi.Unwrap<schema.lifecyclePolicyRuleInputs>[],
): aws.ecr.LifecyclePolicyDocument {
const result: aws.ecr.LifecyclePolicyDocument = { rules: [] };

const nonAnyRules = rules.filter((r) => r.tagStatus !== "any");
const anyRules = rules.filter((r) => r.tagStatus === "any");

Expand All @@ -82,13 +80,14 @@ function convertRules(
// Place the 'any' rule last so it has higest priority.
const orderedRules = [...nonAnyRules, ...anyRules];

const policyRules: aws.ecr.PolicyRule[] = [];
let rulePriority = 1;
for (const rule of orderedRules) {
result.rules.push(convertRule(rule, rulePriority));
policyRules.push(convertRule(rule, rulePriority));
rulePriority++;
}

return result;
return { rules: policyRules };
}

function convertRule(
Expand Down
2 changes: 1 addition & 1 deletion awsx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
"//": "Pulumi sub-provider dependencies must be pinned at an exact version because we extract this value to generate the correct dependency in the schema",
"dependencies": {
"@pulumi/aws": "6.66.3",
"@pulumi/aws": "7.0.0-alpha.2",
"@pulumi/docker": "4.6.0",
"@pulumi/docker-build": "0.0.8",
"@pulumi/pulumi": "3.160.0",
Expand Down
Loading
Loading