Skip to content

Commit

Permalink
Merge pull request #163 from iclonghoang/INS-18246-add-plugin-paramet…
Browse files Browse the repository at this point in the history
…er-for-opensearch

INS-18246 add opensearch plugin parameter in bundleOptions and oidcProvider in clusterRequest
  • Loading branch information
admintfprovider authored Apr 5, 2022
2 parents 7941a11 + 02b1822 commit 5fd5774
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ BIN_NAME=terraform-provider-instaclustr
# for VERSION, don't add prefix "v", e.g., use "1.9.8" instead of "v1.9.8" as it could break circleCI stuff


VERSION=1.17.0
VERSION=1.18.0

INSTALL_FOLDER=$(HOME)/.terraform.d/plugins/terraform.instaclustr.com/instaclustr/instaclustr/$(VERSION)/darwin_amd64

Expand Down
11 changes: 6 additions & 5 deletions acc_test/data/valid_elasticsearch_cluster_create.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ resource "instaclustr_cluster" "validElasticsearch" {
bundle = "ELASTICSEARCH"
version = "1.13.3"
options = {
dedicated_master_nodes = false,
master_node_size = "t3.small-v2",
data_node_size = "t3.small-v2",
security_plugin=false,
client_encryption=false
dedicated_master_nodes = false,
master_node_size = "t3.small-v2",
data_node_size = "t3.small-v2",
security_plugin = false,
index_management_plugin = true,
client_encryption = false
}
}
}
11 changes: 6 additions & 5 deletions acc_test/data/valid_opensearch_cluster_create.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ resource "instaclustr_cluster" "validOpenSearch" {
bundle = "OPENSEARCH"
version = "1.2.4"
options = {
dedicated_master_nodes = false,
master_node_size = "t3.small-v2",
data_node_size = "t3.small-v2",
security_plugin = true,
client_encryption = true
dedicated_master_nodes = false,
master_node_size = "t3.small-v2",
data_node_size = "t3.small-v2",
security_plugin = true,
index_management_plugin = true
client_encryption = true
}
}
}
2 changes: 1 addition & 1 deletion acc_test/data/valid_redis_cluster_create.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ provider "instaclustr" {
resource "instaclustr_cluster" "validRedis" {
cluster_name = "tf-redis-test"
node_size = "t3.small-20-r"
data_centre = "US_EAST_1"
data_centre = "US_WEST_2"
sla_tier = "NON_PRODUCTION"
cluster_network = "192.168.0.0/18"
private_network_cluster = false
Expand Down
1 change: 0 additions & 1 deletion acc_test/resource_redis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ func TestRedisResource(t *testing.T) {
testCheckResourceValid(resourceName),
testCheckResourceCreated(resourceName, hostname, username, apiKey),
checkClusterRunning(resourceName, hostname, username, apiKey),
testCheckContactIPCorrect(resourceName, hostname, username, apiKey, 5, 5),
),
},
{
Expand Down
2 changes: 2 additions & 0 deletions docs/resources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Property | Description | Default
`kafka_schema_registry_user_password`|The password of kafka schema registry bundle user, if it is a Kafka cluster with schema-registry addon. This field is updatable and requires `wait_for_state` to be `RUNNING`.|Optional
`wait_for_state`|The expected state of the cluster before completing the resource creation. Skipping this field will asynchronously create the cluster.|Optional (valid states are RUNNING and PROVISIONED)
`kafka_connect_credential`|Sensitive fields pertaining Kafka Connect custom connector bucket credential and sensitive Kafka worker property|Optional. See more details below.
`oidc_provider`|The ID of an OIDC provider to be used for Elasticsearch Kibana or OpenSearch Dashboards. OIDC providers must be set in Console Cluster Resources to be available for use.|Optional

### cluster_provider

Expand Down Expand Up @@ -82,6 +83,7 @@ Property | Description | For Bundles | Default
`kibana_node_size`|Desired master node size. See [here](https://developer.instaclustr.com/#operation/extendedProvisionRequestHandler) for more details. |Elasticsearch|
`opensearch_dashboards_node_size`|Desired OpenSearch Dashboards node size. See [here](https://developer.instaclustr.com/#operation/extendedProvisionRequestHandler) for more details. |OpenSearch|
`security_plugin`|Accepts true/false. Enables Security Plugin. This option gives an extra layer of security to the cluster. This will automatically enable internode encryption. Enforced to be true for all OpenSearch clusters. |Elasticsearch, OpenSearch|false
`index_management_plugin`|Accepts true/false. Enables Index Management Plugin which allows automating index management activities. |Elasticsearch, OpenSearch|false
`use_private_broadcast_rpc_address`|Accepts true/false. Enables broadcast of private IPs for auto-discovery.|Cassandra|false
`lucene_enabled`|Accepts true/false. Enabled Cassandra Lucene Index Plugin.|Cassandra|false
`continuous_backup_enabled`|Accepts true/false. Enables commitlog backups and increases the frequency of the default snapshot backups.|Cassandra|false
Expand Down
18 changes: 18 additions & 0 deletions instaclustr/resource_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,12 @@ func resourceCluster() *schema.Resource {
},
},

"oidc_provider": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},

"bundles": {
Type: schema.TypeSet,
Optional: true,
Expand Down Expand Up @@ -555,6 +561,16 @@ func resourceCluster() *schema.Resource {
Optional: true,
ForceNew: true,
},
"security_plugin": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
},
"index_management_plugin": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
},
"postgresql_node_count": {
Type: schema.TypeInt,
Optional: false,
Expand Down Expand Up @@ -744,6 +760,7 @@ func resourceClusterCreate(d *schema.ResourceData, meta interface{}) error {
NodeSize: size,
PrivateNetworkCluster: fmt.Sprintf("%v", d.Get("private_network_cluster")),
PCICompliantCluster: fmt.Sprintf("%v", d.Get("pci_compliant_cluster")),
OidcProvider: fmt.Sprintf("%v", d.Get("oidc_provider")),
}

dataCentre := d.Get("data_centre").(string)
Expand Down Expand Up @@ -1400,6 +1417,7 @@ func resourceClusterRead(d *schema.ResourceData, meta interface{}) error {
d.Set("sla_tier", strings.ToUpper(cluster.SlaTier))
d.Set("private_network_cluster", cluster.DataCentres[0].PrivateIPOnly)
d.Set("pci_compliant_cluster", cluster.PciCompliance == "ENABLED")
d.Set("oidc_provider", cluster.OidcProvider)

azList := make([]string, 0)
publicContactPointList := make([]string, 0)
Expand Down
3 changes: 3 additions & 0 deletions instaclustr/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type BundleOptions struct {
OpenSearchDashboardsNodeSize string `json:"openSearchDashboardsNodeSize,omitempty" mapstructure:"opensearch_dashboards_node_size,omitempty"`
DataNodeSize string `json:"dataNodeSize,omitempty" mapstructure:"data_node_size,omitempty"`
SecurityPlugin *bool `json:"securityPlugin,omitempty" mapstructure:"security_plugin,omitempty"`
IndexManagementPlugin *bool `json:"indexManagementPlugin,omitempty" mapstructure:"index_management_plugin,omitempty"`
UsePrivateBroadcastRpcAddress *bool `json:"usePrivateBroadcastRPCAddress,omitempty" mapstructure:"use_private_broadcast_rpc_address,omitempty"`
LuceneEnabled *bool `json:"luceneEnabled,omitempty" mapstructure:"lucene_enabled,omitempty"`
ContinuousBackupEnabled *bool `json:"continuousBackupEnabled,omitempty" mapstructure:"continuous_backup_enabled,omitempty"`
Expand Down Expand Up @@ -90,6 +91,7 @@ type CreateRequest struct {
PrivateNetworkCluster string `json:"privateNetworkCluster,omitempty"`
PCICompliantCluster string `json:"pciCompliantCluster,omitempty"`
RackAllocation *RackAllocation `json:"rackAllocation,omitempty"`
OidcProvider string `json:"oidcProvider,omitempty"`
}

type DataCentreCreateRequest struct {
Expand Down Expand Up @@ -123,6 +125,7 @@ type Cluster struct {
DataCentre string `json:"dataCentre"`
DataCentres []DataCentre `json:"dataCentres"`
Provider []ClusterProvider `json:"clusterProvider"`
OidcProvider string `json:"oidcId"`
}

type ClusterListItem struct {
Expand Down

0 comments on commit 5fd5774

Please sign in to comment.