Skip to content

Release/v12.0 #150

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

Open
wants to merge 84 commits into
base: development/v2.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
0b5366e
Moved to go modules , incremented plugin version to 2.3.3
nwright-nz Nov 23, 2019
099ecfa
Updated plugin schema to use new plugin sdk package
nwright-nz Nov 23, 2019
e15088b
Updated remaining references to new plugin sdk
nwright-nz Nov 23, 2019
f3e4de7
Fixed provider error which set defaults of an empty string on region …
nwright-nz Nov 23, 2019
942bba7
Updated tests and README to reflect 0.12 changes
nwright-nz Nov 24, 2019
82edd9b
Updated README with 0.12 style
nwright-nz Nov 24, 2019
6b5954c
Last README update to remove incorrect quotes in template example
nwright-nz Nov 24, 2019
c67886e
Merge pull request #140 from nwright-nz/providerupgrade0.12
samuelchong Dec 19, 2019
8c345d9
update go version to 1.13.5 and terraform versionto 0.12.18
Jan 9, 2020
1298b2a
update go version to 1.13
Jan 9, 2020
1fa0713
testing
Jan 9, 2020
5982ce1
test 2
Jan 9, 2020
598d4c3
fiddling travis ci config for go version
Jan 9, 2020
5ccfdf4
revert go version to 1.12 due to lack of support in travisci.
Jan 9, 2020
456d6d6
revert go version to 1.12.1 to make travisci happy.
Jan 9, 2020
fe647f5
test go version
Jan 9, 2020
8420133
disable go module in travis ci
Jan 9, 2020
df55dce
update changes file
Jan 9, 2020
3e29bee
update version
Jan 9, 2020
683d59a
update docker file
Jan 10, 2020
a9b6dd8
Fix issue Conflict error when using cloudcontrol_endpoint instead of …
Apr 8, 2020
bb28e0a
upgrade go to v1.13 and terraform version to v0.12.24
Apr 8, 2020
fe43515
revert bin directory to default
Apr 8, 2020
6a8624c
debug build error on travisci
Apr 8, 2020
14476f1
another attempt to debug travisci issue
Apr 8, 2020
df68876
revert go version to v1.12.1 as travisci doenst support 1.13
Apr 8, 2020
4fbc187
another attempt to fix travis
Apr 8, 2020
913b0b5
another attempt to fix travis
Apr 8, 2020
79ca6cd
another attempt to fix travis
Apr 8, 2020
c02372c
another attempt to fix travis
Apr 8, 2020
dfb751d
another attempt to fix travis
Apr 8, 2020
24315ae
another attempt to fix travis
Apr 8, 2020
ff27286
another attempt to fix travis
Apr 8, 2020
41fa766
another attempt to fix travis
Apr 8, 2020
875207a
another attempt to fix travis
Apr 8, 2020
e6befdb
another attempt to fix travis
Apr 8, 2020
5b2d1e9
another attempt to fix travis
Apr 8, 2020
e29f51e
another attempt to fix travis
Apr 8, 2020
6488393
another attempt to fix travis
Apr 9, 2020
40cc0b8
another attempt to fix travis
Apr 9, 2020
0625aaf
another attempt to fix travis
Apr 9, 2020
bbb814f
update deplecated travis config
May 8, 2020
1a492b6
fix issue with get OS image with caas API v2.3. Update to use v2.9
Jul 7, 2020
d35507d
Fix NAT rule creation to accept non RFC address
Jul 8, 2020
86bb234
update travis yml
Jul 8, 2020
d5914e4
test travis config
Jul 13, 2020
2232448
test travis config release
Jul 13, 2020
96c3d63
test travis config path
Jul 13, 2020
82454aa
test travis config
Jul 13, 2020
85e4550
test travis config add tag
Jul 13, 2020
04ffeae
test travis config set tag
Jul 14, 2020
12bd296
test travis config set tag 2
Jul 14, 2020
003f25a
test travis config set tag test
Jul 14, 2020
2530656
test travis config set tag to true
Jul 14, 2020
3524d1d
test travis config test
Jul 14, 2020
dd563db
test travis config test2
Jul 14, 2020
5e85ef2
test travis config test3
Jul 14, 2020
f91018b
test travis new tes
Jul 14, 2020
df49755
test travis new tes 2
Jul 14, 2020
6609d16
test travis new tes 3
Jul 14, 2020
0decb9d
test travis tag
Jul 14, 2020
2d320dc
fix travis config
Jul 15, 2020
ddf50fd
fix travis config 2
Jul 15, 2020
98dc37a
fix travis config 3
Jul 15, 2020
44c12f3
fix travis config 4
Jul 15, 2020
5182515
fix travis config 5
Jul 15, 2020
f16f6d9
fix travis config 6
Jul 15, 2020
e539b22
fix travis config 7
Jul 15, 2020
fde41af
fix travis config 11
Jul 15, 2020
27bbb74
terraform v12
Jul 15, 2020
7e874b3
update submodule
Oct 12, 2020
cf25fe1
update go modules
Oct 29, 2020
a13f522
update
Oct 29, 2020
bae0be1
update readme
Oct 29, 2020
1cf5bbc
update travis config
Oct 29, 2020
93f0c53
Added terraform 0.13 upgrade guide
Oct 29, 2020
b938c50
move migration doc to correct folder
Oct 29, 2020
84392c9
edit travis output setting
Oct 29, 2020
4bf25ee
add travis deploy attribute file_glob
Oct 29, 2020
7f4c0c8
Create .goreleaser.yml
samuelchong Nov 9, 2020
8e3dca9
add github release yml
Nov 9, 2020
3a668b9
add github release yml
Nov 9, 2020
0cae29d
Fix error on github build
Nov 10, 2020
c112c8d
fix github build
Nov 10, 2020
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
47 changes: 47 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This GitHub action can publish assets for release when a tag is created.
# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0).
#
# This uses an action (paultyng/ghaction-import-gpg) that assumes you set your
# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE`
# secret. If you would rather own your own GPG handling, please fork this action
# or use an alternative one for key handling.
#
# You will need to pass the `--batch` flag to `gpg` in your signing step
# in `goreleaser` to indicate this is being used in a non-interactive mode.
#
name: release
on:
push:
tags:
- 'v*'
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Unshallow
run: git fetch --prune --unshallow
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.14
-
name: Import GPG key
id: import_gpg
uses: paultyng/ghaction-import-gpg@v2.1.0
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
_obj
_test
_bin
vendor

# Architecture specific extensions/prefixes
*.[568vq]
Expand Down Expand Up @@ -37,3 +38,5 @@ AccTest.log
**/.idea
*.old
*.OLD


54 changes: 54 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Visit https://goreleaser.com for documentation on how to customize this
# behavior.
before:
hooks:
# this is just an example and not a requirement for provider building/publishing
- go mod tidy
builds:
- env:
# goreleaser does not work with CGO, it could also complicate
# usage by users in CI/CD systems like Terraform Cloud where
# they are unable to install libraries.
- CGO_ENABLED=0
mod_timestamp: '{{ .CommitTimestamp }}'
flags:
- -trimpath
ldflags:
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
goos:
- freebsd
- windows
- linux
- darwin
goarch:
- amd64
- '386'
- arm
- arm64
ignore:
- goos: darwin
goarch: '386'
binary: '{{ .ProjectName }}_v{{ .Version }}'
archives:
- format: zip
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
checksum:
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
algorithm: sha256
signs:
- artifacts: checksum
args:
# if you are using this is a GitHub action or some other automated pipeline, you
# need to pass the batch flag to indicate its not interactive.
- "--batch"
- "--local-user"
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
- "--output"
- "${signature}"
- "--detach-sign"
- "${artifact}"
release:
# If you want to manually examine the release before its live, uncomment this line:
# draft: true
changelog:
skip: true
32 changes: 0 additions & 32 deletions .travis.yml

This file was deleted.

4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes

### v3.0.0
Breaking Changes:
* Upgrade to terraform 0.12

### v1.3.8

* Handle missing server when checking for existence of server network adapter (DimensionDataResearch/dd-cloud-compute-terraform#114).
Expand Down
54 changes: 48 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,52 @@
FROM hashicorp/terraform:0.9.9
# ---------------------------------------------------------------------------------------------------------------------
# Terraform Build Image

MAINTAINER Adam Friedman <adam.friedman@itaas.dimensiondata.com>
# FROM golang:alpine as Build
FROM golang:1.12.1-alpine as Build

ENV TERRAFORM_VERSION=0.12.19
ENV DDCLOUD_VERSION=3.0

RUN mkdir -p /config
VOLUME /config
RUN apk add --update git bash openssh make

WORKDIR /config
ENV TF_DEV=true
ENV TF_RELEASE=true

COPY _bin/linux-amd64/terraform-provider-ddcloud /bin

## Terraform
WORKDIR $GOPATH/src/github.com/hashicorp/terraform
RUN git clone https://github.com/hashicorp/terraform.git ./ && \
git checkout v${TERRAFORM_VERSION} && \
/bin/bash scripts/build.sh && \
ls -l /bin


## DDCloud Provider
WORKDIR $GOPATH/src/github.com/DimensionDataResearch/dd-cloud-compute-terraform
RUN git clone https://github.com/DimensionDataResearch/dd-cloud-compute-terraform.git ./ && \
# git checkout v${DDCLOUD_VERSION} && \
git checkout development/v${DDCLOUD_VERSION} && \
go get github.com/pkg/errors && \
go get golang.org/x/crypto/pkcs12 && \
go get github.com/DimensionDataResearch/go-dd-cloud-compute/compute && \
make dev



# ---------------------------------------------------------------------------------------------------------------------
# Create Minimal Image

FROM alpine
RUN apk add --update git bash openssh curl
COPY --from=build /go/bin/terraform /bin
COPY --from=build /usr/local/bin/terraform-provider-ddcloud /bin


## Kubectl binadry download (The K8s/Helm Terraform providers are not yet able to perform all the configuration required during a deployment)
RUN wget https://storage.googleapis.com/kubernetes-release/release/v1.15.3/bin/linux/amd64/kubectl && \
chmod +x ./kubectl && \
mv ./kubectl /usr/local/bin/kubectl

WORKDIR /bin

ENTRYPOINT ["terraform"]
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
PROVIDER_NAME = ddcloud

VERSION = 2.3.2
VERSION = 3.0.5
VERSION_INFO_FILE = ./$(PROVIDER_NAME)/version-info.go

BIN_DIRECTORY = _bin
# BIN_DIRECTORY = /usr/local/bin
EXECUTABLE_NAME = terraform-provider-$(PROVIDER_NAME)
DIST_ZIP_PREFIX = $(EXECUTABLE_NAME).v$(VERSION)

Expand Down
31 changes: 18 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,16 @@ For more information, see the [provider documentation](docs/).

## Prerequisites

Requires Terraform v0.8.x or newer (currently built against Terraform v0.11.x).
Requires Terraform v0.12+

## Installing the provider

Download the [latest release](https://github.com/DimensionDataResearch/dd-cloud-compute-terraform/releases/latest) and place the provider executable in the same directory as the main Terraform executable.
Simply place terraform-provider-ddcloud binary on the same directory as terraform binary.

## Using Terraform v0.13
In terraform v0.13, the concept of registry namespace is introduced.
To use in-house provider build, follow instructions below.
- Instruction to be provided

### Docker

Expand Down Expand Up @@ -63,9 +68,9 @@ Create a folder containing a single `.tf` file:

provider "ddcloud" {
# User name and password can also be specified via MCP_USER and MCP_PASSWORD environment variables.
"username" = "my_username"
"password" = "my_password" # Watch out for escaping if your password contains characters such as "$".
"region" = "AU" # The DD compute region code (e.g. "AU", "NA", "EU")
username = "my_username"
password = "my_password" # Watch out for escaping if your password contains characters such as "$".
region = "AU" # The DD compute region code (e.g. "AU", "NA", "EU")
}

resource "ddcloud_networkdomain" "my-domain" {
Expand All @@ -78,8 +83,8 @@ resource "ddcloud_vlan" "my-vlan" {
name = "terraform-test-vlan"
description = "This is my Terraform test VLAN."

networkdomain = "${ddcloud_networkdomain.my-domain.id}"

networkdomain = ddcloud_networkdomain.my-domain.id
attached_vlan_gateway_addressing = "HIGH"
# VLAN's default network: 192.168.17.1 -> 192.168.17.254 (netmask = 255.255.255.0)
ipv4_base_address = "192.168.17.0"
ipv4_prefix_size = 24
Expand All @@ -95,9 +100,9 @@ resource "ddcloud_server" "my-server" {
memory_gb = 8
cpu_count = 2

networkdomain = "${ddcloud_networkdomain.my-domain.id}"
networkdomain = ddcloud_networkdomain.my-domain.id

primary_network_adapter = {
primary_network_adapter {
ipv4 = "192.168.17.10"
}

Expand All @@ -123,8 +128,8 @@ resource "ddcloud_server" "my-server" {
}

resource "ddcloud_nat" "my-server-nat" {
networkdomain = "${ddcloud_networkdomain.my-domain.id}"
private_ipv4 = "${ddcloud_server.my-server.primary_adapter_ipv4}"
networkdomain = ddcloud_networkdomain.my-domain.id
private_ipv4 = ddcloud_server.my-server.primary_adapter_ipv4

# public_ipv4 is computed at deploy time.

Expand All @@ -146,10 +151,10 @@ resource "ddcloud_firewall_rule" "my-vm-http-in" {
# For a ddcloud_vlan, you can obtain these values using the ipv4_baseaddress and ipv4_prefixsize properties.

# You can also specify destination_network or destination_address_list instead of source_address.
destination_address = "${ddcloud_nat.my-server-nat.public_ipv4}"
destination_address = ddcloud_nat.my-server-nat.public_ipv4
destination_port = "80"

networkdomain = "${ddcloud_networkdomain.my-domain.id}"
networkdomain = ddcloud_networkdomain.my-domain.id
}
```

Expand Down
3 changes: 2 additions & 1 deletion ddcloud/datasource_addresslist.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package ddcloud

import (
"fmt"
"github.com/hashicorp/terraform/helper/schema"
"log"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)

func dataSourceAddressList() *schema.Resource {
Expand Down
2 changes: 1 addition & 1 deletion ddcloud/datasource_networkdomain.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"log"

"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)

func dataSourceNetworkDomain() *schema.Resource {
Expand Down
4 changes: 2 additions & 2 deletions ddcloud/datasource_networkdomain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package ddcloud
import (
"fmt"
"github.com/DimensionDataResearch/go-dd-cloud-compute/compute"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
"testing"
)

Expand Down
2 changes: 1 addition & 1 deletion ddcloud/datasource_pfx.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"io/ioutil"
"log"

"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"golang.org/x/crypto/pkcs12"
)

Expand Down
2 changes: 1 addition & 1 deletion ddcloud/datasource_vlan.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"log"

"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)

func dataSourceVLAN() *schema.Resource {
Expand Down
8 changes: 3 additions & 5 deletions ddcloud/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (

"github.com/DimensionDataResearch/dd-cloud-compute-terraform/retry"
"github.com/DimensionDataResearch/go-dd-cloud-compute/compute"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/terraform"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
)

// Provider creates the Dimension Data Cloud resource provider.
Expand All @@ -23,14 +23,12 @@ func Provider() terraform.ResourceProvider {
"region": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: "",
Description: "The region code that identifies the target end-point for the Dimension Data CloudControl API.",
ConflictsWith: []string{"cloudcontrol_endpoint"},
},
"cloudcontrol_endpoint": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: "",
Description: "The base URL of a custom target end-point for the Dimension Data CloudControl API.",
ConflictsWith: []string{"region"},
},
Expand Down Expand Up @@ -156,7 +154,7 @@ func Provider() terraform.ResourceProvider {
// Returns the provider's compute API client.
func configureProvider(providerSettings *schema.ResourceData) (interface{}, error) {
// Log provider version (for diagnostic purposes).
log.Print("ddcloud provider version is " + ProviderVersion)
// log.Print("ddcloud provider version is " + ProviderVersion)

log.Printf("ProviderSettings = %#v", providerSettings)

Expand Down
Loading