Repository navigation
Port/reimplement the Terraform package to Dagger 0.2 - #2110
nmeisenzahl wants to merge 1 commit into
Conversation
|
Hi all. I'm pretty new to Dagger. I started porting/reimplementing the Terraform package. So far this is work in progress but I thought it might be helpful to get some feedback earlier than later ;) |
2dc1df2 to
feb23b7
Compare
|
Thank you for the contribution @nmeisenzahl, really appreciated! Just a small note on my end: the testing infrastructure/conventions have changed in 0.2. So these new terraform tests are not currently running because of that. You can take a look at
/cc @helderco for the actual package review |
|
Hey, @aluzzardi thanks for your feedback. I just implemented your findings. |
helderco
left a comment
There was a problem hiding this comment.
Looks pretty good overall 🙂
|
@nmeisenzahl can you please squash your commits? Take it out of draft when you're ready. |
helderco
left a comment
There was a problem hiding this comment.
Can you please move the package into pkg/universe.dagger.io/x/<email>/terraform?
Context here: #1362 (comment)
Signed-off-by: Nico Meisenzahl <[email protected]>
d3ad8e4 to
4c54442
Compare
Sry. Missed that one. Just squashed them. |
| // Terraform apply | ||
| #Apply: { | ||
| // Terraform version | ||
| version: string | *"latest" |
There was a problem hiding this comment.
You should use a stable version as default to avoid unexpected behaviour
| // Copy source | ||
| docker.#Copy & { | ||
| dest: "/src" | ||
| contents: source | ||
| }, |
There was a problem hiding this comment.
nit: You could just mounts to copy src in docker.#Run instead of a whole step
| docker.#Pull & { | ||
| source: "hashicorp/terraform:\(version)" | ||
| }, |
There was a problem hiding this comment.
Since you are using this step on each definition, why you do not create a definition #Image and reuse it everywhere?
You could also take as parameter a base image so the user can give his own if he want.
There was a problem hiding this comment.
I don't think it matters much in this case because the command is fixed. Not much you can do with a different image.
| docker.#Pull & { | ||
| source: "hashicorp/terraform:\(version)" | ||
| }, |
There was a problem hiding this comment.
Duplication, see my comments above
| docker.#Pull & { | ||
| source: "hashicorp/terraform:\(version)" | ||
| }, |
There was a problem hiding this comment.
Duplication, see my comments above
| docker.#Copy & { | ||
| dest: "/src" | ||
| contents: source | ||
| }, |
There was a problem hiding this comment.
nit: You could just mounts to copy src in docker.#Run instead of a whole step
| _output: core.#Subdir & { | ||
| input: _run.output.rootfs | ||
| path: "/src/" | ||
| } |
There was a problem hiding this comment.
nit: You could use export field of docker.#Run instead
There was a problem hiding this comment.
He's not using export because of docker.#Build, but if the copy is a mount instead, then you can reduce all of this into two steps: 1) pull image; 2) run command with mount and export at the same time.
| _output: core.#Subdir & { | ||
| input: _run.output.rootfs | ||
| path: "/src/" | ||
| } |
There was a problem hiding this comment.
nit: You could use export field of docker.#Run instead
| // Terraform init | ||
| #Init: { | ||
| // Terraform version | ||
| version: string | *"latest" |
| // Terraform plan | ||
| #Plan: { | ||
| // Terraform version | ||
| version: string | *"latest" |
There was a problem hiding this comment.
On second look, these three definitions look like practically the same except for the commands.
How about creating a #Command:
#Plan: #Command & {
command: {
name: "plan"
args: [...]
}
}
#Apply: #Command & {
command: {
name: "apply"
args: [...]
}
}Just a suggestion, we can merge and improve later.
|
It seems the checks failed due to a timeout. If you amend your commit and force push it'll re-run them. |
|
I did a manual re-run of the Lint to see if it would work. Let's see. Seems to work. Re-running the other two failed checks. |
|
@helderco @TomChv I just came back from vacation. Do you think it makes sense to proceed with this implementation? The Terraform package implementation in #2192 by @efoncubierta looks far more complete than mine. Also, it has already been approved by most of you. I also do not see a use case to implement two packages. What do you think? |
I agree with you, I think it would be awesome if you can play with his package and see if you can use for your own use case and then add some suggestions to his package so both of you have what you need 🚀 |
|
Just checking in, @nmeisenzahl did you end up contributing this package in another PR? Did you get stuck anywhere? |
Hey @shykes, thanks for asking. I stopped implementing this due to PR #2192 which was contributed in parallel and was far more complete than mine. |
|
OK I see, thanks! I think it may be time to promote some of these experimental packages to the top-level namespace, so more people feel comfortable trying them. |
Signed-off-by: Nico Meisenzahl [email protected]
Fixes #2109