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

feat: Allow passing build_args for building with docker-build module #217

Merged

Conversation

michaelhelmick
Copy link
Contributor

Description

The docker provider allows build_args nested in the build map of it's docker_registry_image resource.

https://registry.terraform.io/providers/kreuzwerker/docker/latest/docs/resources/registry_image#nested-schema-for-build

I've found use case to pass build args via Terraform to build a docker image.

Motivation and Context

Working a project that needs build_args passed and think this is a great addition for anybody to use.

Breaking Changes

None.

How Has This Been Tested?

  • I have tested and validated these changes using one or more of the provided examples/* projects
    I pushed a docker image to an ECR registry via Terraform using my branch as a source. I passed build_args in the implementation and in the Dockerfile added ARG TESTING_ARGS and set it to ENV TESTING_ARGS $TESTING_ARGS and in the Dockerfile RUN echo $TESTING_ARGS

That showed the following output after I pulled it, ran it and did a docker history

d17c32899430   3 minutes ago   /bin/sh -c echo $TESTING_ARGS                     0B
fd07cea0f973   3 minutes ago   /bin/sh -c #(nop)  ENV TESTING_ARGS =testtttt123   0B
74c1df86fcd3   3 minutes ago   /bin/sh -c #(nop)  ARG TESTING_ARGS               0B

Copy link
Member

@antonbabenko antonbabenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Can you also update the code in the examples to show build_args for real, and run pre-commit run -a to update the documentation?

@antonbabenko antonbabenko changed the title Allow passing build_args for building a Dockerfile feat: Allow passing build_args for building a Dockerfile Oct 21, 2021
@michaelhelmick
Copy link
Contributor Author

Should there be a certain version of tfdocs I'm going against? Wants to add "n/a" in a lot of places.

Example
Screen Shot 2021-10-21 at 9 52 15 AM

@antonbabenko
Copy link
Member

Yes, we stuck with terraform-docs 0.13.0 for the time being. Sorry that I didn't make it clear at first.

@michaelhelmick
Copy link
Contributor Author

@antonbabenko I switched to 0.13.0 and reran pre-commit run -a and got the same result :( adding "n/a" in a lot of places.

@antonbabenko
Copy link
Member

No problems, push it all with other changes and I will fix the docs.

@michaelhelmick
Copy link
Contributor Author

Thanks!

@antonbabenko antonbabenko changed the title feat: Allow passing build_args for building a Dockerfile feat: Allow passing build_args for building with docker-build module Oct 22, 2021
@antonbabenko antonbabenko merged commit a96bbeb into terraform-aws-modules:master Oct 22, 2021
@antonbabenko
Copy link
Member

Thanks, @michaelhelmick !

v2.23.0 has been just released.

@michaelhelmick michaelhelmick deleted the allow-build-args branch October 22, 2021 15:22
@github-actions
Copy link

github-actions bot commented Nov 9, 2022

I'm going to lock this pull request 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 related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants