forked from spotinst/terraform-provider-spotinst
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## 1.9.0 (Unreleased) ENHANCEMENTS: * resource/spotinst_elastigroup_azure: added `additional_ip_configs` to `network` * resource/spotinst_elastigroup_azure: added kubernetes and Multai to `integrations` * resource/spotinst_elastigroup_azure: added `scaling policies` BUG FIXES: * changed the order that credentials are set. See notes. * resource/spotinst_elastigroup_azure: `dimensions` changed to properly set `name` and `value` parameters
- Loading branch information
1 parent
66cd8b0
commit 2181165
Showing
46 changed files
with
2,039 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package elastigroup_azure_integrations | ||
|
||
import "github.com/terraform-providers/terraform-provider-spotinst/spotinst/commons" | ||
|
||
const ( | ||
// - KUBERNETES ---------------------- | ||
IntegrationKubernetes commons.FieldName = "integration_kubernetes" | ||
ClusterIdentifier commons.FieldName = "cluster_identifier" | ||
// ----------------------------------- | ||
|
||
// - MULTAI-RUNTIME ------------------ | ||
IntegrationMultaiRuntime commons.FieldName = "integration_multai_runtime" | ||
DeploymentId commons.FieldName = "deployment_id" | ||
// ----------------------------------- | ||
) |
11 changes: 11 additions & 0 deletions
11
spotinst/elastigroup_azure_integrations/fields_spotinst_elastigroup_azure_integrations.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package elastigroup_azure_integrations | ||
|
||
import "github.com/terraform-providers/terraform-provider-spotinst/spotinst/commons" | ||
|
||
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | ||
// Setup | ||
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | ||
func Setup(fieldsMap map[commons.FieldName]*commons.GenericField) { | ||
SetupKubernetes(fieldsMap) | ||
SetupMultaiRuntime(fieldsMap) | ||
} |
81 changes: 81 additions & 0 deletions
81
...astigroup_azure_integrations/fields_spotinst_elastigroup_azure_integrations_kubernetes.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package elastigroup_azure_integrations | ||
|
||
import ( | ||
"github.com/hashicorp/terraform/helper/schema" | ||
"github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/azure" | ||
"github.com/spotinst/spotinst-sdk-go/spotinst" | ||
"github.com/terraform-providers/terraform-provider-spotinst/spotinst/commons" | ||
) | ||
|
||
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | ||
// Setup | ||
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | ||
func SetupKubernetes(fieldsMap map[commons.FieldName]*commons.GenericField) { | ||
|
||
fieldsMap[IntegrationKubernetes] = commons.NewGenericField( | ||
commons.ElastigroupAzureIntegrations, | ||
IntegrationKubernetes, | ||
&schema.Schema{ | ||
Type: schema.TypeList, | ||
Optional: true, | ||
MaxItems: 1, | ||
Elem: &schema.Resource{ | ||
Schema: map[string]*schema.Schema{ | ||
|
||
string(ClusterIdentifier): { | ||
Type: schema.TypeString, | ||
Required: true, | ||
}, | ||
}, | ||
}, | ||
}, | ||
func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { | ||
return nil | ||
}, | ||
func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { | ||
egWrapper := resourceObject.(*commons.ElastigroupAzureWrapper) | ||
elastigroup := egWrapper.GetElastigroup() | ||
if v, ok := resourceData.GetOk(string(IntegrationKubernetes)); ok { | ||
if integration, err := expandAzureGroupKubernetesIntegration(v); err != nil { | ||
return err | ||
} else { | ||
elastigroup.Integration.SetKubernetes(integration) | ||
} | ||
} | ||
return nil | ||
}, | ||
func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { | ||
egWrapper := resourceObject.(*commons.ElastigroupAzureWrapper) | ||
elastigroup := egWrapper.GetElastigroup() | ||
var value *azure.KubernetesIntegration = nil | ||
if v, ok := resourceData.GetOk(string(IntegrationKubernetes)); ok { | ||
if integration, err := expandAzureGroupKubernetesIntegration(v); err != nil { | ||
return err | ||
} else { | ||
value = integration | ||
} | ||
} | ||
elastigroup.Integration.SetKubernetes(value) | ||
return nil | ||
}, | ||
nil, | ||
) | ||
} | ||
|
||
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | ||
// Utils | ||
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | ||
func expandAzureGroupKubernetesIntegration(data interface{}) (*azure.KubernetesIntegration, error) { | ||
integration := &azure.KubernetesIntegration{} | ||
list := data.([]interface{}) | ||
if list == nil || list[0] == nil { | ||
return integration, nil | ||
} | ||
m := list[0].(map[string]interface{}) | ||
|
||
if v, ok := m[string(ClusterIdentifier)].(string); ok && v != "" { | ||
integration.SetClusterIdentifier(spotinst.String(v)) | ||
} | ||
|
||
return integration, nil | ||
} |
100 changes: 100 additions & 0 deletions
100
...group_azure_integrations/fields_spotinst_elastigroup_azure_integrations_multai_runtime.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
package elastigroup_azure_integrations | ||
|
||
import ( | ||
"fmt" | ||
"github.com/hashicorp/terraform/helper/schema" | ||
"github.com/spotinst/spotinst-sdk-go/service/elastigroup/providers/azure" | ||
"github.com/spotinst/spotinst-sdk-go/spotinst" | ||
"github.com/terraform-providers/terraform-provider-spotinst/spotinst/commons" | ||
) | ||
|
||
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | ||
// Setup | ||
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | ||
func SetupMultaiRuntime(fieldsMap map[commons.FieldName]*commons.GenericField) { | ||
|
||
fieldsMap[IntegrationMultaiRuntime] = commons.NewGenericField( | ||
commons.ElastigroupAzureIntegrations, | ||
IntegrationMultaiRuntime, | ||
&schema.Schema{ | ||
Type: schema.TypeList, | ||
Optional: true, | ||
MaxItems: 1, | ||
Elem: &schema.Resource{ | ||
Schema: map[string]*schema.Schema{ | ||
string(DeploymentId): { | ||
Type: schema.TypeString, | ||
Required: true, | ||
}, | ||
}, | ||
}, | ||
}, | ||
func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { | ||
egWrapper := resourceObject.(*commons.ElastigroupAzureWrapper) | ||
elastigroup := egWrapper.GetElastigroup() | ||
var value []interface{} = nil | ||
if elastigroup.Integration != nil && elastigroup.Integration.Multai != nil { | ||
value = flattenAureGroupMultaiIntegration(elastigroup.Integration.Multai) | ||
} | ||
if value != nil { | ||
if err := resourceData.Set(string(IntegrationMultaiRuntime), value); err != nil { | ||
return fmt.Errorf(string(commons.FailureFieldReadPattern), string(IntegrationMultaiRuntime), err) | ||
} | ||
} else { | ||
if err := resourceData.Set(string(IntegrationMultaiRuntime), []*azure.MultaiIntegration{}); err != nil { | ||
return fmt.Errorf(string(commons.FailureFieldReadPattern), string(IntegrationMultaiRuntime), err) | ||
} | ||
} | ||
return nil | ||
}, | ||
func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { | ||
egWrapper := resourceObject.(*commons.ElastigroupAzureWrapper) | ||
elastigroup := egWrapper.GetElastigroup() | ||
if v, ok := resourceData.GetOk(string(IntegrationMultaiRuntime)); ok { | ||
if integration, err := expandAzureGroupMultaiIntegration(v); err != nil { | ||
return err | ||
} else { | ||
elastigroup.Integration.SetMultai(integration) | ||
} | ||
} | ||
return nil | ||
}, | ||
func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error { | ||
egWrapper := resourceObject.(*commons.ElastigroupAzureWrapper) | ||
elastigroup := egWrapper.GetElastigroup() | ||
var value *azure.MultaiIntegration = nil | ||
if v, ok := resourceData.GetOk(string(IntegrationMultaiRuntime)); ok { | ||
if integration, err := expandAzureGroupMultaiIntegration(v); err != nil { | ||
return err | ||
} else { | ||
value = integration | ||
} | ||
} | ||
elastigroup.Integration.SetMultai(value) | ||
return nil | ||
}, | ||
nil, | ||
) | ||
} | ||
|
||
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | ||
// Utils | ||
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | ||
func expandAzureGroupMultaiIntegration(data interface{}) (*azure.MultaiIntegration, error) { | ||
integration := &azure.MultaiIntegration{} | ||
list := data.([]interface{}) | ||
if list != nil && list[0] != nil { | ||
m := list[0].(map[string]interface{}) | ||
|
||
if v, ok := m[string(DeploymentId)].(string); ok && v != "" { | ||
integration.SetDeploymentId(spotinst.String(v)) | ||
} | ||
} | ||
return integration, nil | ||
} | ||
|
||
func flattenAureGroupMultaiIntegration(integration *azure.MultaiIntegration) []interface{} { | ||
result := make(map[string]interface{}) | ||
result[string(DeploymentId)] = spotinst.StringValue(integration.DeploymentID) | ||
return []interface{}{result} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.