Skip to content

Commit da9b37e

Browse files
committed
Merge branch 'master' of https://github.com/iterative/terraform-provider-iterative into await-runner
2 parents 878f07c + dc406bf commit da9b37e

File tree

1,852 files changed

+56
-775100
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,852 files changed

+56
-775100
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
on:
22
push:
3-
branches: "*"
43
pull_request:
5-
branches: "*"
64
workflow_dispatch:
75

86
jobs:
@@ -14,14 +12,11 @@ jobs:
1412
- name: Install
1513
uses: actions/setup-go@v2
1614
with:
17-
go-version: ^1.14
15+
go-version: ^1.16
1816

1917
- name: Checkout
2018
uses: actions/checkout@v2
2119

22-
- name: Vendor # FIXME: remove this step when migrating to pure Go modules.
23-
run: go mod vendor
24-
2520
- name: Build
2621
run: make build
2722

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,9 @@ override.tf.json
3636
# Ignore CLI configuration files
3737
.terraformrc
3838
terraform.rc
39-
terraform
39+
terraform
40+
41+
# Ignore the Go vendor directory, superseded by proxy.golang.org and go.{mod,sum}
42+
vendor
43+
44+
./terraform-provider-iterative

Makefile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
TEST?=$$(go list ./... | grep -v 'vendor')
21
HOSTNAME=github.com
32
NAMESPACE=iterative
43
NAME=iterative
@@ -16,9 +15,8 @@ install: build
1615
mkdir -p ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}
1716
mv ${BINARY} ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}
1817

19-
test:
20-
go test -i $(TEST) || exit 1
21-
echo $(TEST) | xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4
18+
test:
19+
go test ./... $(TESTARGS) -timeout=30s -parallel=4
2220

23-
testacc:
24-
TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 120m
21+
testacc:
22+
TF_ACC=1 go test ./... -v $(TESTARGS) -timeout 120m

iterative/aws/provider.go

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"regexp"
88
"sort"
99
"strconv"
10+
"strings"
1011
"time"
1112

1213
"github.com/aws/aws-sdk-go/aws"
@@ -56,7 +57,25 @@ func ResourceMachineCreate(ctx context.Context, d *schema.ResourceData, m interf
5657
return decodeAWSError(region, err)
5758
}
5859
if len(imagesRes.Images) == 0 {
59-
return errors.New(ami + " ami not found in region")
60+
imagesRes, err = svc.DescribeImages(&ec2.DescribeImagesInput{
61+
Filters: []*ec2.Filter{
62+
{
63+
Name: aws.String("name"),
64+
Values: []*string{aws.String("*ubuntu/images/hvm-ssd/ubuntu-bionic-18.04*")},
65+
},
66+
{
67+
Name: aws.String("architecture"),
68+
Values: []*string{aws.String("x86_64")},
69+
},
70+
},
71+
})
72+
73+
if err != nil {
74+
return decodeAWSError(region, err)
75+
}
76+
if len(imagesRes.Images) == 0 {
77+
return errors.New("Nor " + ami + " nor Ubuntu Server 18.04 are available in your region")
78+
}
6079
}
6180

6281
sort.Slice(imagesRes.Images, func(i, j int) bool {
@@ -111,13 +130,23 @@ func ResourceMachineCreate(ctx context.Context, d *schema.ResourceData, m interf
111130
IpPermissions: ipPermissions,
112131
})
113132
}
133+
134+
if err != nil {
135+
decodedError := decodeAWSError(region, err)
136+
if !strings.Contains(decodedError.Error(), "already exists for VPC") {
137+
return decodedError
138+
}
139+
}
114140
}
115141

116142
sgDesc, err := svc.DescribeSecurityGroupsWithContext(ctx, &ec2.DescribeSecurityGroupsInput{
117143
Filters: []*ec2.Filter{
118144
{
119-
Name: aws.String("group-name"),
120-
Values: []*string{aws.String(securityGroup)},
145+
Name: aws.String("group-name"),
146+
Values: []*string{
147+
aws.String(securityGroup),
148+
aws.String(strings.Title(securityGroup)),
149+
aws.String(strings.ToUpper(securityGroup))},
121150
},
122151
},
123152
})

iterative/resource_machine.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,11 @@ func machineSchema() *map[string]*schema.Schema {
9191
Computed: true,
9292
},
9393
"ssh_private": &schema.Schema{
94-
Type: schema.TypeString,
95-
ForceNew: true,
96-
Optional: true,
97-
Default: "",
94+
Type: schema.TypeString,
95+
ForceNew: true,
96+
Optional: true,
97+
Default: "",
98+
Sensitive: true,
9899
},
99100
"ssh_name": &schema.Schema{
100101
Type: schema.TypeString,

iterative/resource_runner.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,11 @@ func resourceRunner() *schema.Resource {
126126
Computed: true,
127127
},
128128
"ssh_private": &schema.Schema{
129-
Type: schema.TypeString,
130-
ForceNew: true,
131-
Optional: true,
132-
Default: "",
129+
Type: schema.TypeString,
130+
ForceNew: true,
131+
Optional: true,
132+
Default: "",
133+
Sensitive: true,
133134
},
134135
"startup_script": &schema.Schema{
135136
Type: schema.TypeString,
@@ -243,7 +244,8 @@ systemctl disable apt-daily-upgrade.service
243244
244245
sudo add-apt-repository universe -y
245246
sudo add-apt-repository ppa:git-core/ppa -y
246-
sudo apt update && sudo apt-get install -y git
247+
sudo apt update && sudo apt install -y software-properties-common git
248+
247249
sudo curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh get-docker.sh
248250
sudo usermod -aG docker ubuntu
249251
sudo setfacl --modify user:ubuntu:rw /var/run/docker.sock
@@ -255,17 +257,14 @@ sudo apt update && sudo apt-get install -y terraform
255257
curl -sL https://deb.nodesource.com/setup_12.x | sudo bash
256258
sudo apt update && sudo apt-get install -y nodejs
257259
258-
sudo apt install -y ubuntu-drivers-common git
259260
sudo ubuntu-drivers autoinstall
260-
261261
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
262262
curl -s -L https://nvidia.github.io/nvidia-docker/ubuntu18.04/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
263263
sudo apt update && sudo apt install -y nvidia-docker2
264-
265264
sudo systemctl restart docker
266-
267265
sudo nvidia-smi
268266
sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi
267+
269268
{{end}}
270269
271270
sudo npm install -g git+https://github.com/iterative/cml.git

terraform-provider-iterative

-35.5 MB
Binary file not shown.

vendor/github.com/Azure/azure-sdk-for-go/LICENSE

Lines changed: 0 additions & 202 deletions
This file was deleted.

vendor/github.com/Azure/azure-sdk-for-go/NOTICE

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)