Comments (6)
Hi there,
- What version of the gem are you using?
- Were you able to obtain any kind of stack trace at all?
- You may be able to modify line 303 of
cfntemplate.rb
and try to get more information. I would try calling thecode
andcontext
methods on theServiceError
(e
). See: http://docs.aws.amazon.com/sdkforruby/api/Aws/Errors/ServiceError.html#code-instance_method
Something like this may work (untested):
rescue Aws::CloudFormation::Errors::ServiceError => e
ctx = e.context
$stderr.puts "Failed to create stack (#{e.code}):"
$stderr.puts "#{ctx.http_response.body_contents}"
exit(false)
end
from cloudformation-ruby-dsl.
Thanks for responding! I've attached my Gemfile.lock with all the version information. I have looked into the context variable and it's instance methods, but nothing seems useful in there either. For example, e.context.http_response.body_contents
returns
"<ErrorResponse xmlns=\"http://cloudformation.amazonaws.com/doc/2010-05-15/\">\n <Error>\n <Type>Sender</Type>\n <Code>ValidationError</Code>\n </Error>\n <RequestId>1985514e-1dcc-11e6-a76a-d322955e2e9a</RequestId>\n</ErrorResponse>\n"
Looking a bit harder and thinking into what I've changed from yesterday (working) to today (not working) I discovered that I may be using the built-in dsl tag
function improperly. I'm attempting to take in a stack parameter for ParamCustomerLabel
and I would like all resources to have that as a tag. However, I do not think AWS CloudFormation allows this, but the documentation is sparse. When I remove my 2 tag calls in the template, then the creation works as expected.
An immediate fix would be to just put back my duplicate tag code in every resource in the template. A better fix would be to add a new/different tag function that does this automatically for me at the resource level, not at the stack level.
I think I'm going to close this issue and look to make a pull request instead with these changes. Thanks for your help!
from cloudformation-ruby-dsl.
Just a quick extra note, perhaps adding some checks in the tag function for this kind of error (or adding documentation) would help others in the future.
from cloudformation-ruby-dsl.
@hjkatz If you want to populate a tag with the value of a parameter, you can reference the parameter's static value at runtime using parameters['ParameterName']
rather than ref('ParameterName')
which will generate a Cloudformation intrinsic attribute.
The formatting for tags should look something like this:
tag 'myTag', :Value => parameters['myParameter']
You can find more examples of ways you can write tags (and other DSL syntax) in examples/cloudformation-ruby-script.rb
.
There is an open issue describing exactly what you've encountered: #75 . I agree that we definitely need to address this issue to surface tag-related errors more clearly.
from cloudformation-ruby-dsl.
Oh wonderful! That's super useful, but not currently in the example. Thanks though!
from cloudformation-ruby-dsl.
It's easily (and frequently) overlooked, but the scope of the DSL itself is within the scope of the library, so you can reference pretty much anything at will. We happen to expose the parameters
instance variable under a given name, but you can do the same thing with mappings using something like @dict.fetch(:Mappings)['myMapping']
for example. The reason it's not included in the documentation is because it was not exposed with the intention of being used this way originally; I've been thinking about expanding it in a standardized way so that it's easier to pull static values from the outer scope and encourage using the static values at runtime over the intrinsics.
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.