-
Notifications
You must be signed in to change notification settings - Fork 157
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
Allow to use a whole local directory as IaC source #292
Conversation
62b0a91
to
3bd84ab
Compare
Codecov Report
@@ Coverage Diff @@
## main #292 +/- ##
==========================================
+ Coverage 68.87% 68.90% +0.02%
==========================================
Files 258 259 +1
Lines 5523 5554 +31
==========================================
+ Hits 3804 3827 +23
- Misses 1392 1398 +6
- Partials 327 329 +2
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems cool π
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to change all multiples
to multiple
.
I tested it like you did which works perfectly. But we're gonna have problems with people who would like to use it with a folder like this one below which seems pretty normal in terragrunt environment if I remember well:
βββ route53
β βββ terraform.tf
β βββ terraform.tfstate
βββ s3
βββ terraform.tf
βββ terraform.tfstate
driftctl scan
will output:
Maybe in another PR we should check that files are indeed terraform.states files before adding them to the slice.
|
||
// File enumeration does not follow symlinks. | ||
// We may use something like this https://pkg.go.dev/github.com/facebookgo/symwalk | ||
// to follow links, but it allow infinite loop so be careful ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it allows ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like I need to take English lesson on the plural rule with you π
@@ -9,6 +9,33 @@ import ( | |||
"github.com/cloudskiff/driftctl/test/acceptance/awsutils" | |||
) | |||
|
|||
func TestAcc_StateReader_WithMultiplesStatesInDirectory(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiple
no S ^^
acceptance.Run(t, acceptance.AccTestCase{ | ||
Paths: []string{ | ||
"./testdata/acc/multiples_states_local/s3", | ||
"./testdata/acc/multiples_states_local/route53", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All your multiples_....
must be changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also rename the folder multiples_states_local
to multiple_states_local
Sure nice catch ππ»
This is a real question, it can totally be done in this PR but I don't know exactly what we want to do. I had in mind something like THAT |
Agree we must not hardcode a check on any extension. Either it's gonna be the user who would specify a pattern like you did or if it's possible we could check if a file is a terraform state but I can't find a method in their repo that does that yet ... I'd say we could first ship this PR with the changes I requested, then ask @sjourdan about his view and finally decide which way to go. |
3bd84ab
to
f74fe3f
Compare
f74fe3f
to
c90da70
Compare
Can't we use magic number to check ? I'm not sure there is an identification for tf state tho. |
The scope of ticket in this release was just to be able to use a batch of tfstate inside a repository. We talked about blob filtering but this was more intended as a first step from what I remember. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now
Description
Allow to use a whole local directory as IaC source.
β οΈ Does not follow symlinks within root folder