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

Add SSM resolver #67

Merged
merged 2 commits into from
Jun 15, 2021
Merged

Add SSM resolver #67

merged 2 commits into from
Jun 15, 2021

Conversation

ocrawford555
Copy link
Contributor

AWS SSM can store values of parameters which end up getting used in CloudFormation templates. We currently have no support of these values in the templates and cannot perform accurate analysis when used.

This PR should be able to handle cases of {{resolve:ssm:parameter-name:version}}.

def test_resolve_ssm():
    template = {
        "AWSTemplateFormatVersion": "2010-09-09",
        "Description": "Test resolving SSM dynamic values",
        "Resources": {
            "InstanceHTTPTargets": {
                "Type": "Custom::DynamicNLBTarget",
                "Properties": {
                    "ServiceArn": "{{resolve:ssm:some-service-arn:1}}",
                    "Cluster": "{{resolve:ssm:main-k8s-cluster-arn:3}}",
                },
            }
        },
    }
    model = parse(template).resolve(extra_params={"some-service-arn:1": "vpc-123-abc"})
    assert model.Resources["InstanceHTTPTargets"].Properties == {
        "Cluster": "UNDEFINED_PARAM_main-k8s-cluster-arn:3",
        "ServiceArn": "vpc-123-abc",
    }

Copy link
Contributor

@ignaciobolonio ignaciobolonio left a comment

Choose a reason for hiding this comment

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

LGTM

@ocrawford555 ocrawford555 merged commit cd579da into master Jun 15, 2021
@w0rmr1d3r w0rmr1d3r deleted the use-ssm-values-v2 branch September 23, 2022 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants