Skip to content

Commit

Permalink
CDN: support for Standard_Microsoft / China CDN (#1465)
Browse files Browse the repository at this point in the history
* Updating to 2017-10-12 of the CDN API

* CDN: support for MS CDN / China CDN

Switching over to the new API Version
  • Loading branch information
tombuildsstuff authored Jul 2, 2018
1 parent 5bc3b84 commit 715d939
Show file tree
Hide file tree
Showing 16 changed files with 586 additions and 42 deletions.
2 changes: 1 addition & 1 deletion azurerm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

appinsights "github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2015-05-01/insights"
"github.com/Azure/azure-sdk-for-go/services/automation/mgmt/2015-10-31/automation"
"github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2017-04-02/cdn"
"github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2017-10-12/cdn"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2018-04-01/containerinstance"
"github.com/Azure/azure-sdk-for-go/services/containerregistry/mgmt/2017-10-01/containerregistry"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_cdn_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"log"

"github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2017-04-02/cdn"
"github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2017-10-12/cdn"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response"
Expand Down
5 changes: 4 additions & 1 deletion azurerm/resource_arm_cdn_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"log"

"github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2017-04-02/cdn"
"github.com/Azure/azure-sdk-for-go/services/cdn/mgmt/2017-10-12/cdn"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response"
Expand Down Expand Up @@ -38,7 +38,10 @@ func resourceArmCdnProfile() *schema.Resource {
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{
string(cdn.StandardAkamai),
string(cdn.StandardChinaCdn),
string(cdn.StandardVerizon),
// TODO: replace this with an SDK constant once available
"Standard_Microsoft",
string(cdn.PremiumVerizon),
}, true),
DiffSuppressFunc: ignoreCaseDiffSuppressFunc,
Expand Down
37 changes: 37 additions & 0 deletions azurerm/resource_arm_cdn_profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,27 @@ func TestAccAzureRMCdnProfile_standardAkamai(t *testing.T) {
})
}

func TestAccAzureRMCdnProfile_standardMicrosoft(t *testing.T) {
resourceName := "azurerm_cdn_profile.test"
ri := acctest.RandInt()
config := testAccAzureRMCdnProfile_standardMicrosoft(ri, testLocation())

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMCdnProfileDestroy,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMCdnProfileExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "sku", "Standard_Microsoft"),
),
},
},
})
}

func testCheckAzureRMCdnProfileExists(name string) resource.TestCheckFunc {
return func(s *terraform.State) error {
// Ensure we have enough information in state to look up in API
Expand Down Expand Up @@ -332,3 +353,19 @@ resource "azurerm_cdn_profile" "test" {
}
`, rInt, location, rInt)
}

func testAccAzureRMCdnProfile_standardMicrosoft(rInt int, location string) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
location = "%s"
}
resource "azurerm_cdn_profile" "test" {
name = "acctestcdnprof%d"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
sku = "Standard_Microsoft"
}
`, rInt, location, rInt)
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 715d939

Please sign in to comment.