Skip to content

Commit

Permalink
Merge pull request #291 from terraform-providers/riviera-part-ii
Browse files Browse the repository at this point in the history
Removing the dependency on github.com/jen20/riviera
  • Loading branch information
tombuildsstuff authored Aug 31, 2017
2 parents 61b2fae + cd9fdfb commit 028676c
Show file tree
Hide file tree
Showing 94 changed files with 267 additions and 1,140 deletions.
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
3 changes: 2 additions & 1 deletion azurerm/express_route_circuit.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/Azure/azure-sdk-for-go/arm/network"
"github.com/hashicorp/errwrap"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func extractResourceGroupAndErcName(resourceId string) (resourceGroup string, name string, err error) {
Expand All @@ -29,7 +30,7 @@ func retrieveErcByResourceId(resourceId string, meta interface{}) (erc *network.

resp, err := ercClient.Get(resGroup, name)
if err != nil {
if responseWasNotFound(resp.Response) {
if utils.ResponseWasNotFound(resp.Response) {
return nil, "", nil
}
return nil, "", errwrap.Wrapf(fmt.Sprintf("Error making Read request on Express Route Circuit %s: {{err}}", name), err)
Expand Down
10 changes: 5 additions & 5 deletions azurerm/resource_arm_app_service_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/Azure/azure-sdk-for-go/arm/web"
"github.com/hashicorp/terraform/helper/schema"
"github.com/jen20/riviera/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func resourceArmAppServicePlan() *schema.Resource {
Expand Down Expand Up @@ -142,7 +142,7 @@ func resourceArmAppServicePlanRead(d *schema.ResourceData, meta interface{}) err

resp, err := client.Get(resGroup, name)
if err != nil {
if responseWasNotFound(resp.Response) {
if utils.ResponseWasNotFound(resp.Response) {
d.SetId("")
return nil
}
Expand Down Expand Up @@ -203,7 +203,7 @@ func expandAzureRmAppServicePlanSku(d *schema.ResourceData) web.SkuDescription {

if v, ok := config["capacity"]; ok {
capacity := v.(int)
sku.Capacity = azure.Int32(int32(capacity))
sku.Capacity = utils.Int32(int32(capacity))
}

return sku
Expand Down Expand Up @@ -234,10 +234,10 @@ func expandAppServicePlanProperties(d *schema.ResourceData) *web.AppServicePlanP
config := configs[0].(map[string]interface{})

perSiteScaling := config["per_site_scaling"].(bool)
properties.PerSiteScaling = azure.Bool(perSiteScaling)
properties.PerSiteScaling = utils.Bool(perSiteScaling)

reserved := config["reserved"].(bool)
properties.Reserved = azure.Bool(reserved)
properties.Reserved = utils.Bool(reserved)

return &properties
}
Expand Down
13 changes: 6 additions & 7 deletions azurerm/resource_arm_app_service_plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package azurerm

import (
"fmt"
"net/http"
"testing"

"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func TestAccAzureRMAppServicePlan_basic(t *testing.T) {
Expand Down Expand Up @@ -133,8 +133,7 @@ func testCheckAzureRMAppServicePlanDestroy(s *terraform.State) error {
resp, err := conn.Get(resourceGroup, name)

if err != nil {

if responseWasNotFound(resp.Response) {
if utils.ResponseWasNotFound(resp.Response) {
return nil
}

Expand Down Expand Up @@ -165,11 +164,11 @@ func testCheckAzureRMAppServicePlanExists(name string) resource.TestCheckFunc {

resp, err := conn.Get(resourceGroup, appServicePlanName)
if err != nil {
return fmt.Errorf("Bad: Get on appServicePlansClient: %s", err)
}
if utils.ResponseWasNotFound(resp.Response) {
return fmt.Errorf("Bad: App Service Plan %q (resource group: %q) does not exist", appServicePlanName, resourceGroup)
}

if resp.StatusCode == http.StatusNotFound {
return fmt.Errorf("Bad: App Service Plan %q (resource group: %q) does not exist", appServicePlanName, resourceGroup)
return fmt.Errorf("Bad: Get on appServicePlansClient: %+v", err)
}

return nil
Expand Down
3 changes: 2 additions & 1 deletion azurerm/resource_arm_application_insights.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/Azure/azure-sdk-for-go/arm/appinsights"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func resourceArmApplicationInsights() *schema.Resource {
Expand Down Expand Up @@ -118,7 +119,7 @@ func resourceArmApplicationInsightsRead(d *schema.ResourceData, meta interface{}

resp, err := client.Get(resGroup, name)
if err != nil {
if responseWasNotFound(resp.Response) {
if utils.ResponseWasNotFound(resp.Response) {
d.SetId("")
return nil
}
Expand Down
8 changes: 4 additions & 4 deletions azurerm/resource_arm_availability_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/Azure/azure-sdk-for-go/arm/compute"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
"github.com/jen20/riviera/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func resourceArmAvailabilitySet() *schema.Resource {
Expand Down Expand Up @@ -81,8 +81,8 @@ func resourceArmAvailabilitySetCreate(d *schema.ResourceData, meta interface{})
Name: &name,
Location: &location,
AvailabilitySetProperties: &compute.AvailabilitySetProperties{
PlatformFaultDomainCount: azure.Int32(int32(faultDomainCount)),
PlatformUpdateDomainCount: azure.Int32(int32(updateDomainCount)),
PlatformFaultDomainCount: utils.Int32(int32(faultDomainCount)),
PlatformUpdateDomainCount: utils.Int32(int32(updateDomainCount)),
},
Tags: expandTags(tags),
}
Expand Down Expand Up @@ -116,7 +116,7 @@ func resourceArmAvailabilitySetRead(d *schema.ResourceData, meta interface{}) er

resp, err := client.Get(resGroup, name)
if err != nil {
if responseWasNotFound(resp.Response) {
if utils.ResponseWasNotFound(resp.Response) {
d.SetId("")
return nil
}
Expand Down
3 changes: 2 additions & 1 deletion azurerm/resource_arm_cdn_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/Azure/azure-sdk-for-go/arm/cdn"
"github.com/hashicorp/terraform/helper/hashcode"
"github.com/hashicorp/terraform/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func resourceArmCdnEndpoint() *schema.Resource {
Expand Down Expand Up @@ -225,7 +226,7 @@ func resourceArmCdnEndpointRead(d *schema.ResourceData, meta interface{}) error
log.Printf("[INFO] Trying to find the AzureRM CDN Endpoint %s (Profile: %s, RG: %s)", name, profileName, resGroup)
resp, err := cdnEndpointsClient.Get(resGroup, profileName, name)
if err != nil {
if responseWasNotFound(resp.Response) {
if utils.ResponseWasNotFound(resp.Response) {
d.SetId("")
return nil
}
Expand Down
3 changes: 2 additions & 1 deletion azurerm/resource_arm_cdn_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/Azure/azure-sdk-for-go/arm/cdn"
"github.com/hashicorp/terraform/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func resourceArmCdnProfile() *schema.Resource {
Expand Down Expand Up @@ -98,7 +99,7 @@ func resourceArmCdnProfileRead(d *schema.ResourceData, meta interface{}) error {

resp, err := cdnProfilesClient.Get(resGroup, name)
if err != nil {
if responseWasNotFound(resp.Response) {
if utils.ResponseWasNotFound(resp.Response) {
d.SetId("")
return nil
}
Expand Down
14 changes: 6 additions & 8 deletions azurerm/resource_arm_container_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ package azurerm
import (
"fmt"
"log"

"net/http"

"regexp"

"github.com/Azure/azure-sdk-for-go/arm/containerregistry"
"github.com/hashicorp/terraform/helper/hashcode"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
"github.com/jen20/riviera/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func resourceArmContainerRegistry() *schema.Resource {
Expand Down Expand Up @@ -129,8 +127,8 @@ func resourceArmContainerRegistryCreate(d *schema.ResourceData, meta interface{}
storageAccountName := account["name"].(string)
storageAccountAccessKey := account["access_key"].(string)
parameters.RegistryPropertiesCreateParameters.StorageAccount = &containerregistry.StorageAccountParameters{
Name: azure.String(storageAccountName),
AccessKey: azure.String(storageAccountAccessKey),
Name: utils.String(storageAccountName),
AccessKey: utils.String(storageAccountAccessKey),
}

_, error := client.Create(resourceGroup, name, parameters, make(<-chan struct{}))
Expand Down Expand Up @@ -172,8 +170,8 @@ func resourceArmContainerRegistryUpdate(d *schema.ResourceData, meta interface{}
RegistryPropertiesUpdateParameters: &containerregistry.RegistryPropertiesUpdateParameters{
AdminUserEnabled: &adminUserEnabled,
StorageAccount: &containerregistry.StorageAccountParameters{
Name: azure.String(storageAccountName),
AccessKey: azure.String(storageAccountAccessKey),
Name: utils.String(storageAccountName),
AccessKey: utils.String(storageAccountAccessKey),
},
},
Tags: expandTags(tags),
Expand Down Expand Up @@ -210,7 +208,7 @@ func resourceArmContainerRegistryRead(d *schema.ResourceData, meta interface{})

resp, err := client.Get(resourceGroup, name)
if err != nil {
if responseWasNotFound(resp.Response) {
if utils.ResponseWasNotFound(resp.Response) {
d.SetId("")
return nil
}
Expand Down
3 changes: 2 additions & 1 deletion azurerm/resource_arm_container_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/hashicorp/terraform/helper/hashcode"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func resourceArmContainerService() *schema.Resource {
Expand Down Expand Up @@ -268,7 +269,7 @@ func resourceArmContainerServiceRead(d *schema.ResourceData, meta interface{}) e

resp, err := containerServiceClient.Get(resGroup, name)
if err != nil {
if responseWasNotFound(resp.Response) {
if utils.ResponseWasNotFound(resp.Response) {
d.SetId("")
return nil
}
Expand Down
3 changes: 2 additions & 1 deletion azurerm/resource_arm_cosmos_db_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/hashicorp/terraform/helper/hashcode"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func resourceArmCosmosDBAccount() *schema.Resource {
Expand Down Expand Up @@ -203,7 +204,7 @@ func resourceArmCosmosDBAccountRead(d *schema.ResourceData, meta interface{}) er

resp, err := client.Get(resGroup, name)
if err != nil {
if responseWasNotFound(resp.Response) {
if utils.ResponseWasNotFound(resp.Response) {
d.SetId("")
return nil
}
Expand Down
3 changes: 2 additions & 1 deletion azurerm/resource_arm_dns_a_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/Azure/azure-sdk-for-go/arm/dns"
"github.com/hashicorp/terraform/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func resourceArmDnsARecord() *schema.Resource {
Expand Down Expand Up @@ -106,7 +107,7 @@ func resourceArmDnsARecordRead(d *schema.ResourceData, meta interface{}) error {

resp, err := dnsClient.Get(resGroup, zoneName, name, dns.A)
if err != nil {
if responseWasNotFound(resp.Response) {
if utils.ResponseWasNotFound(resp.Response) {
d.SetId("")
return nil
}
Expand Down
3 changes: 2 additions & 1 deletion azurerm/resource_arm_dns_aaaa_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/Azure/azure-sdk-for-go/arm/dns"
"github.com/hashicorp/terraform/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func resourceArmDnsAAAARecord() *schema.Resource {
Expand Down Expand Up @@ -106,7 +107,7 @@ func resourceArmDnsAaaaRecordRead(d *schema.ResourceData, meta interface{}) erro

resp, err := dnsClient.Get(resGroup, zoneName, name, dns.AAAA)
if err != nil {
if responseWasNotFound(resp.Response) {
if utils.ResponseWasNotFound(resp.Response) {
d.SetId("")
return nil
}
Expand Down
3 changes: 2 additions & 1 deletion azurerm/resource_arm_dns_cname_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/Azure/azure-sdk-for-go/arm/dns"
"github.com/hashicorp/terraform/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func resourceArmDnsCNameRecord() *schema.Resource {
Expand Down Expand Up @@ -110,7 +111,7 @@ func resourceArmDnsCNameRecordRead(d *schema.ResourceData, meta interface{}) err

resp, err := dnsClient.Get(resGroup, zoneName, name, dns.CNAME)
if err != nil {
if responseWasNotFound(resp.Response) {
if utils.ResponseWasNotFound(resp.Response) {
d.SetId("")
return nil
}
Expand Down
3 changes: 2 additions & 1 deletion azurerm/resource_arm_dns_mx_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/Azure/azure-sdk-for-go/arm/dns"
"github.com/hashicorp/terraform/helper/hashcode"
"github.com/hashicorp/terraform/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func resourceArmDnsMxRecord() *schema.Resource {
Expand Down Expand Up @@ -121,7 +122,7 @@ func resourceArmDnsMxRecordRead(d *schema.ResourceData, meta interface{}) error

resp, err := client.Get(resGroup, zoneName, name, dns.MX)
if err != nil {
if responseWasNotFound(resp.Response) {
if utils.ResponseWasNotFound(resp.Response) {
d.SetId("")
return nil
}
Expand Down
3 changes: 2 additions & 1 deletion azurerm/resource_arm_dns_ns_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/Azure/azure-sdk-for-go/arm/dns"
"github.com/hashicorp/terraform/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func resourceArmDnsNsRecord() *schema.Resource {
Expand Down Expand Up @@ -111,7 +112,7 @@ func resourceArmDnsNsRecordRead(d *schema.ResourceData, meta interface{}) error

resp, err := dnsClient.Get(resGroup, zoneName, name, dns.NS)
if err != nil {
if responseWasNotFound(resp.Response) {
if utils.ResponseWasNotFound(resp.Response) {
d.SetId("")
return nil
}
Expand Down
3 changes: 2 additions & 1 deletion azurerm/resource_arm_dns_ptr_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/Azure/azure-sdk-for-go/arm/dns"
"github.com/hashicorp/terraform/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func resourceArmDnsPtrRecord() *schema.Resource {
Expand Down Expand Up @@ -106,7 +107,7 @@ func resourceArmDnsPtrRecordRead(d *schema.ResourceData, meta interface{}) error

resp, err := dnsClient.Get(resGroup, zoneName, name, dns.PTR)
if err != nil {
if responseWasNotFound(resp.Response) {
if utils.ResponseWasNotFound(resp.Response) {
d.SetId("")
return nil
}
Expand Down
3 changes: 2 additions & 1 deletion azurerm/resource_arm_dns_srv_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/Azure/azure-sdk-for-go/arm/dns"
"github.com/hashicorp/terraform/helper/hashcode"
"github.com/hashicorp/terraform/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func resourceArmDnsSrvRecord() *schema.Resource {
Expand Down Expand Up @@ -130,7 +131,7 @@ func resourceArmDnsSrvRecordRead(d *schema.ResourceData, meta interface{}) error

resp, err := client.Get(resGroup, zoneName, name, dns.SRV)
if err != nil {
if responseWasNotFound(resp.Response) {
if utils.ResponseWasNotFound(resp.Response) {
d.SetId("")
return nil
}
Expand Down
Loading

0 comments on commit 028676c

Please sign in to comment.