cloud.terraform icon indicating copy to clipboard operation
cloud.terraform copied to clipboard

Add support for the `-from-module` flag when init

Open samerbahri98 opened this issue 1 year ago • 3 comments

SUMMARY

Terraform has a feature where it can initialize a working directory from a terraform module like this:

terraform init -form-module <module>

The ansible cloud.terraform.terraform module does not support this unfortunately. And it would be nice if this feature exists.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

cloud.terraform.terraform

ADDITIONAL INFORMATION

I can work on it and open a pull request if everyone is busy (please indicate in the comment if you are interested in having this feature, and if you want me to work on it).

EXAMPLE
- name: Deploy Nginx Ingress Controller
  cloud.terraform.terraform:
    project_path: '{{ project_dir }}'
    state: present
    from_module: terraform-iaac/nginx-controller/helm  # this should download https://registry.terraform.io/modules/terraform-iaac/nginx-controller/helm/latest

samerbahri98 avatar Dec 26 '23 21:12 samerbahri98

@samerbahri98 Thanks for opening on issue. My understanding is that this feature is primarily intended for use with Terragrunt (see https://github.com/hashicorp/terraform/issues/33276#issuecomment-1568546030), and I'm not sure it's something we would want to support. What's the use case for this?

gravesm avatar Jan 08 '24 19:01 gravesm

I also have interest on this feature

DaviPtrs avatar Apr 05 '24 21:04 DaviPtrs

ah sorry @gravesm I forgot to reply. The use case here is that I use ansible to perform system integration tests. I used the example of the official terraform registry in the issue description, but the actual modules are in different git repositories and s3 buckets, and I would like to skip the steps of downloading the modules and putting them in a wrapper module to test them.

samerbahri98 avatar Apr 06 '24 20:04 samerbahri98