Skip to content

Commit

Permalink
New Resource: azurerm_service_fabric_cluster (#4)
Browse files Browse the repository at this point in the history
* Adding azure service fabric resource

* Vendoring `2018-02-01` of the ServiceFabric SDK

* Adding back in the client definition / changes needed to get it to compile

* Renaming to Service Fabric Cluster

* Registering the Microsoft.ServiceFabric client

* Refactoring Service Fabric Clusters to use nested objects

* Service Fabric Cluster; fixes, import support and acceptance tests

Tests pass:

```
$ acctests azurerm TestAccAzureRMServiceFabricCluster_
=== RUN   TestAccAzureRMServiceFabricCluster_basic
--- PASS: TestAccAzureRMServiceFabricCluster_basic (65.66s)
=== RUN   TestAccAzureRMServiceFabricCluster_addOnFeatures
--- PASS: TestAccAzureRMServiceFabricCluster_addOnFeatures (54.47s)
=== RUN   TestAccAzureRMServiceFabricCluster_certificate
--- PASS: TestAccAzureRMServiceFabricCluster_certificate (68.11s)
=== RUN   TestAccAzureRMServiceFabricCluster_clientCertificateThumbprint
--- PASS: TestAccAzureRMServiceFabricCluster_clientCertificateThumbprint (59.19s)
=== RUN   TestAccAzureRMServiceFabricCluster_diagnosticsConfig
--- PASS: TestAccAzureRMServiceFabricCluster_diagnosticsConfig (82.73s)
=== RUN   TestAccAzureRMServiceFabricCluster_fabricSettings
--- PASS: TestAccAzureRMServiceFabricCluster_fabricSettings (61.09s)
=== RUN   TestAccAzureRMServiceFabricCluster_fabricSettingsRemove
--- PASS: TestAccAzureRMServiceFabricCluster_fabricSettingsRemove (76.76s)
=== RUN   TestAccAzureRMServiceFabricCluster_nodeTypeCustomPorts
--- PASS: TestAccAzureRMServiceFabricCluster_nodeTypeCustomPorts (67.23s)
=== RUN   TestAccAzureRMServiceFabricCluster_nodeTypesMultiple
--- PASS: TestAccAzureRMServiceFabricCluster_nodeTypesMultiple (65.39s)
=== RUN   TestAccAzureRMServiceFabricCluster_nodeTypesUpdate
--- PASS: TestAccAzureRMServiceFabricCluster_nodeTypesUpdate (65.42s)
=== RUN   TestAccAzureRMServiceFabricCluster_tags
--- PASS: TestAccAzureRMServiceFabricCluster_tags (62.97s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	729.355s
```

* Documenting the Service Fabric Cluster resource

* Documenting the `cluster_endpoint` field
  • Loading branch information
lstolyarov authored and tombuildsstuff committed Jul 30, 2018
1 parent d88d774 commit c4a37df
Show file tree
Hide file tree
Showing 17 changed files with 8,237 additions and 9 deletions.
13 changes: 12 additions & 1 deletion azurerm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import (
"github.com/Azure/azure-sdk-for-go/services/scheduler/mgmt/2016-03-01/scheduler"
"github.com/Azure/azure-sdk-for-go/services/search/mgmt/2015-08-19/search"
"github.com/Azure/azure-sdk-for-go/services/servicebus/mgmt/2017-04-01/servicebus"
"github.com/Azure/azure-sdk-for-go/services/servicefabric/mgmt/2018-02-01/servicefabric"
"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2017-10-01/storage"
"github.com/Azure/azure-sdk-for-go/services/trafficmanager/mgmt/2017-05-01/trafficmanager"
"github.com/Azure/azure-sdk-for-go/services/web/mgmt/2018-02-01/web"
Expand Down Expand Up @@ -211,7 +212,7 @@ type ArmClient struct {
resourceGroupsClient resources.GroupsClient
subscriptionsClient subscriptions.Client

//Scheduler
// Scheduler
schedulerJobCollectionsClient scheduler.JobCollectionsClient
schedulerJobsClient scheduler.JobsClient

Expand All @@ -225,6 +226,9 @@ type ArmClient struct {
serviceBusSubscriptionsClient servicebus.SubscriptionsClient
serviceBusSubscriptionRulesClient servicebus.RulesClient

// Service Fabric
serviceFabricClustersClient servicefabric.ClustersClient

// Storage
storageServiceClient storage.AccountsClient
storageUsageClient storage.UsageClient
Expand Down Expand Up @@ -428,6 +432,7 @@ func getArmClient(c *authentication.Config) (*ArmClient, error) {
client.registerResourcesClients(endpoint, c.SubscriptionID, auth)
client.registerSearchClients(endpoint, c.SubscriptionID, auth)
client.registerServiceBusClients(endpoint, c.SubscriptionID, auth)
client.registerServiceFabricClients(endpoint, c.SubscriptionID, auth)
client.registerSchedulerClients(endpoint, c.SubscriptionID, auth)
client.registerStorageClients(endpoint, c.SubscriptionID, auth)
client.registerTrafficManagerClients(endpoint, c.SubscriptionID, auth)
Expand Down Expand Up @@ -979,6 +984,12 @@ func (c *ArmClient) registerServiceBusClients(endpoint, subscriptionId string, a
c.serviceBusSubscriptionRulesClient = subscriptionRulesClient
}

func (c *ArmClient) registerServiceFabricClients(endpoint, subscriptionId string, auth autorest.Authorizer) {
clustersClient := servicefabric.NewClustersClientWithBaseURI(endpoint, subscriptionId)
c.configureClient(&clustersClient.Client, auth)
c.serviceFabricClustersClient = clustersClient
}

func (c *ArmClient) registerStorageClients(endpoint, subscriptionId string, auth autorest.Authorizer) {
accountsClient := storage.NewAccountsClientWithBaseURI(endpoint, subscriptionId)
c.configureClient(&accountsClient.Client, auth)
Expand Down
2 changes: 2 additions & 0 deletions azurerm/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ func Provider() terraform.ResourceProvider {
"azurerm_servicebus_subscription_rule": resourceArmServiceBusSubscriptionRule(),
"azurerm_servicebus_topic": resourceArmServiceBusTopic(),
"azurerm_servicebus_topic_authorization_rule": resourceArmServiceBusTopicAuthorizationRule(),
"azurerm_service_fabric_cluster": resourceArmServiceFabricCluster(),
"azurerm_snapshot": resourceArmSnapshot(),
"azurerm_scheduler_job": resourceArmSchedulerJob(),
"azurerm_scheduler_job_collection": resourceArmSchedulerJobCollection(),
Expand Down Expand Up @@ -386,6 +387,7 @@ func determineAzureResourceProvidersToRegister(providerList []resources.Provider
"Microsoft.Resources": {},
"Microsoft.Search": {},
"Microsoft.ServiceBus": {},
"Microsoft.ServiceFabric": {},
"Microsoft.Sql": {},
"Microsoft.Storage": {},
}
Expand Down
Loading

0 comments on commit c4a37df

Please sign in to comment.