From c7cf24b4948e79c40ddbbf55234151a513185327 Mon Sep 17 00:00:00 2001 From: Luke Hoban Date: Wed, 14 Nov 2018 20:58:18 -0800 Subject: [PATCH] Update Python examples to support Pulumi >= 0.16.4 (#180) Fixes #179. --- .gitignore | 3 +++ aws-py-stepfunctions/__main__.py | 6 +++--- aws-py-stepfunctions/requirements.txt | 4 ++-- aws-py-webserver/README.md | 8 ++++++-- aws-py-webserver/__main__.py | 4 ++-- aws-py-webserver/requirements.txt | 4 ++-- 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 11f7b8a42..4be171848 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,9 @@ bin/ node_modules/ *.pyc +.Python +include/ +lib/ yarn.lock package-lock.json Pulumi.*.yaml diff --git a/aws-py-stepfunctions/__main__.py b/aws-py-stepfunctions/__main__.py index 21ad5bced..a5667ec05 100644 --- a/aws-py-stepfunctions/__main__.py +++ b/aws-py-stepfunctions/__main__.py @@ -15,7 +15,7 @@ state_defn = state_machine = sfn.StateMachine('stateMachine', role_arn=iam.sfn_role.arn, - definition="""{ + definition=hello_world_fn.arn.apply(lambda arn: """{ "Comment": "A Hello World example of the Amazon States Language using an AWS Lambda Function", "StartAt": "HelloWorld", "States": { @@ -25,7 +25,7 @@ "End": true } } - }""" % hello_world_fn.arn + }""" % arn) ) -pulumi.output('state_machine_arn', state_machine.id) +pulumi.export('state_machine_arn', state_machine.id) diff --git a/aws-py-stepfunctions/requirements.txt b/aws-py-stepfunctions/requirements.txt index 451563a56..63fb1b066 100644 --- a/aws-py-stepfunctions/requirements.txt +++ b/aws-py-stepfunctions/requirements.txt @@ -1,2 +1,2 @@ -pulumi>=0.15.0 -pulumi-aws>=0.15.0 +pulumi>=0.16.4 +pulumi-aws>=0.16.2 diff --git a/aws-py-webserver/README.md b/aws-py-webserver/README.md index a34087a6b..16c6bce23 100644 --- a/aws-py-webserver/README.md +++ b/aws-py-webserver/README.md @@ -10,12 +10,16 @@ To get the correct Amazon Linux AMI for the instance size and region, a mapping ## Prerequisites 1. [Install Pulumi](https://pulumi.io/install/) -1. [Configure Pulumi for AWS](https://pulumi.io/install/aws-config.html) +1. [Configure Pulumi for AWS](https://pulumi.io/quickstart/aws/setup.html) 1. [Configure Pulumi for Python](https://pulumi.io/reference/python.html) ## Deploying and running the program -1. Login to the Pulumi CLI via `pulumi login`. +1. Install dependencies (a `virtualenv` is recommended - see [Pulumi Python docs](https://pulumi.io/reference/python.html)): + + ``` + $ pip install -r requirements.txt + ``` 1. Create a new stack: diff --git a/aws-py-webserver/__main__.py b/aws-py-webserver/__main__.py index f18c4c772..94133b93b 100644 --- a/aws-py-webserver/__main__.py +++ b/aws-py-webserver/__main__.py @@ -24,5 +24,5 @@ user_data=user_data, ami=get_linux_ami(size)) -pulumi.output('public_ip', server.public_ip) -pulumi.output('public_dns', server.public_dns) +pulumi.export('public_ip', server.public_ip) +pulumi.export('public_dns', server.public_dns) diff --git a/aws-py-webserver/requirements.txt b/aws-py-webserver/requirements.txt index 451563a56..63fb1b066 100644 --- a/aws-py-webserver/requirements.txt +++ b/aws-py-webserver/requirements.txt @@ -1,2 +1,2 @@ -pulumi>=0.15.0 -pulumi-aws>=0.15.0 +pulumi>=0.16.4 +pulumi-aws>=0.16.2