-
Notifications
You must be signed in to change notification settings - Fork 38
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
Apigee provider is not working in alpine-based docker containers #48
Comments
Oh boy. Linking with Alpine can be a pain. Are you certain that by disabling dynamic linking the plugin will function in Alpine? I have had some experience with this in other repos and sometimes the best solution is to use a multistage build Dockerfile as follows for Alpine:
The Dockerfile above works so I can PR it in but I'd like your thoughts on this approach vs. the one you recommended. |
@zambien I've just sent you a PR and described how I tested that. But if you have concerns with that just let me know, I just wanted to avoid using custom docker images. And I think enabling the provider to work in a lightweight terraform container like official one would be nice! |
Sounds good to me. Released. Thanks for the contribution! |
awesome, great thanks! |
@zambien just want to confirm that the new release fixed the issue. Thank you much! |
Hi there,
I'm working on setting up CI/CD pipeline on Gitlab that uses
hasicorp/terraform:light
docker image to execute terraform configurations. In thebefore_script
my pipeline downloads the official release of apigee provider and extracts that into the~/.terraform.d/plugins/linux_amd64
directory.terraform init
succeeds, butterraform plan
results in what you can see below. If I build the provider binary on my mac and use that one in the terraform container it works well.After looking around I came across this issue which put me in the right direction in my investigations. The key difference between the two builds is that building with
goreleaser
on mac results in a statically-linked binary, while the official release built by travis is dynamically linked forlinux_amd64
architectures:When you cross-compile go, the CGO is disabled and thus, the binary will use static linking. However, travis is on linux_amd64, so when you build a binary for the same architecture CGO will be enabled and the build binary will be dynamically linked. In alpine-based images you don't have all the
glibc
libraries, which results in the failure you can see below.Suggestion:
As the builds for Mac and Windows platforms are statically linked anyway, it would make sense to disable CGO in the goreleaser configuration to build statically-linked binary for linux platform as well. The size of the binary will increase by cca. 1.5MB (23.7 -> 25.2), but this will enable users to use the official builds in official hasicorp/terraform docker images.
Terraform Version
Terraform v0.12.15
Affected Resource(s)
all
Terraform Configuration Files
irrelevant
Debug Output
Expected Behavior
The provider can be started.
Actual Behavior
The provider cannot be started
Steps to Reproduce
Install the official build of apigee provider into an alpine-based docker container and try to use a terraform configuration that uses apigee provider.
The text was updated successfully, but these errors were encountered: