minamijoyo / tfupdate

Update version constraints in your Terraform configurations
MIT License
539 stars 23 forks source link

Add module auto update and artifactory source type #81

Open stobias123 opened 1 year ago

stobias123 commented 1 year ago

Addresses #79 + #80 :)

minamijoyo commented 1 year ago

Hi @stobias123, Thank you for working on this! Expanding support for 3rd-party registries would be a great addition!

Before moving to code review, could you explain the difference between the standard Terraform module registry and the Artifactory?

My naive understanding is that 3rd-party registries which implement the module registry protocol should work with the tfregistryModule source type. Why can’t we just set the BaseURL instead of adding a new specialized source type? Since the current implementation of the tfupdate assumes the standard registry only, I guess something is missing, which is why you are sending the patch. Because I’m unfamiliar with the Artifactory, an example of Terraform configuration using the Artifactory would also help me understand what is missing.

stobias123 commented 1 year ago

I'm a little embarrassed to say, I think you're actually right 😅 - just need to configure baseURL. I might've tunnel visioned a bit here.

I would just need to move this logic for detecting / setting the registry url into the main tfregistryModule source init here

minamijoyo commented 1 year ago

@stobias123 Thank you for your reply! I understand that the problem is detecting and setting the baseURL.

I looked in the official artfifactory documentation but couldn't find an actual example of Terraform configuration. https://www.jfrog.com/confluence/display/JFROG/Terraform+Registry

I’m curious about what the module's source address looks like and how the Terraform core handles it, especially the /artifactory/api/terraform part. If my understanding is correct, the missing piece for supporting 3rd-party registries is the service discovery protocol. https://developer.hashicorp.com/terraform/internals/remote-service-discovery

Do you have any public artifactory repository where I can inspect the API response?