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

environment can override stack values #34

Open
atward opened this issue Apr 18, 2017 · 5 comments
Open

environment can override stack values #34

atward opened this issue Apr 18, 2017 · 5 comments

Comments

@atward
Copy link
Collaborator

atward commented Apr 18, 2017

User story: Be able to define a set of tags and use them throughout the configuration.
It is a common use case for organisations to define a tagging standard and require that tags are applied to all resources.
Initial implementation from user is to use yaml aliases on mappings (eg: common_tags: &tags) however this is only valid within a single file.

Propose extending Environment to include tags and have that merged over the top of Stack.tags.

Raising this issue to solicit design feedback.

@atward
Copy link
Collaborator Author

atward commented Apr 18, 2017

Seems like this is already supported by bespin.collector converter (bespin/collector.py#L177)

Suggest updating docs to include details/examples.

@atward atward changed the title Environment.tags support Add documentation about environment overrides Apr 18, 2017
@delfick
Copy link
Owner

delfick commented Apr 18, 2017

are you able to try it and see if that works, afaict it'll actually ignore tags if you define it in the environment because https://github.com/delfick/bespin/blob/master/bespin/option_spec/bespin_specs.py#L180 doesn't know about tags.

(that spec is installed on the configuration here https://github.com/delfick/bespin/blob/master/bespin/collector.py#L135)

@atward
Copy link
Collaborator Author

atward commented Apr 18, 2017

does not care

---
environments:
  poc:
    tags:
      tag_at_env: env_override
      environment: "{environment}"
    cruft: that no one should care about

stacks:
  a:
    stack_yaml: "{config_root}/user.yaml"
    stack_policy: "{config_root}/stack_policy.json"
    params_yaml: {}

    tags:
      tags_at_stack: stack

    poc:
      tags:
        tag_env_override: stack_env_override
$ bespin deploy poc a 2>/dev/null && aws cloudformation describe-stacks --stack a --query 'Stacks[].Tags' --output text
Building - a
[]
environment	poc
tags_at_stack	stack
tag_at_env	env_override
tag_env_override	stack_env_override

@delfick
Copy link
Owner

delfick commented Apr 18, 2017

cool,

I think I see why too.

The converter is put onto the environments key, whereas the stack spec gets the particular environment that should be used, so nothing converts it.....

@atward
Copy link
Collaborator Author

atward commented May 10, 2017

This hole might be nice to fix to prevent pebkac.

I did something like:

---
environments:
  poc:
    stack_name: foo

and got the expected

14:32:55 INFO    bespin.amazon.cloudformation Using region [ap-southeast-2] for cloudformation (foo)
14:32:56 ERROR   bespin.amazon.mixin Couldn't find stack -(400)- Stack with id foo does not exist

@atward atward changed the title Add documentation about environment overrides environment can override stack values May 10, 2017
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

No branches or pull requests

2 participants