Skip to content

Commit

Permalink
fix update bug caused by unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Wafle authored and Robert Wafle committed Oct 4, 2022
1 parent 7e01b18 commit 516be8d
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 15 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
TEST?=$$(go list ./... | grep -v 'vendor')
HOSTNAME=terraform.vmware.com
NAMESPACE=csc
HOSTNAME=registry.terraform.io
NAMESPACE=robwafle
NAME=tsm
BINARY=terraform-provider-${NAME}
VERSION=0.0.75
VERSION=0.0.77
OS_ARCH=linux_amd64

default: install
Expand Down
3 changes: 2 additions & 1 deletion client/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ func (c *Client) UpdateCluster(ctx context.Context, cluster Cluster, authToken *
tflog.Trace(ctx, "Updating Cluster ...")
putUrl := fmt.Sprintf("%s/tsm/v1alpha1/clusters/%s?createOnly=false", c.HostURL, cluster.DisplayName)

// set this to nil, because we're not supposed to send it to the PUT
// set this to nil, because we're not supposed to send it to the PUT // set this to nil, because we're not supposed to send it to the PUT
cluster.ID = ""
clusterJSON, err := json.Marshal(cluster)
if err != nil {
return nil, err
Expand Down
4 changes: 3 additions & 1 deletion client/globalnamespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ func (c *Client) GetGlobalNamespace(ctx context.Context, id string) (*GlobalName

// CreateGlobalNamespace - Create new GlobalNamespace
func (c *Client) CreateUpdateGlobalNamespace(ctx context.Context, globalNamespace GlobalNamespace, authToken *string) (*GlobalNamespace, error) {
putUrl := fmt.Sprintf("%s/tsm/v1alpha1/global-namespaces/%s", c.HostURL, globalNamespace.Name)
putUrl := fmt.Sprintf("%s/tsm/v1alpha1/global-namespaces/%s", c.HostURL, globalNamespace.ID)

// set this to nil, because we're not supposed to send it to the PUT
globalNamespace.ID = ""

GlobalNamespaceJSON, err := json.Marshal(globalNamespace)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/globalnamespace.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ description: |-

### Optional

- `color` (String)
- `color` (String) test description
- `description` (String)
- `last_updated` (String)
- `match_condition` (Block Set) (see [below for nested schema](#nestedblock--match_condition))
Expand Down
2 changes: 1 addition & 1 deletion examples/aks_cluster/tsm-cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ resource "tsm_cluster" "aks" {
labels = {
L1 = "value one"
L2 = "value two"
//L3 = "value three"
L3 = "value three"
L4 = "value four"
}

Expand Down
2 changes: 1 addition & 1 deletion examples/aks_cluster/tsm-globalnamespace.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ resource "tsm_globalnamespace" "default" {
api_discovery_enabled = true
ca_type = "PreExistingCA"
ca = "default"
description = "created via terraform"
description = "created via terraform test update"
color = "#00FF00"
version = "2.0"

Expand Down
1 change: 0 additions & 1 deletion examples/aks_cluster/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ terraform {
# version = "=2.8.0"
# }
}

required_version = ">= 0.14"
}

4 changes: 0 additions & 4 deletions examples/global_namespace/versions.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
terraform {
required_providers {

tsm = {
source = "robwafle/tsm"
version = "~> 0.0.1"
}


}

required_version = ">= 0.14"
}

5 changes: 3 additions & 2 deletions provider/resource_globalnamespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ func ResourceGlobalNamespaceSchema() map[string]*schema.Schema {
Optional: true,
},
"color": {
Type: schema.TypeString,
Optional: true,
Type: schema.TypeString,
Optional: true,
Description: "test description",
},
"version": {
Type: schema.TypeString,
Expand Down

0 comments on commit 516be8d

Please sign in to comment.