How to use stacker - 10 common examples

To help you get started, we’ve selected a few stacker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github remind101 / stacker_blueprints / tests / test_route53.py View on Github external
blueprint = DNSRecords('route53_both_hosted_zone_id_and_name_error',
                               self.ctx)
        blueprint.resolve_variables(
            [
                Variable(
                    "RecordSets",
                    [
                        {
                            "Name": "host.testdomain.com.",
                            "Type": "A",
                            "ResourceRecords": ["10.0.0.1"],
                        },
                    ]
                ),
                Variable("HostedZoneId", "fake_zone_id"),
                Variable("HostedZoneName", "fake_zone_name"),
            ]
        )
        with self.assertRaises(ValueError):
            blueprint.create_template()
github remind101 / stacker_blueprints / tests / test_aws_lambda.py View on Github external
def test_create_template_external_role(self):
        blueprint = Function('test_aws_lambda_Function_external_role',
                             self.ctx)
        blueprint.resolve_variables(
            [
                Variable(
                    "Code",
                    Code(S3Bucket="test_bucket", S3Key="code_key")
                ),
                Variable("Description", "Test function."),
                Variable("Environment", {"TEST_NAME": "test_value"}),
                Variable("Runtime", "python2.7"),
                Variable("Role", "my-fake-role"),
            ]
        )
        blueprint.create_template()
        self.assertRenderedBlueprint(blueprint)
github remind101 / stacker_blueprints / tests / test_aws_lambda.py View on Github external
def test_create_template_with_alias_provided_version(self):
        blueprint = Function(
            'test_aws_lambda_Function_with_alias_provided_version',
            self.ctx
        )
        blueprint.resolve_variables(
            [
                Variable(
                    "Code",
                    Code(S3Bucket="test_bucket", S3Key="code_key")
                ),
                Variable("Description", "Test function."),
                Variable("Environment", {"TEST_NAME": "test_value"}),
                Variable("Runtime", "python2.7"),
                Variable("AliasName", "prod"),
                Variable("AliasVersion", "1")
            ]
        )
        blueprint.create_template()
        self.assertRenderedBlueprint(blueprint)
github remind101 / stacker_blueprints / tests / test_route53.py View on Github external
self.ctx)
        blueprint.resolve_variables(
            [
                Variable(
                    "RecordSets",
                    [
                        {
                            "Name": "host.testdomain.com.",
                            "Type": "A",
                            "AliasTarget": {
                                "DNSName": "s3-website-us-east-1.amazonaws.com",  # noqa
                            },
                        },
                    ]
                ),
                Variable("HostedZoneId", "fake_zone_id"),
            ]
        )
        record_sets = blueprint.create_template()
        self.assertEqual(
            record_sets[0].AliasTarget.HostedZoneId, "Z3AQBSTGFYJSTF"
        )
github remind101 / stacker_blueprints / tests / test_aws_lambda.py View on Github external
def test_create_template_with_alias_partial_name(self):
        blueprint = Function(
            'test_aws_lambda_Function_with_alias_partial_name',
            self.ctx
        )
        blueprint.resolve_variables(
            [
                Variable(
                    "Code",
                    Code(S3Bucket="test_bucket", S3Key="code_key")
                ),
                Variable("Description", "Test function."),
                Variable("Environment", {"TEST_NAME": "test_value"}),
                Variable("Runtime", "python2.7"),
                Variable("AliasName", "prod"),
            ]
        )
        blueprint.create_template()
        self.assertRenderedBlueprint(blueprint)
github remind101 / stacker_blueprints / tests / test_aws_lambda.py View on Github external
def test_create_template_external_role(self):
        blueprint = Function('test_aws_lambda_Function_external_role',
                             self.ctx)
        blueprint.resolve_variables(
            [
                Variable(
                    "Code",
                    Code(S3Bucket="test_bucket", S3Key="code_key")
                ),
                Variable("Description", "Test function."),
                Variable("Environment", {"TEST_NAME": "test_value"}),
                Variable("Runtime", "python2.7"),
                Variable("Role", "my-fake-role"),
            ]
        )
        blueprint.create_template()
        self.assertRenderedBlueprint(blueprint)
github remind101 / stacker_blueprints / tests / test_efs.py View on Github external
def test_validate_subnets_empty(self):
        blueprint = ElasticFileSystem('test_efs_ElasticFileSystem', self.ctx)
        variables = EFS_VARIABLES.copy()
        variables['Subnets'] = []

        with self.assertRaises(ValidatorError):
            blueprint.resolve_variables(
                [Variable(k, v) for k, v in variables.items()])
github remind101 / stacker_blueprints / tests / test_s3.py View on Github external
def setUp(self):
        self.variables = [
            Variable('Buckets', {
                'Simple': {},
                'Cycle': {
                    'LifecycleConfiguration': {
                        'Rules': [{
                            'Status': 'Enabled',
                            'ExpirationInDays': 40,
                        }],
                    },
                }
            }),
            Variable('ReadRoles', [
                'Role1',
                'Role2',
            ]),
            Variable('ReadWriteRoles', [
                'Role3',
                'Role4',
            ]),
github remind101 / stacker_blueprints / tests / test_route53.py View on Github external
def test_create_template_hosted_zone_name(self):
        blueprint = DNSRecords('route53_dnsrecords_zone_name', self.ctx)
        blueprint.resolve_variables(
            [
                Variable(
                    "RecordSets",
                    [
                        {
                            "Name": "host.testdomain.com.",
                            "Type": "A",
                            "ResourceRecords": ["10.0.0.1"],
                        },
                        {
                            "Name": "host2.testdomain.com.",
                            "Type": "A",
                            "ResourceRecords": ["10.0.0.2"],
                            "Comment": "This is host2's record. : )",
                        },
                        {
                            "Name": "host3.testdomain.com.",
                            "Type": "A",
github remind101 / stacker_blueprints / tests / test_aws_lambda.py View on Github external
def test_create_template_with_alias_full_name_arn(self):
        blueprint = Function(
            'test_aws_lambda_Function_with_alias_full_name_arn',
            self.ctx
        )
        blueprint.resolve_variables(
            [
                Variable(
                    "Code",
                    Code(S3Bucket="test_bucket", S3Key="code_key")
                ),
                Variable("Description", "Test function."),
                Variable("Environment", {"TEST_NAME": "test_value"}),
                Variable("Runtime", "python2.7"),
                Variable("AliasName", "arn:aws:lambda:aws-region:"
                                      "acct-id:function:helloworld:PROD"),
            ]
        )
        blueprint.create_template()
        self.assertRenderedBlueprint(blueprint)