Builds Amazon Web Services CloudFormation parameters
Project description
cfp
cfp is a Python package for building Amazon Web Services CloudFormation stack parameters.
In particular, cfp helps to efficiently reference parameter values in Parameter Store, even across accounts and regions.
The output is compatible with boto3.
Examples
from cfp import StackParameters
sp = StackParameters()
sp.add("ParameterA", "Value A")
sp.add("ParameterB", "Value B")
print(sp.api)
[{'ParameterKey': 'ParameterA', 'ParameterValue': 'Value A'}, {'ParameterKey': 'ParameterB', 'ParameterValue': 'Value B'}]
The api
property can be passed directly to boto3:
from cfp import StackParameters
from boto3.session import Session
sp = StackParameters()
sp.add("ParameterA", "Value A")
sp.add("ParameterB", "Value B")
client = session.client("cloudformation")
client.create_change_set(
StackName="MyStack",
ChangeSetName="MyChangeSet",
ChangeSetType="UPDATE,
Parameters=sp.api,
TemplateBody="...",
)
To look-up a value in Systems Manager Parameter Store, set the parameter's value to a .FromParameterStore
instance:
from cfp import FromParameterStore, StackParameters
sp = StackParameters()
sp.add("ParameterA", FromParameterStore("/cfp/example1"))
sp.add("ParameterB", FromParameterStore("/cfp/example2"))
print(sp.api)
[{'ParameterKey': 'ParameterA', 'ParameterValue': 'foo'}, {'ParameterKey': 'ParameterB', 'ParameterValue': 'bar'}]
Read the full documentation at cariad.github.io/cfp.
👋 Hello!
Hello! I'm Cariad Eccleston and I'm an independent/freelance software engineer. If my work has value to you, please consider sponsoring.
If you ever raise a bug, request a feature or ask a question then mention that you're a sponsor and I'll respond as a priority. Thank you!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.