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

Bump terraform version and add setup-test-env.sh #79

Merged
merged 2 commits into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ terraform {
required_providers {
harvester = {
source = "harvester/harvester"
version = "0.6.1"
version = "0.6.2"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/provider/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ terraform {
required_providers {
harvester = {
source = "harvester/harvester"
version = "0.6.1"
version = "0.6.2"
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions package/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ RUN zypper -n rm container-suseconnect && \
ARG ARCH=amd64
ENV KERNEL_ARCH linux_${ARCH}
# install terraform
ENV TERRAFORM_VERSION 1.1.5
ENV TERRAFORM_VERSION 1.4.6
ENV TERRAFORM_URL https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_${KERNEL_ARCH}.zip

RUN curl -sfL -o terraform.zip ${TERRAFORM_URL} && \
unzip terraform.zip -d /tmp/ && mv /tmp/terraform /usr/bin/ && rm -f terraform.zip && \
terraform version

# place provider into plugins directory
ARG PROVIDER_VERSION=0.0.0-master
ENV PROVIDERS_DIR /root/.terraform.d/plugins/registry.terraform.io/harvester/harvester
ARG PROVIDER_VERSION=0.0.0-dev
ENV PROVIDERS_DIR /root/.terraform.d/plugins/terraform.local/local/harvester
ENV PROVIDER_DIR ${PROVIDERS_DIR}/${PROVIDER_VERSION}/${KERNEL_ARCH}
RUN mkdir -p ${PROVIDER_DIR}
COPY ./terraform-provider-harvester ${PROVIDER_DIR}/terraform-provider-harvester_v${PROVIDER_VERSION}

RUN mkdir -p /data
COPY ./provider.tf /data/provider.tf
WORKDIR /data
11 changes: 11 additions & 0 deletions package/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
terraform {
required_providers {
harvester = {
source = "terraform.local/local/harvester"
version = "0.0.0-dev"
}
}
}
provider "harvester" {
kubeconfig = "kubeconfig"
}
2 changes: 1 addition & 1 deletion scripts/package
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ source $SCRIPTS_DIR/version
cd $TOP_DIR

if [ "${GIT_TAG}" != "${VERSION}" ]; then
PROVIDER_VERSION="0.0.0-master"
PROVIDER_VERSION="0.0.0-dev"
else
PROVIDER_VERSION=${VERSION#"v"}
fi
Expand Down
30 changes: 30 additions & 0 deletions setup-test-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
[[ -n $DEBUG ]] && set -x
set -eou pipefail

usage() {
cat <<HELP
USAGE:
setup-test-env.sh [KUBE_CONFIG_FILE]
HELP
}

if [ $# -lt 1 ]; then
usage
exit 1
fi

KUBE_CONFIG_FILE=$1

# build dev image
REPO="" TAG=dev make

# create tf container
docker rm -f tf
docker run -itd --name tf rancher/terraform-provider-harvester:dev bash

# copy kubeconfig to the tf container
docker cp "${KUBE_CONFIG_FILE}" tf:/data/kubeconfig

# exec to the tf container
docker exec -it tf bash