Skip to content

Commit

Permalink
Merge pull request #67 from MissionCriticalCloud/set_instance_offerin…
Browse files Browse the repository at this point in the history
…g_case_insensitive

Fix instance service offering bug
  • Loading branch information
mvangoor authored Apr 21, 2020
2 parents 7639e56 + 5d8c753 commit 707a928
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

- Add ability to rename `cosmic_network_acl`'s `name` and `description` fields
- Add `client_timeout` and `server_timeout` fields to `cosmic_loadbalancer_rule`
- Fix bug where a resource's offering is saved in state as a case sensitive value
- Fix bug where changing `cosmic_loadbalancer_rule` private or public ports did not recreate the resource
- Fix bug where changing `cosmic_loadbalancer_rule` protocol did not recreate the resource

Expand Down
3 changes: 3 additions & 0 deletions cosmic/resource_cosmic_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ func resourceCosmicDisk() *schema.Resource {
"disk_offering": &schema.Schema{
Type: schema.TypeString,
Required: true,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
return strings.EqualFold(old, new)
},
},

"attach": &schema.Schema{
Expand Down
3 changes: 2 additions & 1 deletion cosmic/resource_cosmic_disk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cosmic

import (
"fmt"
"strings"
"testing"

"github.com/MissionCriticalCloud/go-cosmic/v6/cosmic"
Expand Down Expand Up @@ -344,7 +345,7 @@ resource "cosmic_disk" "foo" {
disk_offering = "%s"
zone = "%s"
}`,
COSMIC_DISK_OFFERING,
strings.ToLower(COSMIC_DISK_OFFERING),
COSMIC_ZONE,
)

Expand Down
3 changes: 3 additions & 0 deletions cosmic/resource_cosmic_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ func resourceCosmicInstance() *schema.Resource {
"service_offering": {
Type: schema.TypeString,
Required: true,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
return strings.EqualFold(old, new)
},
},

"network_id": {
Expand Down
3 changes: 2 additions & 1 deletion cosmic/resource_cosmic_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cosmic

import (
"fmt"
"strings"
"testing"

"github.com/MissionCriticalCloud/go-cosmic/v6/cosmic"
Expand Down Expand Up @@ -388,7 +389,7 @@ resource "cosmic_instance" "foo" {
COSMIC_VPC_OFFERING,
COSMIC_ZONE,
COSMIC_VPC_NETWORK_OFFERING,
COSMIC_SERVICE_OFFERING_1,
strings.ToLower(COSMIC_SERVICE_OFFERING_1),
COSMIC_TEMPLATE,
)

Expand Down
3 changes: 3 additions & 0 deletions cosmic/resource_cosmic_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ func resourceCosmicNetwork() *schema.Resource {
"network_offering": &schema.Schema{
Type: schema.TypeString,
Required: true,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
return strings.EqualFold(old, new)
},
},

"vlan": &schema.Schema{
Expand Down
3 changes: 2 additions & 1 deletion cosmic/resource_cosmic_network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cosmic

import (
"fmt"
"strings"
"testing"

"github.com/MissionCriticalCloud/go-cosmic/v6/cosmic"
Expand Down Expand Up @@ -263,7 +264,7 @@ resource "cosmic_network" "foo" {
terraform-tag = "true"
}
}`,
COSMIC_VPC_OFFERING,
strings.ToLower(COSMIC_VPC_OFFERING),
COSMIC_ZONE,
COSMIC_VPC_NETWORK_OFFERING,
)
Expand Down
3 changes: 3 additions & 0 deletions cosmic/resource_cosmic_vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ func resourceCosmicVPC() *schema.Resource {
"vpc_offering": &schema.Schema{
Type: schema.TypeString,
Required: true,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
return strings.EqualFold(old, new)
},
},

"network_domain": &schema.Schema{
Expand Down
3 changes: 2 additions & 1 deletion cosmic/resource_cosmic_vpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cosmic

import (
"fmt"
"strings"
"testing"

"github.com/MissionCriticalCloud/go-cosmic/v6/cosmic"
Expand Down Expand Up @@ -117,6 +118,6 @@ resource "cosmic_vpc" "foo" {
network_domain = "terraform-domain"
zone = "%s"
}`,
COSMIC_VPC_OFFERING,
strings.ToLower(COSMIC_VPC_OFFERING),
COSMIC_ZONE,
)

0 comments on commit 707a928

Please sign in to comment.