Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save facundovictor/f273d25c929c5e869231b2d1dd323a2d to your computer and use it in GitHub Desktop.
Save facundovictor/f273d25c929c5e869231b2d1dd323a2d to your computer and use it in GitHub Desktop.
Dockerfile used for building the AWS terraform provider --> https://www.terraform.io/docs/providers/aws/
FROM centos:7.4.1708
RUN yum install -y -q which vim wget git zip unzip gzip cmake make
ENV GOPATH=/opt/golang
WORKDIR $GOPATH
# Go references:
# https://golang.org/doc/install
# https://golang.org/cmd/go/#hdr-GOPATH_environment_variable
RUN mkdir -p $GOPATH && cd $GOPATH
RUN curl -L https://dl.google.com/go/go1.9.4.linux-amd64.tar.gz -o $GOPATH/go1.9.4.linux-amd64.tar.gz
RUN tar -C /usr/local -xzf $GOPATH/go1.9.4.linux-amd64.tar.gz
RUN echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
# Terraform provider docs:
# https://www.terraform.io/docs/plugins/provider.html
# https://www.terraform.io/guides/writing-custom-terraform-providers.html
# Terraform AWS provider:
# https://github.com/terraform-providers/terraform-provider-aws#developing-the-provider
RUN mkdir -p $GOPATH/src/github.com/terraform-providers
RUN cd $GOPATH/src/github.com/terraform-providers && git clone https://github.com/terraform-providers/terraform-provider-aws.git
RUN cd $GOPATH && /usr/local/go/bin/go get github.com/hashicorp/terraform/plugin
RUN cd $GOPATH && /usr/local/go/bin/go get github.com/terraform-providers/terraform-provider-aws/aws
# Run: make build
# RUN cd $GOPATH/src/github.com/terraform-providers/terraform-provider-aws && make build
# Copy binary from /opt/golang/bin/
# Other make goals:
# - make test
# - make testacc --> Requires a real AWS env and may cost money
# Invoking the provider
# https://www.terraform.io/guides/writing-custom-terraform-providers.html
CMD ["bash"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment