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

How to do when the state is stored in a backend ? #44

Closed
MichaelMure opened this issue Aug 12, 2020 · 5 comments
Closed

How to do when the state is stored in a backend ? #44

MichaelMure opened this issue Aug 12, 2020 · 5 comments

Comments

@MichaelMure
Copy link

Is there a way to use this tool when the state is stored in a terraform backend like S3 ? There is no .tfstate file in that case.

Thanks :)

@tormath1
Copy link
Contributor

Hi @MichaelMure , thanks for raising this issue !

That's a good point to raise. Indeed, Terraform supports multiple backends (S3 included) but the goal of inframap is to only generate graphs from local tfstate (or HCL), it's currently up to the user to provide the tfstate or HCL.

In order to solve your use-case: inframap is able to read the tfstate (or HCL) from the stdin, you could simply make the following:

aws s3 cp s3://bucket/path/to/your/file.tfstate - | inframap generate --tfstate

@tormath1
Copy link
Contributor

@MichaelMure we added your question to the FAQ in this PR (#46) https://github.com/cycloidio/inframap#does-inframap-support-terraform-backends-

Thanks for your contribution ! 😉

@MichaelMure
Copy link
Author

thanks :)

@purplepangolin
Copy link

purplepangolin commented Mar 30, 2022

If using some other backend (such as the http backend) then an alternative approach is:

terraform state pull | inframap generate --tfstate

@xescugc
Copy link
Member

xescugc commented Apr 8, 2022

Thanks @purplepangolin I'm gonna add it to the documentation so it's also easily available for people to use :) BTW if you want you can drop the --tfstate flag as it automatically identifies the type (HCL or State) if you want :)

xescugc added a commit that referenced this issue Apr 8, 2022
So we have another example for the users to use.

Mentioned on #44 (comment)
xescugc added a commit that referenced this issue Apr 20, 2022
So we have another example for the users to use.

Mentioned on #44 (comment)
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

4 participants