So I have file called main.tf in which I am calling the existing module for iam_role, but in same main.tf I have called one more module for service_role but I want to restrict that service_role module to only run for my monitoring.tf file not any other tf file. Is there possible way to do that? Adding two modules in same main.tf and restrict for only one .tf file?

  • 1
    You'd better show your terraform script first, it's heavily difficult to understand what do you want to achieve. Modules are made to be reused, you called anywhere where you want them to call and that's it. Not sure what do you want to restrict in here.
    – holms
    Oct 3 '21 at 1:16
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Oct 4 '21 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.