Comments (5)
For anyone who wants a workaround to get this info in the meantime, this shell script does the trick:
#!/usr/bin/env bash
awk '/:/ {print $2}' | while read -r stack_name ; do
aws cloudformation describe-stacks --stack-name "$stack_name" | jq -r --arg stack_name "$stack_name" '
.Stacks[].Outputs[] | "!stack_output_external \($stack_name)::\(.OutputKey) [\(.OutputValue)]"
'
done
Save that as /usr/local/bin/stackoutputs.sh
and chmod +x it and then:
% sceptre list stacks | stackoutputs.sh
from sceptre.
A few reactions I have to this:
First, your example is slightly wrong. I don't know if that makes a difference for you or not.
sceptre --output=yaml list outputs
Technically, this command (like almost every other Sceptre command) takes a command path.
Second... I don't really understand what the purpose of listing out the envvar
s is in the first place. I never use environment variables with Sceptre because it means you need those environment variables set for EVERY action you take with Sceptre, so it gets pretty unsustainable very fast. I tend to prefer var-files. I don't see where we're even reading those in. Is this command some sort of relic of a former iteration of Sceptre that read these in? Or are they used now and I don't know? Looking at the docs, perhaps the only utility is the ability to dump the stack outputs in a CI/CD situation so they can be referenced in some other tooling/scripting.
Finally, what is the benefit of outputting them in the format of !stack_output_external nonprod-direct-connect::VPGWId --- vgw-1fb1e1e1af11da111
? I don't see how that's an easy-to-interact-with format.
from sceptre.
Also, your example of VpcId: '!stack_output_external my-network-stack::VpcId'
confuses me. If you quote resolvers, they're just strings, not valid resolvers.
from sceptre.
- Yes I just abbreviated the long command line. I thought it would be clear what I meant but you're right.
- I agree. I don't think the
export=envvar
has any use, and neither does the default behaviour. The whole command is indeed broken, looks unloved, and makes the whole project look like it is unmaintained and unsupported! - The benefit of the output format proposed is this is exactly what people who use
!stack_output_external
to consume outputs will need to paste into their var files. And (updated) the same goes for the!stack_output
output format that can be consumed by those who use!stack_output
.
from sceptre.
Re your number 2, I do see a use for "envvar", in cases where CI/CD tools might do something like:
sceptre launch my/rds/stack.yaml
eval "sceptre list outputs --export=envvar my/rds/stack.yaml"
migration_tool run-my-migrations --connection-string $SCEPTRE_MyConnectionStringOutput
In other words, I can see the utility. I think you'd need to "read between the lines" of the documentation to accomplish that, though. I've thought for quite a while that a "Sceptre Recipe Book" might be a useful addition to our docs, since there are a lot of patterns that are possible but aren't really documented. They're basically left up to the creative engineer to implement them. You've got some crazy-complex and powerful Jinja patterns. I know my own project structure is often surprising to people when I tell them about it.
Regarding copying and pasting stack output references into var-files... that only actually works with your fancy "unquote resolvers" resolver... which isn't even a part of Core Sceptre. With that said, adding an additional export mode isn't such a big deal to me and I wouldn't actually mind that so long as it doesn't really change any existing functionality.
With all that said, here are my thoughts on the actual implementation:
- I think you might want to have two new export types:
external-stack-output
would output the external stack output strings as you have proposed for use with !stack_output_externalstack-output
would output the stack output strings for !stack_output
- I'm not as crazy about outputting the actual values for each output. Remember, they're not always as clean as a vpc id. They could be super long, multi-line strings or even json blobs. It could get ugly. I also don't know why you'd necessarily need the values for these new export modes.
from sceptre.
Related Issues (20)
- python < 3.12 causes issues with other poetry projects, can you use < 4.0 HOT 3
- Autocompletion docs need updating for bash
- Unable to install Sceptre >= 4.0 since release of cython 3.0.0 HOT 15
- inheretance behavior of `profile` overrides child with parent config HOT 5
- Add a Makefile HOT 1
- Why does black use Python 3.10? HOT 2
- announcements to twitter (X) is broken HOT 4
- Document `j2_environment` `autoescape` setting to control Jinja2 escaping HOT 4
- Drop support for Python 3.7 HOT 4
- test_hook_writes_to_stderr failure "/bin/sh command not found" HOT 4
- Not enough values to unpack given a badly formatted stack ref
- Bug in hooks test on MacOS HOT 2
- Setup build workflow without secrets HOT 2
- Provide a formatted_yaml template handler HOT 1
- CI: make integration tests run faster HOT 5
- Stack differ raises AttributeError if a values is a bool
- Input parameters should be validated
- Cyclic dependencies should result in a clearer error message
- j2_environment extensions not available while generating config 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 sceptre.