Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract 'aws-infra' types into their own package independent of cloud-aws #472

Merged
merged 12 commits into from May 4, 2018
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -2,4 +2,5 @@
**/bin/
**/node_modules/
vendor/
**/Pulumi.*.yaml
**/Pulumi.*.yaml
**/yarn-error.log
2 changes: 1 addition & 1 deletion Makefile
@@ -1,5 +1,5 @@
PROJECT_NAME := Pulumi Cloud Platform
SUB_PROJECTS := api mock aws examples/integration
SUB_PROJECTS := api mock aws-infra aws examples/integration
include build/common.mk


Expand Down
21 changes: 21 additions & 0 deletions aws-infra/Makefile
@@ -0,0 +1,21 @@
PROJECT_NAME := Pulumi AWS Infrastructure
NODE_MODULE_NAME := @pulumi/aws-infra
include ../build/common.mk

VERSION := $(shell ../scripts/get-version)

export PATH := $(shell yarn bin 2>/dev/null):$(PATH)

TESTPARALLELISM := 10

build::
yarn install
yarn link @pulumi/pulumi @pulumi/aws
tsc
sed -e 's/\$${VERSION}/$(VERSION)/g' < package.json > bin/package.json
cp ../README.md ../LICENSE bin/

lint::
tslint -c ../tslint.json -p tsconfig.json

test_all::
File renamed without changes.
2 changes: 1 addition & 1 deletion aws/infrastructure/cluster.ts → aws-infra/cluster.ts
Expand Up @@ -5,7 +5,7 @@ import * as pulumi from "@pulumi/pulumi";

import { Network } from "./network";

import { liftResource, sha1hash } from "../utils";
import { sha1hash } from "./utils";

// The default path to use for mounting EFS inside ECS container instances.
const defaultEfsMountPath = "/mnt/efs";
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion aws/infrastructure/network.ts → aws-infra/network.ts
Expand Up @@ -4,7 +4,6 @@ import * as aws from "@pulumi/aws";
import * as pulumi from "@pulumi/pulumi";
import { RunError } from "@pulumi/pulumi/errors";

import { externalSecurityGroups, externalSubnets, externalVpcId, usePrivateNetwork } from "../config";
import { getAwsAz } from "./aws";

export interface NetworkArgs {
Expand Down
28 changes: 28 additions & 0 deletions aws-infra/package.json
@@ -0,0 +1,28 @@
{
"name": "@pulumi/aws-infra",
"version": "${VERSION}",
"description": "Pulumi Amazon Web Services (AWS) infrastructure components.",
"keywords": [
"pulumi",
"cloud",
"aws"
],
"homepage": "https://pulumi.io/cloud-aws",
"repository": "https://github.com/pulumi/pulumi-cloud",
"dependencies": {
"mime": "^2.0.3",
"semver": "^5.4.0"
},
"devDependencies": {
"@types/aws-sdk": "^2.7.0",
"@types/node": "^8.0.26",
"@types/mime": "^2.0.0",
"@types/semver": "^5.4.0",
"tslint": "^5.7.0",
"typescript": "^2.6.2"
},
"peerDependencies": {
"@pulumi/aws": "^0.11.1-dev-1523150138-g0d75d81",
"@pulumi/pulumi": "^0.11.1-dev-1523390330-g479a2e6a"
}
}
25 changes: 25 additions & 0 deletions aws-infra/tsconfig.json
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"outDir": "bin",
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"declaration": true,
"sourceMap": true,
"stripInternal": true,
"experimentalDecorators": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"forceConsistentCasingInFileNames": true,
"strictNullChecks": true
},
"files": [
"index.ts",
"aws.ts",
"cluster.ts",
"network.ts",
"utils.ts",
]
}

12 changes: 12 additions & 0 deletions aws-infra/utils.ts
@@ -0,0 +1,12 @@
// Copyright 2016-2017, Pulumi Corporation. All rights reserved.

import * as crypto from "crypto";

// sha1hash returns a partial SHA1 hash of the input string.
export function sha1hash(s: string): string {
const shasum: crypto.Hash = crypto.createHash("sha1");
shasum.update(s);
// TODO[pulumi/pulumi#377] Workaround for issue with long names not generating per-deplioyment randomness, leading
// to collisions. For now, limit the size of hashes to ensure we generate shorter/ resource names.
return shasum.digest("hex").substring(0, 8);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this code was copied. but it's so simple i don't mind that.