Pulumi
Last updated
Was this helpful?
Last updated
Was this helpful?
This walkthrough shows you how to pass CloudTruth parameters to Pulumi.
You know basic .
AWS CLI .
You have created a and installed the .
For this example we will deploy an EC2 instance defining variables with CloudTruth parameters. You can use any target for your deploys.
Create a CloudTruth Project called Pulumi
.
Now you can create CloudTruth parameters in the Pulumi project that we will pass to Pulumi as values.
Note: If you have never used Pulumi before you will be prompted to login after running pulumi new
.
You will be prompted to provide a project name, description, stack name, and AWS region. The sensible defaults are fine for all of these.
Next, you must create your Pulumi configuration file. From the Pulumi project directory just created in the last step, update your __main__.py
with the following configuration:
This __main__.py
will deploy an EC2 instance to us-east-1 and defines three variables that are centrally managed by CloudTruth.
The last step is to use pulumi up
to deploy your Pulumi configuration. Pass in your CloudTruth template created earlier to fill the configuration parameters. This is assuming the project is named Pulumi and the template is named pulumi-aws-template.
Congrats! You have now deployed an instance in EC2 leveraging Pulumi and CloudTruth configuration! 🙌
To tear down all resources, simply run pulumi destroy
in the project directory.
In order for Pulumi to accept run-time configuration parameters, they must be in a . We can leverage CloudTruth to transform config data to output them in Pulumi's required format.
For this specific example, create a CloudTruth template named pulumi-aws-template
directly from a we have created in GitHub for this demo:
This has the following Pulumi config that dynamically references CloudTruth parameters using mustache syntax:
--config ami={{ami}} --config instance_type={{instance_type}} --config availability_zones={{{availability_zones}}}
To work with Pulumi, we must start a new . For this example we will be using AWS cloud with the Python programming language. To get started run:
Pulumi requires to deploy to AWS. If you already have the AWS CLI installed and configured, then Pulumi will respect those configuration settings.