Comments (7)
I'm interesting in doing this as well, for exactly the reason you mentioned (alongside chosen parameter values for the stack) -- it'd be nice to have a representation of the deployed infrastructure in revision control.
Would you be open to a pull request along those lines? Thus far I've experimented with a quick hack, and have the ARGV options (e.g. stack name) check for global variables as well, e.g.,
$stack_name = "myfancy_stack"
template do
value AWSTemplateFormatVersion: '2010-09-09'
value Description: 'blah'
...
end.exec!
I'd obviously be open to doing it more correctly though (variables passed around the methods? moving the standalone methods to a class that could share the variables?).
from cloudformation-ruby-dsl.
Hi @z0mbix , there's currently not any way to do that. What's the motivation? Would you like to keep the stack name in source control?
from cloudformation-ruby-dsl.
Tried the ARGV way for a while, but now I'm trying to make all the stacks available as library calls which makes ARGV a non thread-safe option. So far, I ended up monkey-patching TemplateDSL:
class TemplateDSL
def name(stack_name)
@stack_name = stack_name
end
end
Adding stack_name as attr_accessor (it's already defined as attr_reader) doesn't make instance_eval happy, hence the explicit setter with a different name. The templates now read something like:
template do
name 'foo'
value AWSTemplateFormatVersion: '2010-09-09'
# ...
end
from cloudformation-ruby-dsl.
I like the format of the resulting template from your example, @SaltwaterC . I think I'd rather see if we can swap to an attr_accessor
in the actual implementation, but I like where this is headed.
from cloudformation-ruby-dsl.
I went the setter way because attr_* doesn't play nice with instance_eval.
from cloudformation-ruby-dsl.
@SaltwaterC I like this, and it doesn't feel like it would break anything too hard. Can I encourage you to turn this monkey-patch into a pull request, instead?
from cloudformation-ruby-dsl.
Turns out this entirely unnecessary: you can just manually set using:
template do
@stack_name = 'foo'
[...]
end
and it works fine without any code changes.
from cloudformation-ruby-dsl.
Related Issues (20)
- Use optparse or thor HOT 1
- Allow nested code in interpolate()
- Improve unit testbed
- Use an OptionParser to generate the usage output
- Regression: expanding default parameters no longer works HOT 18
- False `diff` output and incorrect exit code HOT 2
- Updating with interactive parameters causes error HOT 1
- Using resource from a module HOT 1
- Add support for Change Sets for `diff` operation
- Attributes with dots in the name generate an incorrect get_att() call
- aws_region() "pseudo" parameter is not a pseudo parameter HOT 1
- Update fails if stack contains immutable parameter with NoEcho=true
- Incorrect handling of nested intrinsic functions in join()
- Missing function for Fn::Cidr
- https://rubygems.org/gems/cloudformation-ruby-dsl was displaying the license as "N/A" HOT 1
- Add support for stack metadata HOT 2
- Assumed Roles are ignored HOT 3
- profile fix broke it
- Add Github pull request template
- Credentials regression error in 1.2.3 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cloudformation-ruby-dsl.