Skip to content

Commit 3f4ccc5

Browse files
committed
Don't wipe existing hosts. Fixes #69
Signed-off-by: Andy Lo-A-Foe <andy.loafoe@gmail.com>
1 parent 7edf028 commit 3f4ccc5

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ require (
1919
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
2020
github.com/opencontainers/go-digest v1.0.0 // indirect
2121
github.com/philips-labs/siderite v0.6.0
22-
github.com/philips-software/go-hsdp-api v0.37.1-0.20210413193223-fc685c84996b
22+
github.com/philips-software/go-hsdp-api v0.37.1-0.20210414115020-514bd12e0742
2323
github.com/pkg/errors v0.9.1
2424
github.com/robfig/cron/v3 v3.0.1
2525
github.com/stretchr/testify v1.7.0

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,8 @@ github.com/philips-labs/siderite v0.6.0 h1:o4jcUvjtUIMS+dKHjXGd+mHk4ClUiQt/2NUGJ
631631
github.com/philips-labs/siderite v0.6.0/go.mod h1:vELGuq6uWTRqLci6Z22kjdn+b12eJPtss+tV6/PIlSk=
632632
github.com/philips-software/go-hsdp-api v0.37.1-0.20210413193223-fc685c84996b h1:72DSt36CayMEMC/pCLkt29VZUx8rTNYm9LUWqyMGtuk=
633633
github.com/philips-software/go-hsdp-api v0.37.1-0.20210413193223-fc685c84996b/go.mod h1:6Ikri/r6eezHLVN+y4rZpeYygy10CKsuXqOVuDrpoXQ=
634+
github.com/philips-software/go-hsdp-api v0.37.1-0.20210414115020-514bd12e0742 h1:ayZBIZGyJZYVuCutNtJPPCMySLu1ZAX5MrGVsGtKgv0=
635+
github.com/philips-software/go-hsdp-api v0.37.1-0.20210414115020-514bd12e0742/go.mod h1:6Ikri/r6eezHLVN+y4rZpeYygy10CKsuXqOVuDrpoXQ=
634636
github.com/philips-software/go-hsdp-signer v1.3.0 h1:Si1voDE/GHzthmxpasPdntbu8aUW6EYJfI6gHVf7BCc=
635637
github.com/philips-software/go-hsdp-signer v1.3.0/go.mod h1:/QehZ/+Aks2t1TFpjhF/7ZSB8PJIIJHzLc03rOqwLw0=
636638
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=

hsdp/resource_container_host.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,10 @@ func resourceContainerHostCreate(ctx context.Context, d *schema.ResourceData, m
355355
instanceID := ""
356356
ipAddress := ""
357357
if err != nil {
358+
// Do not clean up existing hosts
359+
if err == cartel.ErrHostnameAlreadyExists {
360+
return diag.FromErr(fmt.Errorf("the host '%s' already exists", tagName))
361+
}
358362
if resp == nil {
359363
_, _, _ = client.Destroy(tagName)
360364
return diag.FromErr(fmt.Errorf("create error (resp=nil): %w", err))

0 commit comments

Comments
 (0)