Skip to content

Commit

Permalink
Merge pull request #167 from NetApp/integration/main
Browse files Browse the repository at this point in the history
Sync bitbucket and GitHub
  • Loading branch information
wenjun666 authored May 19, 2023
2 parents 8f5fee5 + 677a49b commit ccc412d
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 23.5.2
NEW ENHANCEMENTS:
* resource/cvo_azure: add `saas_subscription_id`.
* provider: add `connector_host` for restricted mode.


## 23.5.1
NEW ENHANCEMENTS:
* resoruce/cvo_aws: add `assume_role_arn` for AWS CVO HA.
Expand Down
12 changes: 12 additions & 0 deletions cloudmanager/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cloudmanager
import (
"fmt"
"log"
"strings"
)

// Config is a struct for user input
Expand All @@ -16,6 +17,7 @@ type configStruct struct {
AWSProfile string
AWSProfileFilePath string
AzureAuthMethods []string
ConnectorHost string
}

// Client is the main function to connect to the APi
Expand Down Expand Up @@ -66,6 +68,16 @@ func (c *configStruct) clientFun() (*Client, error) {
return &Client{}, fmt.Errorf("expected refresh_token or sa_secret_key and sa_client_id")
}

if c.ConnectorHost != "" {
if strings.HasPrefix(c.ConnectorHost, "https://") {
client.CloudManagerHost = c.ConnectorHost
} else if strings.HasPrefix(c.ConnectorHost, "http://") {
client.CloudManagerHost = c.ConnectorHost
} else {
client.CloudManagerHost = fmt.Sprintf("https://%s", c.ConnectorHost)
}
}

if c.Simulator {
client.SetSimulator(c.Simulator)
}
Expand Down
1 change: 1 addition & 0 deletions cloudmanager/cvo_azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type createCVOAzureDetails struct {
WorkspaceID string `structs:"tenantId,omitempty"`
Region string `structs:"region"`
SubscriptionID string `structs:"subscriptionId"`
SaasSubscriptionID string `structs:"saasSubscriptionId,omitempty"`
VnetID string `structs:"vnetId,omitempty"`
SvmPassword string `structs:"svmPassword"`
SvmName string `structs:"svmName,omitempty"`
Expand Down
9 changes: 9 additions & 0 deletions cloudmanager/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ func Provider() terraform.ResourceProvider {
DefaultFunc: schema.EnvDefaultFunc("CLOUDMANAGER_REFRESH_TOKEN", nil),
Description: "The refresh_token for OCCM operations.",
},
"connector_host": {
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("CONNECTOR_HOST", nil),
Description: "Connector Host when not using BlueXP.",
},
"environment": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -109,6 +115,9 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
if v, ok := d.GetOk("aws_profile_file_path"); ok {
config.AWSProfileFilePath = v.(string)
}
if v, ok := d.GetOk("connector_host"); ok {
config.ConnectorHost = v.(string)
}
if v, ok := d.GetOk("azure_auth_methods"); ok {
// a bit complicated, as the type is only known at runtime
intMethods := v.([]interface{})
Expand Down
9 changes: 9 additions & 0 deletions cloudmanager/resource_netapp_cloudmanager_cvo_azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ func resourceCVOAzure() *schema.Resource {
Required: true,
ForceNew: true,
},
"saas_subscription_id": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"workspace_id": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -322,6 +327,10 @@ func resourceCVOAzureCreate(d *schema.ResourceData, meta interface{}) error {
cvoDetails.WorkspaceID = d.Get("workspace_id").(string)
cvoDetails.StorageType = d.Get("storage_type").(string)
cvoDetails.SvmPassword = d.Get("svm_password").(string)

if c, ok := d.GetOk("saas_subscription_id"); ok {
cvoDetails.SaasSubscriptionID = c.(string)
}
if c, ok := d.GetOk("svm_name"); ok {
cvoDetails.SvmName = c.(string)
}
Expand Down

0 comments on commit ccc412d

Please sign in to comment.