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

Feature request: Recursive mode #47

Open
sarahkadar opened this issue Oct 26, 2022 · 8 comments
Open

Feature request: Recursive mode #47

sarahkadar opened this issue Oct 26, 2022 · 8 comments
Assignees
Labels
enhancement New feature or request

Comments

@sarahkadar
Copy link

It'd be great to have a recursive mode, we have a monorepo with lots of modules.

@sarahkadar sarahkadar changed the title Recursive mode Feature request: Recursive mode Oct 26, 2022
@ryan-jan
Copy link
Contributor

@KTamas I thought about this, but given that you can currently just pass multiple directories to tfvc I decided that was good enough for me at the moment. Does that not meet your requirement? e.g.

tfvc ./directory1 ./directory2 ./directory3

@sarahkadar
Copy link
Author

sarahkadar commented Oct 26, 2022

The problem is that even that's not without issues, for example:

$ tfvc . modules/vpc

provider 'hashicorp/aws' WARNING Configured version does not match the latest available version
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

  Resolution
  ──────────────────────────────────────────────────────────
  Consider using the latest version of this provider

  Details
  ────────────────────────────────────────────────────────
  Type:                provider
  Path:                .
  Name:                hashicorp/aws
  Source:              registry.terraform.io/hashicorp/aws
  Version Constraints: 4.29.0
  Version:             4.29.0
  Latest Match:
  Latest Overall:      4.36.1

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

module 'vpc' WARNING Configured version does not match the latest available version
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

  Resolution
  ────────────────────────────────────────────────────────
  Consider using the latest version of this module

  Details
  ──────────────────────────────────────────────────
  Type:                module
  Path:                modules/vpc/main.tf
  Name:                vpc
  Source:              terraform-aws-modules/vpc/aws
  Version Constraints: 3.14.4
  Version:             3.14.4
  Latest Match:
  Latest Overall:      3.18.0

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────


terraform FAILED Missing version constraints
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

  Resolution
  ───────────────────────────────────────────────────
  Configure version constraints for terraform

  Details
  ───────────────────────────────────────────────────
  Type:                terraform
  Path:                modules/vpc
  Name:                terraform
  Source:              github.com/hashicorp/terraform
  Version Constraints:
  Version:
  Latest Match:
  Latest Overall:      1.3.3

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  1. we have many many modules and listing them by hand is just, Not Great
  2. This error is misleading terraform FAILED Missing version constraints

@ryan-jan
Copy link
Contributor

Ah, yes, point 2 is related to #34 however, I do understand your point 1. I will leave this open and take a look at it when I get a chance.

@ryan-jan ryan-jan added the enhancement New feature or request label Oct 26, 2022
@ryan-jan ryan-jan self-assigned this Oct 26, 2022
@ryan-jan
Copy link
Contributor

@KTamas on further thought, I actually don't think your 2nd point above "This error is misleading terraform FAILED Missing version constraints" is quite correct. Your modules/vpc module should be defining a version constraint for the version(s) of terraform that it supports in a terraform { required_version = "x" } block. Does your vpc module have this configured?

@sarahkadar
Copy link
Author

sarahkadar commented Oct 27, 2022

Ah, right, we don't have that. Mostly because it's a non-issue for us, most of the time. Perhaps an option to disable that check?

@ryan-jan
Copy link
Contributor

Perhaps, I definitely want to add something to be able to ignore checks etc. just haven't looked at the best way to do it yet.

@mihaiplesa
Copy link

Recursive mode would help us greatly as we're preparing a migration to AWS provider v4 across the board in our monorepo.

@ryan-jan
Copy link
Contributor

ryan-jan commented Nov 5, 2022

I've been thinking about this a bit more and I'm still not sold on the idea. The issue is that it could end up adding a lot of complexity as I'm sure everyone will have different repo structures/requirements. For example, some people might only want to recurse one level deep, others might only want to recurse into a specific subdirectory called modules, others might want full multi-level recursion etc. etc.

My point is, currently you can specify multiple directories (separated by a comma) to tfvc and it will happily loop through them all. If that is not sufficient then it should be pretty trivial for people to put together a simple script to work out which directories they want to recurse into and just run tfvc in a for loop.

I'll leave this open for a bit longer in case people want to add some weight to the feature, but for now it is probably not going to implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants