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

Output command #227

Closed
skorfmann opened this issue Jul 22, 2020 · 7 comments · Fixed by #1495
Closed

Output command #227

skorfmann opened this issue Jul 22, 2020 · 7 comments · Fixed by #1495
Assignees
Labels
cdktf-cli enhancement New feature or request priority/important-soon High priority, to be worked on as part of our current release or the following one. size/medium estimated < 1 week
Milestone

Comments

@skorfmann
Copy link
Contributor

skorfmann commented Jul 22, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

When a stack has no changes, the apply is omitted and therefore no outputs are printed.

Two things here:

  • cdktf deploy should always print outputs regardless of changes being present
  • introduce cdktf output to explicitly retrieve outputs only
@skorfmann skorfmann added the enhancement New feature or request label Jul 22, 2020
@ansgarm
Copy link
Member

ansgarm commented May 3, 2021

Seconding in on this.
For my CDK Day talk I had to build a rather ugly workaround to get outputs which I used for tests.

@matschaffer
Copy link

matschaffer commented Jun 29, 2021

I solved this by putting this in my package.json:

  "scripts": {
    ...
    "outputs": "cd cdktf.out/stacks/my_stack; terraform output -json > outputs.json"
  },

That way I can at least just run yarn outputs and get a json file.

I can then read this json file from other scripts that helps complete provisioning beyond what I'm able to do with the terraform provider.

cdk output -json would be a welcome addition for that piece.

@ansgarm
Copy link
Member

ansgarm commented Jun 30, 2021

Ah, that's a nice workaround @matschaffer 💡 That reminds me of a similar thing I did for the dotenv config for a React frontend, however that does not make use of outputs but uses Terraform to write that file.
I have the feeling there might be a way to collect all outputs of a stack and write such an outputs.json file via Terraform 😄

@skorfmann
Copy link
Contributor Author

I have the feeling there might be a way to collect all outputs of a stack and write such an outputs.json file via Terraform 😄

You're thinking about an Aspect here?

@danieldreier danieldreier added the priority/important-soon High priority, to be worked on as part of our current release or the following one. label Jul 2, 2021
@danieldreier danieldreier added this to the 0.6 milestone Jul 2, 2021
@danieldreier danieldreier added the size/medium estimated < 1 week label Aug 2, 2021
@kc-dot-io
Copy link
Contributor

How about approaching this the same way that CDK does using --outputs-file?

@jsteinich
Copy link
Collaborator

How about approaching this the same way that CDK does using --outputs-file?

Having that consistency sounds like a good idea to me. Could still add the output command which accepts the same argument.

DanielMSchmidt added a commit that referenced this issue Jan 18, 2022
Previously when there was no change we did not show the outputs

Closes #227
DanielMSchmidt added a commit that referenced this issue Jan 19, 2022
Previously when there was no change we did not show the outputs

Closes #227
@DanielMSchmidt DanielMSchmidt self-assigned this Jan 19, 2022
DanielMSchmidt added a commit that referenced this issue Jan 20, 2022
Previously when there was no change we did not show the outputs

Closes #227
DanielMSchmidt added a commit that referenced this issue Jan 24, 2022
Previously when there was no change we did not show the outputs

Closes #227
@github-actions
Copy link
Contributor

I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cdktf-cli enhancement New feature or request priority/important-soon High priority, to be worked on as part of our current release or the following one. size/medium estimated < 1 week
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants