driftctl icon indicating copy to clipboard operation
driftctl copied to clipboard

When using --deep --only-unmanaged doesn't work

Open oreonl opened this issue 2 years ago • 2 comments

Description

When running driftctl scan --from tfstate+s3://redacted/**/terraform.tfstate --deep --only-unmanaged changed resources are reported (We are running with --deep so that we can filter on the tags). Environment

  • OS: Mac
  • driftctl version: v0.38.1
  • terraform version: 1.1.7
  • terraform providers versions: [email protected]

How to reproduce

Run driftctl scan --from tfstate+s3://redacted/**/terraform.tfstate --deep --only-unmanaged Possible Solution

Additional context

oreonl avatar Nov 22 '22 01:11 oreonl

Hey @oreonl 👋🏻, I think I don't get it. What do you want to achieve with this command and how do you think it should behave?

Those 2 flags are completely different:

  • --deep is to retrieve details attribute of a specific managed resource, hence the - 1/5 resource(s) out of sync with Terraform state line
  • --only-unmanaged is to list what's not managed by terraform

wbeuil avatar Nov 22 '22 09:11 wbeuil

I think it should only return the unmanaged resources since we are using the --only-unmanaged flag. We are running the command with a filter on tags and just want the unmanaged resources that match the filter (for simplicity I included the command without the filter because the behavior is the same). Instead we are getting unmanaged and changed. Effectively the --only-unmanaged flag is not doing anything when also using --deep. We are seeing Found changed resources: followed by a list of changed resources.

oreonl avatar Nov 22 '22 17:11 oreonl