sparse-intern-71089
10/07/2018, 2:02 AMquiet-wolf-18467
brave-angle-33257
10/07/2018, 5:14 PMmake deploy-compute:
cd ${PWD}/network
NETWORK=$(pulumi output)
cd ${PWD}/data
DATA=$(pulumi output)
cd ${PWD}/compute
pulumi config set ${DATA}
pulumi config set ${NETWORK}
pulumi update
make deploy-all:
cd ${PWD}/network
pulumi update
NETWORK=$(pulumi output)
cd ${PWD}/data
pulumi config set {$NETWORK}
pulumi update
DATA=$(pulumi output)
cd ${PWD}/compute
pulumi config set ${DATA}
pulumi config set ${NETWORK}
pulumi update
no idea if it will work properly, but from what I see that's more or less how you'd have to do it.. would love to hear other opinionsglamorous-printer-66548
10/07/2018, 9:49 PMterragrunt apply-all
) and respect the dependencies between them for ordering: https://github.com/gruntwork-io/terragrunt#the-apply-all-destroy-all-output-all-and-plan-all-commands . I wonder if pulumi could introduce something similar @creamy-potato-29402 ? Should I open an issue?
In general currently I minimize the need to pass around outputs from one stack to another by simply using predictable resource identifiers (which is easy in GCP), shared TS libs / modules / constants and getting other data like the IP addresses of a GKE cluster, by using pulumi’s get<Resource>
functions (e.g. getCluster
).
Terraform btw also has the ability to query the state of another module directly https://www.terraform.io/docs/providers/terraform/d/remote_state.html#example-usage which is another way of sharing config between stacks. Maybe worth another pulumi feature request? 🙂brave-angle-33257
10/08/2018, 2:07 AM$ pulumi select deployment prod
$ pulumi stacks
pulumi:
mycompany-prod-network
mycompany-prod-security-group
mycompany-prod-rds-api
mycompany-prod-rds-app
mycompany-prod-asg-app
mycompany-prod-lambda
$ pulumi stack detail rds-app
aws:rds:postgres/AppTracking
aws:rds:mysql/AppUser
$ pulumi stack detail lambda
aws:lambda:function/Login
aws:lambda:function/Logout
aws:iam:role/LoginRole
aws:iam:role/LogoutRole
Furthermore, I could maybe create a group, and using the upcoming RBAC control allow users to deploy that group as one unit, or any of the individual items inside, like an app-compute group, that might be ASG and Lambda.
$ pulumi select deployment prod
$ pulumi create group app-compute --stack asg-app --stack lambda
$ pulumi group detail app-compute
mycompany-prod-asg-app
mycompany-prod-lambda
$ pulumi group update app-compute
(updating)...
I realize this is pretty different than what they have currently, but to me it makes a lot of sense for how I've been arranging things in the past using some internal tools. I'm going to spend some time seeing how feasible my make
approach would work.glamorous-printer-66548
10/08/2018, 2:53 AMmyawesomeapp-staging
and can include various things like: container image, k8s Service, Deployment, IAM service accounts and the role bindings to that account, backing services like the db, redis cache (if not shared by other apps), a supporting cloud function (lambda), alerting rules etc. To create or remove a new app I just want to touch one stack and not changing 5/6 stacks and then be super careful in which order I have to deploy them etc..
This is just my personal opinion, your project structure may work very well too, but as stated above my goal is to give developers a lot of control and responsibility about their application AND the application-specific infrastructure and not become the ops / devops gatekeeper.
In fact I had wednesday an internal pulumi demo in front of some team members incl. the CTO and now regular developers already start modifying their app specific pulumi code on their own which signals to me that this works.glamorous-printer-66548
10/08/2018, 3:12 AMglamorous-printer-66548
10/08/2018, 3:22 AMbrave-angle-33257
10/08/2018, 4:03 AMglamorous-printer-66548
10/08/2018, 4:23 AMbrave-angle-33257
10/08/2018, 4:31 AMglamorous-printer-66548
10/08/2018, 4:43 AMimport .. from
, export, arrow functions etc. is just official JavaScript (its in the spec) that has been introduced in the JS language over the last couple of years and which is worth to learn anyways if you’re dealing somewhere with JS. When I first poached TS in my team some people were scared and argued that TypeScript is so different and “non-standard” compared to JS. I told and showed them then that almost all the code I’ve shown just uses standard modern JS syntax features that they should learn anyways about unless they’re just targeting IE10 …brave-angle-33257
10/08/2018, 4:46 AMbrave-angle-33257
10/09/2018, 12:53 AMpulumi update
it's erroring with missing packages. I'd just like to make sure there's not something extra I need in my tsconfig.json or similar.glamorous-printer-66548
10/09/2018, 12:55 AMglamorous-printer-66548
10/09/2018, 12:59 AMbrave-angle-33257
10/09/2018, 2:03 AM"dependencies": {
"@pulumi/azure": "latest",
"@pulumi/pulumi": "latest",
"@types/js-yaml": "latest"
}
to the package.json, do a npm install
and then in my IDE it shows the package as available, but when i run via pulumi update
it says not found.. it's probably something stupid but so far kicking my buttbrave-angle-33257
10/09/2018, 2:05 AMhttps://s3-us-west-2.amazonaws.com/billeci-screenshots/index.ts__Untitled_Workspace_2018-10-08_19-04-05.png▾
brave-angle-33257
10/09/2018, 2:05 AMhttps://s3-us-west-2.amazonaws.com/billeci-screenshots/Development__Development__tmux_new_-s_pulumi__20567_2018-10-08_19-05-18.png▾
glamorous-printer-66548
10/09/2018, 2:20 AMlatest
in your package.json. Simply run npm install <package_name>
which will generate an entry in your package.json with the latest version. I usually also set npm config set save-exact true
in my environment which will generate strict semver entries instead of a range like ^<version>
. Also make sure to check-in the package-lock.json if one got generated.glamorous-printer-66548
10/09/2018, 2:22 AMpulumi update
. Just use pulumi up
as seen in most examples. Using pulumi update
you will just confuse people like me that never have seen this command before 😄glamorous-printer-66548
10/09/2018, 2:25 AMnpm install
3. Where is your Pulumi.yaml
4. what value is in the “main” field of your package.json
5. What is the content of your Pulumi.yaml
6. In which working directory did you execute pulumi up?brave-angle-33257
10/09/2018, 2:29 AM#1 in the main root of the project
#2 from that folder
#3 same folder
#4 don't see a "main" (below)
#5 (below)
#6 same
brave-angle-33257
10/09/2018, 2:30 AM$ cat package.json
{
"name": "core-rg",
"devDependencies": {
"@types/node": "latest"
},
"dependencies": {
"@pulumi/azure": "latest",
"@pulumi/pulumi": "latest",
}
}
brave-angle-33257
10/09/2018, 2:30 AM$ cat Pulumi.yaml
name: core-rg
runtime: nodejs
description: A minimal Azure TypeScript Pulumi program
template:
description: A minimal Azure TypeScript Pulumi program
config:
azure:environment:
description: The Azure environment to use (`public`, `usgovernment`, `german`,
`china`)
default: public
brave-angle-33257
10/09/2018, 2:31 AM$ pwd
~/projects/pulumi/core-rg
$ ls -l
total 120
-rw------- 1 me staff 309 Oct 8 16:06 Pulumi.yaml
-rw------- 1 me staff 1467 Oct 8 19:21 index.ts
drwxr-xr-x 74 me staff 2368 Oct 8 17:31 node_modules
-rw-r--r-- 1 me staff 42378 Oct 8 18:58 package-lock.json
-rw------- 1 me staff 265 Oct 8 18:58 package.json
drwxr-xr-x 3 me staff 96 Oct 8 16:52 src
-rw------- 1 me staff 522 Oct 8 19:19 tsconfig.json
glamorous-printer-66548
10/09/2018, 2:31 AMbrave-angle-33257
10/09/2018, 2:32 AMglamorous-printer-66548
10/09/2018, 2:32 AMjs-yaml
as dependency?glamorous-printer-66548
10/09/2018, 2:32 AMbrave-angle-33257
10/09/2018, 2:33 AMglamorous-printer-66548
10/09/2018, 2:33 AM@types/js-yaml !== js-yaml
brave-angle-33257
10/09/2018, 2:33 AM$ cat package.json
{
"name": "core-rg",
"devDependencies": {
"@types/node": "latest"
},
"dependencies": {
"@pulumi/azure": "latest",
"@pulumi/pulumi": "latest",
"@types/sprintf-js": "^1.1.0"
}
}
glamorous-printer-66548
10/09/2018, 2:33 AMbrave-angle-33257
10/09/2018, 2:34 AMbrave-angle-33257
10/09/2018, 2:34 AMbrave-angle-33257
10/09/2018, 2:35 AMbrave-angle-33257
10/09/2018, 2:35 AMbrave-angle-33257
10/09/2018, 2:35 AMbrave-angle-33257
10/09/2018, 2:35 AMDiagnostics:
pulumi:pulumi:Stack: core-rg-core-rg-dev
info: { greeting: 'hello', name: 'world' }
brave-angle-33257
10/09/2018, 2:36 AMimport * as jsyaml from "js-yaml";
let doc = jsyaml.load('greeting: hello\nname: world');
console.log(doc)
brave-angle-33257
10/09/2018, 2:36 AM$ npm install js-yaml --save
$ npm install @types/js-yaml --save
brave-angle-33257
10/09/2018, 2:36 AMbrave-angle-33257
10/09/2018, 2:37 AMglamorous-printer-66548
10/09/2018, 2:38 AM.d.ts
files with contain the types).
- some packages (for example lodash) don’t come with typescript type definitions out of the box, often because the original author doesn’t use typescript himself. What then happens is that often the typescript community writes seperate type definitions for those packages which are published with the prefix @types, e.g. @types/lodash. So in case of lodash the actual runtime code is in the package “lodash” but if you want better type checking and code completion you CAN (you don’t have to, your code will run nevertheless) include the community type definitions by adding @types/lodash in addition to your package.jsonbrave-angle-33257
10/09/2018, 2:41 AMbrave-angle-33257
10/09/2018, 2:41 AMbrave-angle-33257
10/09/2018, 2:42 AMbrave-angle-33257
10/09/2018, 2:42 AMrgname = '{}-{}-{}'.format(
resource_type,
env_id,
region['id']
)
brave-angle-33257
10/09/2018, 2:43 AMbrave-angle-33257
10/09/2018, 2:43 AMglamorous-printer-66548
10/09/2018, 2:43 AMbrave-angle-33257
10/09/2018, 2:43 AMglamorous-printer-66548
10/09/2018, 2:43 AMrgname = `${resource_type}-${env_id}-${region.id}`;
brave-angle-33257
10/09/2018, 2:44 AMbrave-angle-33257
10/09/2018, 2:45 AMglamorous-printer-66548
10/09/2018, 2:45 AM.format
things always so ugly to see 😄 . Fortunately we use python 3.6 internally which has support for f strings which is similar to JS template literals.brave-angle-33257
10/09/2018, 2:46 AMglamorous-printer-66548
10/09/2018, 2:46 AMglamorous-printer-66548
10/09/2018, 2:47 AMbrave-angle-33257
10/09/2018, 2:47 AMbrave-angle-33257
10/09/2018, 2:47 AMglamorous-printer-66548
10/09/2018, 2:48 AMbrave-angle-33257
10/09/2018, 2:48 AMbrave-angle-33257
10/09/2018, 2:48 AMglamorous-printer-66548
10/09/2018, 2:50 AMbrave-angle-33257
10/09/2018, 2:51 AMbrave-angle-33257
10/09/2018, 2:51 AMbrave-angle-33257
10/09/2018, 2:52 AMbrave-angle-33257
10/09/2018, 2:52 AMbrave-angle-33257
10/09/2018, 2:53 AMbrave-angle-33257
10/09/2018, 2:53 AMglamorous-printer-66548
10/09/2018, 2:53 AMbrave-angle-33257
10/09/2018, 2:53 AMbrave-angle-33257
10/09/2018, 2:54 AMglamorous-printer-66548
10/09/2018, 2:55 AMglamorous-printer-66548
10/09/2018, 2:57 AMbrave-angle-33257
10/09/2018, 2:58 AMbrave-angle-33257
10/09/2018, 2:58 AMbrave-angle-33257
10/09/2018, 2:59 AMglamorous-printer-66548
10/09/2018, 3:00 AMbrave-angle-33257
10/09/2018, 3:01 AMglamorous-printer-66548
10/09/2018, 3:02 AMglamorous-printer-66548
10/09/2018, 3:04 AMbrave-angle-33257
10/09/2018, 3:04 AMbrave-angle-33257
10/09/2018, 3:05 AMbrave-angle-33257
10/09/2018, 3:05 AMbrave-angle-33257
10/09/2018, 3:06 AMbrave-angle-33257
10/09/2018, 3:07 AMbrave-angle-33257
10/09/2018, 3:08 AMbrave-angle-33257
10/09/2018, 3:08 AMglamorous-printer-66548
10/09/2018, 3:12 AMbrave-angle-33257
10/09/2018, 3:16 AMbrave-angle-33257
10/09/2018, 3:17 AMbrave-angle-33257
10/09/2018, 3:18 AMbrave-angle-33257
10/09/2018, 3:26 AMbrave-angle-33257
10/09/2018, 3:26 AMglamorous-printer-66548
10/09/2018, 3:26 AMglamorous-printer-66548
10/09/2018, 3:27 AMglamorous-printer-66548
10/09/2018, 3:29 AM