Skip to content

Commit

Permalink
Merge pull request #294 from dikhan/293-fix-docker-examples
Browse files Browse the repository at this point in the history
[BugFix: Issue #293] fix docker file to install providers based on Terraform 0.13 installation specs
  • Loading branch information
dikhan authored May 27, 2021
2 parents a6a1bec + 37c23f7 commit 1657b56
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 244 deletions.
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@ go:
services:
- docker

env:
- TF_VERSION=0.13.6

install:
# - go get github.com/buchanae/github-release-notes
- export BINDIR=/home/travis/bin && curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh
- wget https://releases.hashicorp.com/terraform/"$TF_VERSION"/terraform_"$TF_VERSION"_linux_amd64.zip
- unzip terraform_"$TF_VERSION"_linux_amd64.zip
- sudo mv terraform /usr/local/bin/
- rm terraform_"$TF_VERSION"_linux_amd64.zip

jobs:
include:
Expand Down
15 changes: 7 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
FROM golang:1.12.5
FROM alpine:3.13

WORKDIR /openapi

ENV TERRAFORM_VERSION=0.12.0
ENV TERRAFORM_VERSION=0.13.7

RUN apt-get update && \
apt-get -yq install unzip openssl ca-certificates && \
RUN apk update && \
apk add curl jq python3 bash ca-certificates git openssl unzip wget && \
cd /tmp && \
wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \
unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /usr/bin && \
rm -rf /tmp/* && \
rm -rf /var/cache/apk/* && \
rm -rf /var/tmp/*

COPY version /

# provision openapi plugins
RUN export PROVIDER_NAME=goa && curl -fsSL https://raw.githubusercontent.com/dikhan/terraform-provider-openapi/master/scripts/install.sh | bash -s -- --provider-name $PROVIDER_NAME
RUN export PROVIDER_NAME=swaggercodegen && curl -fsSL https://raw.githubusercontent.com/dikhan/terraform-provider-openapi/master/scripts/install.sh | bash -s -- --provider-name $PROVIDER_NAME
ENV PROVIDER_SOURCE_ADDRESS="terraform.example.com/examplecorp"
RUN export PROVIDER_NAME=goa && curl -fsSL https://raw.githubusercontent.com/dikhan/terraform-provider-openapi/master/scripts/install.sh | bash -s -- --provider-name $PROVIDER_NAME --provider-source-address ${PROVIDER_SOURCE_ADDRESS}
RUN export PROVIDER_NAME=swaggercodegen && curl -fsSL https://raw.githubusercontent.com/dikhan/terraform-provider-openapi/master/scripts/install.sh | bash -s -- --provider-name $PROVIDER_NAME --provider-source-address ${PROVIDER_SOURCE_ADDRESS}

# copy examples including terraform configurations
COPY examples/ .
Expand Down
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,19 @@ gosec: install-deps
@gosec tests/...

# make unittest
unittest:
@echo "[INFO] Testing $(TF_OPENAPI_PROVIDER_PLUGIN_NAME)"
unittest: show-terraform-version
@echo "[INFO] Executing unit tests for $(TF_OPENAPI_PROVIDER_PLUGIN_NAME)"
@go test -v -cover $(TEST_PACKAGES) -coverprofile=coverage.txt -covermode=atomic

# make test
test: fmt vet lint gosec unittest

show-terraform-version:
terraform version

# make integration-test
integration-test: local-env-down local-env
@echo "[INFO] Testing $(TF_OPENAPI_PROVIDER_PLUGIN_NAME)"
integration-test: local-env-down local-env show-terraform-version
@echo "[INFO] Executing integration tests for $(TF_OPENAPI_PROVIDER_PLUGIN_NAME)"
@TF_ACC=true go test -v -cover $(INT_TEST_PACKAGES) ; if [ $$? -eq 1 ]; then \
echo "[ERROR] Test returned with failures. Please go through the different scenarios and fix the tests that are failing"; \
exit 1; \
Expand Down
12 changes: 2 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,22 @@ go 1.14
require (
github.com/DataDog/datadog-go v2.2.0+incompatible
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a
github.com/davecgh/go-spew v1.1.1
github.com/dikhan/http_goclient v0.0.0-20181010015730-b9de9b5ee7b6
github.com/dikhan/terraform-provider-openapi v0.31.1
github.com/go-openapi/jsonreference v0.17.0
github.com/go-openapi/loads v0.0.0-20171207192234-2a2b323bab96
github.com/go-openapi/spec v0.19.0
github.com/goadesign/goa v0.0.0-20180629224717-ed6ccb1eb93a
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/gorilla/mux v1.6.2
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
github.com/hashicorp/go-uuid v1.0.1
github.com/hashicorp/terraform-plugin-sdk/v2 v2.4.3
github.com/iancoleman/strcase v0.0.0-20180726023541-3605ed457bf7
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/hashstructure v1.0.0
github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852
github.com/pborman/uuid v0.0.0-20170612153648-e790cca94e6c
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d
github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a
github.com/spf13/cobra v0.0.3
github.com/stretchr/testify v1.6.1
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a // indirect
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 // indirect
golang.org/x/tools v0.1.0 // indirect
google.golang.org/appengine v1.6.6 // indirect
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
golang.org/x/tools v0.1.1 // indirect
gopkg.in/yaml.v2 v2.2.4
)
Loading

0 comments on commit 1657b56

Please sign in to comment.