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

Allow --target to accept module path without a resource #22570

Closed
tyd opened this issue Aug 22, 2019 · 3 comments
Closed

Allow --target to accept module path without a resource #22570

tyd opened this issue Aug 22, 2019 · 3 comments

Comments

@tyd
Copy link

tyd commented Aug 22, 2019

Current Terraform Version

Terraform v0.12.6

Use-cases

I think it would be useful to be able to use --target to specify a module and then have all resources under that module filtered for plan/apply.

Attempted Solutions

terraform plan --target=moduleName

Proposal

The documentation for resource addressing already includes modules as follows:

[module path][resource spec]

My proposal is to make the second part for [resource spec] optional so it will work with only a module path:

[module path]

References

#2182 might accomplish the same thing if it gets implemented.

@teamterraform
Copy link
Contributor

Hi @tyd!

As described on the Resource Addressing docs page, the syntax for addressing a module is to prefix its name with module., so the correct way to write your example there would be as follows:

terraform plan --target=module.moduleName

This module. prefix is how Terraform can tell the difference between a module address and a resource address. If you use that prefix, you should hopefully find that this already works as you wanted. Please give that a try and let us know! Thanks.

@teamterraform teamterraform added the waiting-response An issue/pull request is waiting for a response from the community label Aug 22, 2019
@tyd
Copy link
Author

tyd commented Aug 23, 2019

@teamterraform that works! Thanks, totally missed in the docs that you can use it this way.

@tyd tyd closed this as completed Aug 23, 2019
@ghost ghost removed the waiting-response An issue/pull request is waiting for a response from the community label Aug 23, 2019
@ghost
Copy link

ghost commented Sep 23, 2019

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 have 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.

@ghost ghost locked and limited conversation to collaborators Sep 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants