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

DNS issues with terraform #869

Closed
jbrockett opened this issue Oct 11, 2018 · 5 comments
Closed

DNS issues with terraform #869

jbrockett opened this issue Oct 11, 2018 · 5 comments

Comments

@jbrockett
Copy link

I am trying to use terraform within termux to provision AWS infrastructure. I have a basic tf file that just tries to use the aws provisioner. When I run terraform init on my mac or ubuntu hosts, it downloads the plugin without issue. When I try on termux, I get the following error:

Error installing provider "aws": Get https://releases.hashicorp.com/terraform-provider-aws/: dial tcp: lookup releases.hashicorp.com on [::1]:53: read udp [::1]:37606->[::1]:53: read: connection refused

I have read that there are possible issues with the go dns resolver that may cause this, but I'm unsure of how to correct it. I am able to perform a nslookup on the domain above and get the proper DNS entries returned.

#210 looks to be a similar issue, but they were running go code and terraform is a precompiled binary for linux 64bit. I am running this on a chromebook with an intel processor. dpkg --print-architecture shows i686. I was able to install golang and run the sample code from #210 and that worked fine.

@JCutty
Copy link

JCutty commented Oct 29, 2018

I'm having the exact same issue. Any progress?

@jbrockett
Copy link
Author

I ended up having to run ubuntu under proot in order to use terraform. I tried alpine, but ran into other issues getting it to run there. I've read other people have been able to run terraform successfully under termux, so I hope it's something easily fixed and I can go back to stock termux.

@ghost
Copy link

ghost commented Oct 29, 2018

@jbrockett Just a difference in typical linux dns resolver and android's.

Problem comes from here (found via strace):

26998 openat(AT_FDCWD, "/etc/resolv.conf", O_RDONLY|O_CLOEXEC <unfinished ...>

- Linux uses /etc/resolv.conf to get DNS servers while Android doesn't use/have this file.

This can be fixed only with proot, but will require a binary compiled for the same architecture as your termux installation:

  1. Install necessary packages:
pkg install proot resolv-conf
  1. Bind resolv.conf file to right place when executing binary:
proot -b $PREFIX/etc/resolv.conf:/etc/resolv.conf {YOUR_BINARY}

Alternatively, you can use termux-chroot and you won't have to type proot -b .......

@ghost
Copy link

ghost commented Oct 29, 2018

so I hope it's something easily fixed and I can go back to stock termux.

Easy fix is to recompile terraform for Termux with GOOS=android.

@jbrockett
Copy link
Author

I had tried to get this to work previously with termux-chroot, but was missing the resolv-conf package. After installing that, terraform works from termux without recompiling. Thanks for the tip!

@ghost ghost locked and limited conversation to collaborators Oct 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants