Skip to content

Commit

Permalink
Merge pull request #3 from terraform-providers/master
Browse files Browse the repository at this point in the history
Merge from upstream
  • Loading branch information
Abhijeet Gaiha authored Sep 5, 2017
2 parents 927b5b9 + 211ccab commit b66ae9b
Show file tree
Hide file tree
Showing 181 changed files with 42,083 additions and 2,483 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dist: trusty
sudo: false
language: go
go:
- 1.8.1
- 1.9

install:
# This script is used by the Travis build to install a cookie for
Expand Down
41 changes: 32 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,43 @@
## 0.1.6 (Unreleased)
## 0.1.7 (Unreleased)

IMPROVEMENTS:

* `azurerm_cdn_endpoint` - defaulting the `http_port` and `https_port` [GH-301]
* `azurerm_cosmos_db_account`: allow setting the Kind to MongoDB/GlobalDocumentDB [GH-299]

## 0.1.6 (August 31, 2017)

FEATURES:

* **New Resource:** `azurerm_eventgrid_topic` [GH-260]
* **New Data Source**: `azurerm_subscription` ([#285](https://github.com/terraform-providers/terraform-provider-azurerm/issues/285))
* **New Resource:** `azurerm_app_service_plan` ([#1](https://github.com/terraform-providers/terraform-provider-azurerm/issues/1))
* **New Resource:** `azurerm_eventgrid_topic` ([#260](https://github.com/terraform-providers/terraform-provider-azurerm/issues/260))
* **New Resource:** `azurerm_key_vault_secret` ([#269](https://github.com/terraform-providers/terraform-provider-azurerm/issues/269))

IMPROVEMENTS:

* `azurerm_image` - added a default to the `caching` field [GH-259]
* `azurerm_network_interface` - support for multiple IP Configurations / setting the Primary IP Configuration [GH-245]
* `azurerm_sql_server` - added checks to handle `name` not being globally unique [GH-189]
* `azurerm_sql_server` - making `administrator_login` `ForceNew` [GH-189]
* `azurerm_sql_server` - migrate to using the azure-sdk-for-go [GH-189]
* `azurerm_virtual_machine` - Force recreation if storage_data_disk.creation_option changes [GH-240]
* `azurerm_image` - added a default to the `caching` field ([#259](https://github.com/terraform-providers/terraform-provider-azurerm/issues/259))
* `azurerm_key_vault` - validation for the `name` field ([#270](https://github.com/terraform-providers/terraform-provider-azurerm/issues/270))
* `azurerm_network_interface` - support for multiple IP Configurations / setting the Primary IP Configuration ([#245](https://github.com/terraform-providers/terraform-provider-azurerm/issues/245))
* `azurerm_resource_group` - poll until the resource group is created (by migrating to the Azure SDK for Go) ([#289](https://github.com/terraform-providers/terraform-provider-azurerm/issues/289))
* `azurerm_search_service` - migrating to use the Azure SDK for Go ([#283](https://github.com/terraform-providers/terraform-provider-azurerm/issues/283))
* `azurerm_sql_*` - ensuring deleted resources are detected ([#289](https://github.com/terraform-providers/terraform-provider-azurerm/issues/289)] / [[#255](https://github.com/terraform-providers/terraform-provider-azurerm/issues/255))
* `azurerm_sql_database` - Import Support ([#289](https://github.com/terraform-providers/terraform-provider-azurerm/issues/289))
* `azurerm_sql_database` - migrating to using the Azure SDK for Go ([#289](https://github.com/terraform-providers/terraform-provider-azurerm/issues/289))
* `azurerm_sql_firewall_rule` - migrating to using the Azure SDK for Go ([#289](https://github.com/terraform-providers/terraform-provider-azurerm/issues/289))
* `azurerm_sql_server` - added checks to handle `name` not being globally unique ([#189](https://github.com/terraform-providers/terraform-provider-azurerm/issues/189))
* `azurerm_sql_server` - making `administrator_login` `ForceNew` ([#189](https://github.com/terraform-providers/terraform-provider-azurerm/issues/189))
* `azurerm_sql_server` - migrate to using the azure-sdk-for-go ([#189](https://github.com/terraform-providers/terraform-provider-azurerm/issues/189))
* `azurerm_virtual_machine` - Force recreation if `storage_data_disk`.`create_option` changes ([#240](https://github.com/terraform-providers/terraform-provider-azurerm/issues/240))
* `azurerm_virtual_machine_scale_set` - Fix address issue when setting the `winrm` block ([#271](https://github.com/terraform-providers/terraform-provider-azurerm/issues/271))
* updating to `v10.3.0-beta` of the Azure SDK for Go ([#258](https://github.com/terraform-providers/terraform-provider-azurerm/issues/258))
* Removing the (now unused) Riviera SDK ([#289](https://github.com/terraform-providers/terraform-provider-azurerm/issues/289)] [[#291](https://github.com/terraform-providers/terraform-provider-azurerm/issues/291))

BUG FIXES:
* `azurerm_sql_server` - handle deleted servers correctly [GH-189]

* `azurerm_cosmosdb_account` - fixing the validation on the name field ([#263](https://github.com/terraform-providers/terraform-provider-azurerm/issues/263))
* `azurerm_sql_server` - handle deleted servers correctly ([#189](https://github.com/terraform-providers/terraform-provider-azurerm/issues/189))
* Fixing the `Microsoft.Insights` Resource Provider Registration ([#282](https://github.com/terraform-providers/terraform-provider-azurerm/issues/282))

## 0.1.5 (August 09, 2017)

Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
Terraform Provider
AzureRM Terraform Provider
==================

- Website: https://www.terraform.io
- [![Gitter chat](https://badges.gitter.im/hashicorp-terraform/Lobby.png)](https://gitter.im/hashicorp-terraform/Lobby)
- Mailing list: [Google Groups](http://groups.google.com/group/terraform-tool)

<img src="https://raw.githubusercontent.com/hashicorp/terraform-website/master/content/source/assets/images/logo-hashicorp.svg" width="600px">

Requirements
------------

- [Terraform](https://www.terraform.io/downloads.html) 0.10.x
- [Go](https://golang.org/doc/install) 1.8 (to build the provider plugin)
- [Go](https://golang.org/doc/install) 1.9 (to build the provider plugin)

Building The Provider
---------------------
Expand All @@ -20,7 +18,7 @@ Clone repository to: `$GOPATH/src/github.com/terraform-providers/terraform-provi

```sh
$ mkdir -p $GOPATH/src/github.com/terraform-providers; cd $GOPATH/src/github.com/terraform-providers
$ git clone git@github.com:hashicorp/terraform-provider-azurerm
$ git clone git@github.com:terraform-providers/terraform-provider-azurerm
```

Enter the provider directory and build the provider
Expand Down Expand Up @@ -77,7 +75,7 @@ Further [usage documentation is available on the Terraform website](https://www.
Developing the Provider
---------------------------

If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (version 1.8+ is *required*). You'll also need to correctly setup a [GOPATH](http://golang.org/doc/code.html#GOPATH), as well as adding `$GOPATH/bin` to your `$PATH`.
If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (version 1.9+ is *required*). You'll also need to correctly setup a [GOPATH](http://golang.org/doc/code.html#GOPATH), as well as adding `$GOPATH/bin` to your `$PATH`.

To compile the provider, run `make build`. This will build the provider and put the provider binary in the `$GOPATH/bin` directory.

Expand Down
114 changes: 83 additions & 31 deletions azurerm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,20 @@ import (
"github.com/Azure/azure-sdk-for-go/arm/network"
"github.com/Azure/azure-sdk-for-go/arm/redis"
"github.com/Azure/azure-sdk-for-go/arm/resources/resources"
"github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions"
"github.com/Azure/azure-sdk-for-go/arm/scheduler"
"github.com/Azure/azure-sdk-for-go/arm/search"
"github.com/Azure/azure-sdk-for-go/arm/servicebus"
"github.com/Azure/azure-sdk-for-go/arm/sql"
"github.com/Azure/azure-sdk-for-go/arm/storage"
"github.com/Azure/azure-sdk-for-go/arm/trafficmanager"
"github.com/Azure/azure-sdk-for-go/arm/web"
keyVault "github.com/Azure/azure-sdk-for-go/dataplane/keyvault"
mainStorage "github.com/Azure/azure-sdk-for-go/storage"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/adal"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/hashicorp/terraform/terraform"
riviera "github.com/jen20/riviera/azure"
)

// ArmClient contains the handles to all the specific Azure Resource Manager
Expand All @@ -45,8 +48,6 @@ type ArmClient struct {

StopContext context.Context

rivieraClient *riviera.Client

availSetClient compute.AvailabilitySetsClient
usageOpsClient compute.UsageClient
vmExtensionImageClient compute.VirtualMachineExtensionImagesClient
Expand Down Expand Up @@ -94,6 +95,8 @@ type ArmClient struct {
tagsClient resources.TagsClient
resourceFindClient resources.GroupClient

subscriptionsGroupClient subscriptions.GroupClient

jobsClient scheduler.JobsClient
jobsCollectionsClient scheduler.JobCollectionsClient

Expand All @@ -107,19 +110,27 @@ type ArmClient struct {
trafficManagerProfilesClient trafficmanager.ProfilesClient
trafficManagerEndpointsClient trafficmanager.EndpointsClient

searchServicesClient search.ServicesClient
serviceBusNamespacesClient servicebus.NamespacesClient
serviceBusQueuesClient servicebus.QueuesClient
serviceBusTopicsClient servicebus.TopicsClient
serviceBusSubscriptionsClient servicebus.SubscriptionsClient

keyVaultClient keyvault.VaultsClient
keyVaultClient keyvault.VaultsClient
keyVaultManagementClient keyVault.ManagementClient

sqlDatabasesClient sql.DatabasesClient
sqlElasticPoolsClient sql.ElasticPoolsClient
sqlFirewallRulesClient sql.FirewallRulesClient
sqlServersClient sql.ServersClient

sqlElasticPoolsClient sql.ElasticPoolsClient
sqlServersClient sql.ServersClient
appServicePlansClient web.AppServicePlansClient

appInsightsClient appinsights.ComponentsClient

servicePrincipalsClient graphrbac.ServicePrincipalsClient

appsClient web.AppsClient
}

func withRequestLogging() autorest.SendDecorator {
Expand Down Expand Up @@ -177,19 +188,6 @@ func (c *Config) getArmClient() (*ArmClient, error) {
environment: env,
}

rivieraClient, err := riviera.NewClient(&riviera.AzureResourceManagerCredentials{
ClientID: c.ClientID,
ClientSecret: c.ClientSecret,
TenantID: c.TenantID,
SubscriptionID: c.SubscriptionID,
ResourceManagerEndpoint: env.ResourceManagerEndpoint,
ActiveDirectoryEndpoint: env.ActiveDirectoryEndpoint,
})
if err != nil {
return nil, fmt.Errorf("Error creating Riviera client: %s", err)
}
client.rivieraClient = rivieraClient

oauthConfig, err := adal.NewOAuthConfig(env.ActiveDirectoryEndpoint, c.TenantID)
if err != nil {
return nil, err
Expand All @@ -200,23 +198,35 @@ func (c *Config) getArmClient() (*ArmClient, error) {
return nil, fmt.Errorf("Unable to configure OAuthConfig for tenant %s", c.TenantID)
}

spt, err := adal.NewServicePrincipalToken(*oauthConfig, c.ClientID, c.ClientSecret, env.ResourceManagerEndpoint)
// Resource Manager endpoints
endpoint := env.ResourceManagerEndpoint
spt, err := adal.NewServicePrincipalToken(*oauthConfig, c.ClientID, c.ClientSecret, endpoint)
if err != nil {
return nil, err
}
auth := autorest.NewBearerAuthorizer(spt)

graphSpt, err := adal.NewServicePrincipalToken(*oauthConfig, c.ClientID, c.ClientSecret, env.GraphEndpoint)
// Graph Endpoints
graphEndpoint := env.GraphEndpoint
graphSpt, err := adal.NewServicePrincipalToken(*oauthConfig, c.ClientID, c.ClientSecret, graphEndpoint)
if err != nil {
return nil, err
}

endpoint := env.ResourceManagerEndpoint
auth := autorest.NewBearerAuthorizer(spt)
graphEndpoint := env.GraphEndpoint
graphAuth := autorest.NewBearerAuthorizer(graphSpt)

// Key Vault Endpoints
sender := autorest.CreateSender(withRequestLogging())
keyVaultAuth := autorest.NewBearerAuthorizerCallback(sender, func(tenantID, resource string) (*autorest.BearerAuthorizer, error) {
keyVaultSpt, err := adal.NewServicePrincipalToken(*oauthConfig, c.ClientID, c.ClientSecret, resource)
if err != nil {
return nil, err
}

return autorest.NewBearerAuthorizer(keyVaultSpt), nil
})

// NOTE: these declarations should be left separate for clarity should the
// clients be wished to be configured with custom Responders/PollingModess etc...
// clients be wished to be configured with custom Responders/PollingModes etc...
asc := compute.NewAvailabilitySetsClientWithBaseURI(endpoint, c.SubscriptionID)
setUserAgent(&asc.Client)
asc.Authorizer = auth
Expand Down Expand Up @@ -439,6 +449,12 @@ func (c *Config) getArmClient() (*ArmClient, error) {
rf.Sender = autorest.CreateSender(withRequestLogging())
client.resourceFindClient = rf

subgc := subscriptions.NewGroupClientWithBaseURI(endpoint)
setUserAgent(&subgc.Client)
subgc.Authorizer = auth
subgc.Sender = autorest.CreateSender(withRequestLogging())
client.subscriptionsGroupClient = subgc

jc := scheduler.NewJobsClientWithBaseURI(endpoint, c.SubscriptionID)
setUserAgent(&jc.Client)
jc.Authorizer = auth
Expand Down Expand Up @@ -499,6 +515,12 @@ func (c *Config) getArmClient() (*ArmClient, error) {
rdc.Sender = autorest.CreateSender(withRequestLogging())
client.redisClient = rdc

sesc := search.NewServicesClientWithBaseURI(endpoint, c.SubscriptionID)
setUserAgent(&sesc.Client)
sesc.Authorizer = auth
sesc.Sender = autorest.CreateSender(withRequestLogging())
client.searchServicesClient = sesc

sbnc := servicebus.NewNamespacesClientWithBaseURI(endpoint, c.SubscriptionID)
setUserAgent(&sbnc.Client)
sbnc.Authorizer = auth
Expand All @@ -523,11 +545,17 @@ func (c *Config) getArmClient() (*ArmClient, error) {
sbsc.Sender = autorest.CreateSender(withRequestLogging())
client.serviceBusSubscriptionsClient = sbsc

kvc := keyvault.NewVaultsClientWithBaseURI(endpoint, c.SubscriptionID)
setUserAgent(&kvc.Client)
kvc.Authorizer = auth
kvc.Sender = autorest.CreateSender(withRequestLogging())
client.keyVaultClient = kvc
sqldc := sql.NewDatabasesClientWithBaseURI(endpoint, c.SubscriptionID)
setUserAgent(&sqldc.Client)
sqldc.Authorizer = auth
sqldc.Sender = autorest.CreateSender(withRequestLogging())
client.sqlDatabasesClient = sqldc

sqlfrc := sql.NewFirewallRulesClientWithBaseURI(endpoint, c.SubscriptionID)
setUserAgent(&sqlfrc.Client)
sqlfrc.Authorizer = auth
sqlfrc.Sender = autorest.CreateSender(withRequestLogging())
client.sqlFirewallRulesClient = sqlfrc

sqlepc := sql.NewElasticPoolsClientWithBaseURI(endpoint, c.SubscriptionID)
setUserAgent(&sqlepc.Client)
Expand All @@ -541,6 +569,12 @@ func (c *Config) getArmClient() (*ArmClient, error) {
sqlsrv.Sender = autorest.CreateSender(withRequestLogging())
client.sqlServersClient = sqlsrv

aspc := web.NewAppServicePlansClientWithBaseURI(endpoint, c.SubscriptionID)
setUserAgent(&aspc.Client)
aspc.Authorizer = auth
aspc.Sender = autorest.CreateSender(withRequestLogging())
client.appServicePlansClient = aspc

ai := appinsights.NewComponentsClientWithBaseURI(endpoint, c.SubscriptionID)
setUserAgent(&ai.Client)
ai.Authorizer = auth
Expand All @@ -553,6 +587,24 @@ func (c *Config) getArmClient() (*ArmClient, error) {
spc.Sender = autorest.CreateSender(withRequestLogging())
client.servicePrincipalsClient = spc

ac := web.NewAppsClientWithBaseURI(endpoint, c.SubscriptionID)
setUserAgent(&ac.Client)
ac.Authorizer = auth
ac.Sender = autorest.CreateSender(withRequestLogging())
client.appsClient = ac

kvc := keyvault.NewVaultsClientWithBaseURI(endpoint, c.SubscriptionID)
setUserAgent(&kvc.Client)
kvc.Authorizer = auth
kvc.Sender = autorest.CreateSender(withRequestLogging())
client.keyVaultClient = kvc

kvmc := keyVault.New()
setUserAgent(&kvmc.Client)
kvmc.Authorizer = keyVaultAuth
kvmc.Sender = sender
client.keyVaultManagementClient = kvmc

return &client, nil
}

Expand Down
3 changes: 1 addition & 2 deletions azurerm/data_source_arm_client_config.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package azurerm

import (
"time"

"fmt"
"time"

"github.com/hashicorp/terraform/helper/schema"
)
Expand Down
2 changes: 1 addition & 1 deletion azurerm/data_source_arm_resource_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ func dataSourceArmResourceGroup() *schema.Resource {
Read: dataSourceArmResourceGroupRead,

Schema: map[string]*schema.Schema{
"name": &schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
},
Expand Down
Loading

0 comments on commit b66ae9b

Please sign in to comment.