Skip to content

Commit

Permalink
Ins 12957 update api structure (#75)
Browse files Browse the repository at this point in the history
* Made changes to struct and imports to support new API
  • Loading branch information
Chrismelba-Instaclustr authored Mar 25, 2021
1 parent d4984a1 commit e2fdd22
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@

BIN_NAME="terraform-provider-instaclustr"
VERSION=v1.9.1

.PHONY: install clean all build test testacc testtarget
VERSION=v1.9.2

.PHONY: install clean all build test testacc testtarget release_version
release_version:
@echo $(VERSION)

all: build

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,5 @@ Please see https://www.instaclustr.com/support/documentation/announcements/insta
# License

Apache2 - See the included LICENSE file for more details.

Test
6 changes: 4 additions & 2 deletions instaclustr/resource_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ func resourceClusterRead(d *schema.ResourceData, meta interface{}) error{
d.Set("cluster_name", cluster.ClusterName)

clusterProvider := make(map[string]interface{}, 0)
mapstructure.Decode(cluster.Provider, &clusterProvider)
mapstructure.Decode(cluster.Provider[0], &clusterProvider)
processedClusterProvider := processProvider(d, clusterProvider)
d.Set("cluster_provider", processedClusterProvider)

Expand Down Expand Up @@ -727,7 +727,9 @@ func getBundlesFromCluster(cluster *Cluster) ([]map[string]interface{}, error) {
bundles := make([]map[string]interface{}, 0)
bundles = append(bundles, baseBundle)
if cluster.AddonBundles != nil {
bundles = append(bundles, cluster.AddonBundles)
for _, addonBundle := range cluster.AddonBundles{
bundles = append(bundles, addonBundle)
}
}

return bundles, nil
Expand Down
4 changes: 2 additions & 2 deletions instaclustr/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ type Cluster struct {
ClusterStatus string `json:"clusterStatus"`
BundleType string `json:"bundleType"`
BundleVersion string `json:"bundleVersion"`
AddonBundles map[string]interface{} `json:"addonBundles"`
AddonBundles []map[string]interface{} `json:"addonBundles"`
Username string `json:"username"`
InstaclustrUserPassword string `json:"instaclustrUserPassword"`
SlaTier string `json:"slaTier"`
ClusterCertificateDownload string `json:"clusterCertificateDownload"`
PciCompliance string `json:"pciCompliance"`
BundleOption *BundleOptions `json:"bundleOptions"`
DataCentres []DataCentre `json:"dataCentres"`
Provider ClusterProvider `json:"clusterProvider"`
Provider []ClusterProvider `json:"clusterProvider"`
}

type DataCentre struct {
Expand Down
4 changes: 4 additions & 0 deletions test/data/valid_kafka.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,9 @@ resource "instaclustr_cluster" "valid" {
bundle = "KAFKA_SCHEMA_REGISTRY"
version = "kafka-schema-registry:5.0.0"
}
bundle {
bundle = "KAFKA_REST_PROXY"
version = "kafka-rest-proxy:5.0.0"
}

}

0 comments on commit e2fdd22

Please sign in to comment.