diff --git a/azurerm/data_source_api_management.go b/azurerm/data_source_api_management.go index cdd88df1e527..bfdf152af347 100644 --- a/azurerm/data_source_api_management.go +++ b/azurerm/data_source_api_management.go @@ -40,6 +40,7 @@ func dataSourceApiManagementService() *schema.Resource { Computed: true, }, + // TODO: Remove in 2.0 "sku": { Type: schema.TypeList, Computed: true, @@ -57,6 +58,11 @@ func dataSourceApiManagementService() *schema.Resource { }, }, + "sku_name": { + Type: schema.TypeString, + Computed: true, + }, + "notification_sender_email": { Type: schema.TypeString, Computed: true, @@ -181,7 +187,6 @@ func dataSourceApiManagementRead(d *schema.ResourceData, meta interface{}) error if props := resp.ServiceProperties; props != nil { d.Set("publisher_email", props.PublisherEmail) d.Set("publisher_name", props.PublisherName) - d.Set("notification_sender_email", props.NotificationSenderEmail) d.Set("gateway_url", props.GatewayURL) d.Set("gateway_regional_url", props.GatewayRegionalURL) @@ -199,8 +204,14 @@ func dataSourceApiManagementRead(d *schema.ResourceData, meta interface{}) error } } - if err := d.Set("sku", flattenDataSourceApiManagementServiceSku(resp.Sku)); err != nil { - return fmt.Errorf("Error setting `sku`: %+v", err) + if sku := resp.Sku; sku != nil { + // TODO: Remove in 2.0 + if err := d.Set("sku", flattenApiManagementServiceSku(resp.Sku)); err != nil { + return fmt.Errorf("Error setting `sku`: %+v", err) + } + if err := d.Set("sku_name", flattenApiManagementServiceSkuName(resp.Sku)); err != nil { + return fmt.Errorf("Error setting `sku_name`: %+v", err) + } } return tags.FlattenAndSet(d, resp.Tags) @@ -288,22 +299,6 @@ func flattenDataSourceApiManagementAdditionalLocations(input *[]apimanagement.Ad return results } -func flattenDataSourceApiManagementServiceSku(profile *apimanagement.ServiceSkuProperties) []interface{} { - if profile == nil { - return []interface{}{} - } - - sku := make(map[string]interface{}) - - sku["name"] = string(profile.Name) - - if profile.Capacity != nil { - sku["capacity"] = *profile.Capacity - } - - return []interface{}{sku} -} - func apiManagementDataSourceHostnameSchema() map[string]*schema.Schema { return map[string]*schema.Schema{ "host_name": { diff --git a/azurerm/helpers/azure/sku.go b/azurerm/helpers/azure/sku.go new file mode 100644 index 000000000000..c061ceabc4ea --- /dev/null +++ b/azurerm/helpers/azure/sku.go @@ -0,0 +1,58 @@ +package azure + +import ( + "fmt" + "strconv" + "strings" + + "github.com/hashicorp/terraform/helper/schema" +) + +func SplitSku(sku string) (string, int32, error) { + skuParts := strings.Split(sku, "_") + + if len(skuParts) != 2 { + return "", -1, fmt.Errorf("sku_name(%s) is not formatted properly.", sku) + } + + capacity, err := strconv.Atoi(skuParts[1]) + + if err != nil { + return "", -1, fmt.Errorf("%s in sku_name is not a valid value.", skuParts[1]) + } + + return skuParts[0], int32(capacity), nil +} + +// MinCapacitySkuNameInSlice returns a SchemaValidateFunc which tests if the provided value +// is of type string and matches the value of an element in the valid slice +// will test with in lower case if ignoreCase is true will also validate if the +// capacity if above passed minCapacity value +func MinCapacitySkuNameInSlice(valid []string, minCapacity int32, ignoreCase bool) schema.SchemaValidateFunc { + return func(i interface{}, k string) (s []string, es []error) { + v, ok := i.(string) + if !ok { + es = append(es, fmt.Errorf("expected type of %s to be string", k)) + return + } + + name, capacity, err := SplitSku(v) + + if err != nil { + es = append(es, err) + return + } + + for _, str := range valid { + if name == str || (ignoreCase && strings.ToLower(name) == strings.ToLower(str)) { + if capacity < minCapacity { + es = append(es, fmt.Errorf("expected %s capacity value to be greater that %d, got %d", k, minCapacity, capacity)) + } + return + } + } + + es = append(es, fmt.Errorf("expected %s to be one of %v, got %s", k, valid, name)) + return + } +} diff --git a/azurerm/resource_arm_api_management.go b/azurerm/resource_arm_api_management.go index f655b20d5eb5..fc8c9f9c2675 100644 --- a/azurerm/resource_arm_api_management.go +++ b/azurerm/resource_arm_api_management.go @@ -64,10 +64,14 @@ func resourceArmApiManagementService() *schema.Resource { ValidateFunc: validate.ApiManagementServicePublisherEmail, }, + // TODO: Remove in 2.0 "sku": { - Type: schema.TypeList, - Required: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + Computed: true, + Deprecated: "This property has been deprecated in favour of the 'sku_name' property and will be removed in version 2.0 of the provider", + ConflictsWith: []string{"sku_name"}, + MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { @@ -80,15 +84,29 @@ func resourceArmApiManagementService() *schema.Resource { string(apimanagement.SkuTypePremium), }, false), }, + "capacity": { Type: schema.TypeInt, - Required: true, + Optional: true, ValidateFunc: validation.IntAtLeast(0), }, }, }, }, + "sku_name": { + Type: schema.TypeString, + Optional: true, + Computed: true, // TODO: Remove computed in 2.0 + ConflictsWith: []string{"sku"}, + ValidateFunc: azure.MinCapacitySkuNameInSlice([]string{ + string(apimanagement.SkuTypeDeveloper), + string(apimanagement.SkuTypeBasic), + string(apimanagement.SkuTypeStandard), + string(apimanagement.SkuTypePremium), + }, 1, false), + }, + "identity": { Type: schema.TypeList, Optional: true, @@ -176,7 +194,7 @@ func resourceArmApiManagementService() *schema.Resource { "security": { Type: schema.TypeList, Optional: true, - Computed: true, // todo remove in 2.0 ? + Computed: true, // TODO: Remove in 2.0 ? MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -198,15 +216,15 @@ func resourceArmApiManagementService() *schema.Resource { "disable_triple_des_chipers": { Type: schema.TypeBool, Optional: true, - Computed: true, // todo remove in 2.0 + Computed: true, // TODO: Remove in 2.0 Deprecated: "This field has been deprecated in favour of the `disable_triple_des_ciphers` property to correct the spelling. it will be removed in version 2.0 of the provider", ConflictsWith: []string{"security.0.disable_triple_des_ciphers"}, }, "disable_triple_des_ciphers": { Type: schema.TypeBool, Optional: true, - // Default: false, // todo remove in 2.0 - Computed: true, // todo remove in 2.0 + // Default: false, // TODO: Remove in 2.0 + Computed: true, // TODO: Remove in 2.0 ConflictsWith: []string{"security.0.disable_triple_des_chipers"}, }, "disable_frontend_ssl30": { @@ -378,6 +396,14 @@ func resourceArmApiManagementServiceCreateUpdate(d *schema.ResourceData, meta in client := meta.(*ArmClient).apiManagement.ServiceClient ctx := meta.(*ArmClient).StopContext + // TODO: Remove in 2.0 + sku := expandAzureRmApiManagementSku(d) + if sku == nil { + if sku = expandAzureRmApiManagementSkuName(d); sku == nil { + return fmt.Errorf("either 'sku_name' or 'sku' must be defined in the configuration file") + } + } + log.Printf("[INFO] preparing arguments for API Management Service creation.") name := d.Get("name").(string) @@ -399,8 +425,6 @@ func resourceArmApiManagementServiceCreateUpdate(d *schema.ResourceData, meta in location := azure.NormalizeLocation(d.Get("location").(string)) t := d.Get("tags").(map[string]interface{}) - sku := expandAzureRmApiManagementSku(d) - publisherName := d.Get("publisher_name").(string) publisherEmail := d.Get("publisher_email").(string) notificationSenderEmail := d.Get("notification_sender_email").(string) @@ -574,8 +598,14 @@ func resourceArmApiManagementServiceRead(d *schema.ResourceData, meta interface{ } } - if err := d.Set("sku", flattenApiManagementServiceSku(resp.Sku)); err != nil { - return fmt.Errorf("Error setting `sku`: %+v", err) + if sku := resp.Sku; sku != nil { + // TODO: Remove in 2.0 + if err := d.Set("sku", flattenApiManagementServiceSku(resp.Sku)); err != nil { + return fmt.Errorf("Error setting `sku`: %+v", err) + } + if err := d.Set("sku_name", flattenApiManagementServiceSkuName(resp.Sku)); err != nil { + return fmt.Errorf("Error setting `sku_name`: %+v", err) + } } if err := d.Set("sign_in", flattenApiManagementSignInSettings(signInSettings)); err != nil { @@ -859,22 +889,61 @@ func flattenAzureRmApiManagementMachineIdentity(identity *apimanagement.ServiceI return []interface{}{result} } +// TODO: Remove in 2.0 timeframe func expandAzureRmApiManagementSku(d *schema.ResourceData) *apimanagement.ServiceSkuProperties { + var name string + var capacity int32 + vs := d.Get("sku").([]interface{}) + + if len(vs) == 0 { + return nil + } + // guaranteed by MinItems in the schema v := vs[0].(map[string]interface{}) - name := apimanagement.SkuType(v["name"].(string)) - capacity := int32(v["capacity"].(int)) + name = v["name"].(string) + capacity = int32(v["capacity"].(int)) + + sku := &apimanagement.ServiceSkuProperties{ + Name: apimanagement.SkuType(name), + Capacity: utils.Int32(capacity), + } + + return sku +} + +func expandAzureRmApiManagementSkuName(d *schema.ResourceData) *apimanagement.ServiceSkuProperties { + vs := d.Get("sku_name").(string) + + if len(vs) == 0 { + return nil + } + + name, capacity, err := azure.SplitSku(vs) + if err != nil { + return nil + } sku := &apimanagement.ServiceSkuProperties{ - Name: name, + Name: apimanagement.SkuType(name), Capacity: utils.Int32(capacity), } return sku } +func flattenApiManagementServiceSkuName(input *apimanagement.ServiceSkuProperties) string { + if input == nil { + return "" + } + + sku := fmt.Sprintf("%s_%d", string(input.Name), *input.Capacity) + + return sku +} + func flattenApiManagementServiceSku(input *apimanagement.ServiceSkuProperties) []interface{} { if input == nil { return []interface{}{} @@ -939,7 +1008,7 @@ func flattenApiManagementCustomProperties(input map[string]*string) []interface{ output["disable_frontend_ssl30"] = parseApiManagementNilableDictionary(input, apimFrontendProtocolSsl3) output["disable_frontend_tls10"] = parseApiManagementNilableDictionary(input, apimFrontendProtocolTls10) output["disable_frontend_tls11"] = parseApiManagementNilableDictionary(input, apimFrontendProtocolTls11) - output["disable_triple_des_chipers"] = parseApiManagementNilableDictionary(input, apimTripleDesCiphers) // todo remove in 2.0 + output["disable_triple_des_chipers"] = parseApiManagementNilableDictionary(input, apimTripleDesCiphers) // TODO: Remove in 2.0 output["disable_triple_des_ciphers"] = parseApiManagementNilableDictionary(input, apimTripleDesCiphers) return []interface{}{output} diff --git a/azurerm/resource_arm_api_management_api_test.go b/azurerm/resource_arm_api_management_api_test.go index 2b78826b0a7b..8ceab983a6c5 100644 --- a/azurerm/resource_arm_api_management_api_test.go +++ b/azurerm/resource_arm_api_management_api_test.go @@ -39,6 +39,35 @@ func TestAccAzureRMApiManagementApi_basic(t *testing.T) { }) } +// Remove in 2.0 +func TestAccAzureRMApiManagementApi_basicClassic(t *testing.T) { + resourceName := "azurerm_api_management_api.test" + ri := tf.AccRandTimeInt() + location := testLocation() + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMApiManagementApiDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAzureRMApiManagementApi_basicClassic(ri, location), + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMApiManagementApiExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "soap_pass_through", "false"), + resource.TestCheckResourceAttr(resourceName, "is_current", "true"), + resource.TestCheckResourceAttr(resourceName, "is_online", "false"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func TestAccAzureRMApiManagementApi_wordRevision(t *testing.T) { resourceName := "azurerm_api_management_api.test" ri := tf.AccRandTimeInt() @@ -323,6 +352,24 @@ resource "azurerm_api_management_api" "test" { `, template, rInt) } +// Remove in 2.0 +func testAccAzureRMApiManagementApi_basicClassic(rInt int, location string) string { + template := testAccAzureRMApiManagementApi_templateClassic(rInt, location) + return fmt.Sprintf(` +%s + +resource "azurerm_api_management_api" "test" { + name = "acctestapi-%d" + resource_group_name = "${azurerm_resource_group.test.name}" + api_management_name = "${azurerm_api_management.test.name}" + display_name = "api1" + path = "api1" + protocols = ["https"] + revision = "1" +} +`, template, rInt) +} + func testAccAzureRMApiManagementApi_wordRevision(rInt int, location string) string { template := testAccAzureRMApiManagementApi_template(rInt, location) return fmt.Sprintf(` @@ -455,6 +502,26 @@ resource "azurerm_resource_group" "test" { location = "%s" } +resource "azurerm_api_management" "test" { + name = "acctestAM-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + publisher_name = "pub1" + publisher_email = "pub1@email.com" + + sku_name = "Developer_1" +} +`, rInt, location, rInt) +} + +// Remove in 2.0 +func testAccAzureRMApiManagementApi_templateClassic(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestrg-%d" + location = "%s" +} + resource "azurerm_api_management" "test" { name = "acctestAM-%d" location = "${azurerm_resource_group.test.location}" diff --git a/azurerm/resource_arm_api_management_group_test.go b/azurerm/resource_arm_api_management_group_test.go index 85a5f34f9900..4dd51e2a0cb5 100644 --- a/azurerm/resource_arm_api_management_group_test.go +++ b/azurerm/resource_arm_api_management_group_test.go @@ -203,10 +203,7 @@ resource "azurerm_api_management" "test" { publisher_name = "pub1" publisher_email = "pub1@email.com" - sku { - name = "Developer" - capacity = 1 - } + sku_name = "Developer_1" } resource "azurerm_api_management_group" "test" { @@ -246,10 +243,7 @@ resource "azurerm_api_management" "test" { publisher_name = "pub1" publisher_email = "pub1@email.com" - sku { - name = "Developer" - capacity = 1 - } + sku_name = "Developer_1" } resource "azurerm_api_management_group" "test" { diff --git a/azurerm/resource_arm_api_management_group_user_test.go b/azurerm/resource_arm_api_management_group_user_test.go index 8ae68b3734a6..9ad52c011808 100644 --- a/azurerm/resource_arm_api_management_group_user_test.go +++ b/azurerm/resource_arm_api_management_group_user_test.go @@ -130,10 +130,7 @@ resource "azurerm_api_management" "test" { publisher_name = "pub1" publisher_email = "pub1@email.com" - sku { - name = "Developer" - capacity = 1 - } + sku_name = "Developer_1" } resource "azurerm_api_management_group" "test" { diff --git a/azurerm/resource_arm_api_management_logger_test.go b/azurerm/resource_arm_api_management_logger_test.go index 43b2cbfa8a9a..bd53160c6dab 100644 --- a/azurerm/resource_arm_api_management_logger_test.go +++ b/azurerm/resource_arm_api_management_logger_test.go @@ -294,10 +294,7 @@ resource "azurerm_api_management" "test" { publisher_name = "pub1" publisher_email = "pub1@email.com" - sku { - name = "Developer" - capacity = 1 - } + sku_name = "Developer_1" } resource "azurerm_api_management_logger" "test" { @@ -352,10 +349,7 @@ resource "azurerm_api_management" "test" { publisher_name = "pub1" publisher_email = "pub1@email.com" - sku { - name = "Developer" - capacity = 1 - } + sku_name = "Developer_1" } resource "azurerm_api_management_logger" "test" { @@ -391,10 +385,7 @@ resource "azurerm_api_management" "test" { publisher_name = "pub1" publisher_email = "pub1@email.com" - sku { - name = "Developer" - capacity = 1 - } + sku_name = "Developer_1" } resource "azurerm_api_management_logger" "test" { diff --git a/azurerm/resource_arm_api_management_product_api_test.go b/azurerm/resource_arm_api_management_product_api_test.go index 57b651dd242d..cc19aa3cb51a 100644 --- a/azurerm/resource_arm_api_management_product_api_test.go +++ b/azurerm/resource_arm_api_management_product_api_test.go @@ -130,10 +130,7 @@ resource "azurerm_api_management" "test" { publisher_name = "pub1" publisher_email = "pub1@email.com" - sku { - name = "Developer" - capacity = 1 - } + sku_name = "Developer_1" } resource "azurerm_api_management_product" "test" { diff --git a/azurerm/resource_arm_api_management_product_group_test.go b/azurerm/resource_arm_api_management_product_group_test.go index b479d2ad7174..eeac2e488586 100644 --- a/azurerm/resource_arm_api_management_product_group_test.go +++ b/azurerm/resource_arm_api_management_product_group_test.go @@ -130,10 +130,7 @@ resource "azurerm_api_management" "test" { publisher_name = "pub1" publisher_email = "pub1@email.com" - sku { - name = "Developer" - capacity = 1 - } + sku_name = "Developer_1" } resource "azurerm_api_management_product" "test" { diff --git a/azurerm/resource_arm_api_management_product_test.go b/azurerm/resource_arm_api_management_product_test.go index d97208c74b3d..604851b009a4 100644 --- a/azurerm/resource_arm_api_management_product_test.go +++ b/azurerm/resource_arm_api_management_product_test.go @@ -284,10 +284,7 @@ resource "azurerm_api_management" "test" { publisher_name = "pub1" publisher_email = "pub1@email.com" - sku { - name = "Developer" - capacity = 1 - } + sku_name = "Developer_1" } resource "azurerm_api_management_product" "test" { @@ -332,10 +329,7 @@ resource "azurerm_api_management" "test" { publisher_name = "pub1" publisher_email = "pub1@email.com" - sku { - name = "Developer" - capacity = 1 - } + sku_name = "Developer_1" } resource "azurerm_api_management_product" "test" { @@ -365,10 +359,7 @@ resource "azurerm_api_management" "test" { publisher_name = "pub1" publisher_email = "pub1@email.com" - sku { - name = "Developer" - capacity = 1 - } + sku_name = "Developer_1" } resource "azurerm_api_management_product" "test" { @@ -398,10 +389,7 @@ resource "azurerm_api_management" "test" { publisher_name = "pub1" publisher_email = "pub1@email.com" - sku { - name = "Developer" - capacity = 1 - } + sku_name = "Developer_1" } resource "azurerm_api_management_product" "test" { diff --git a/azurerm/resource_arm_api_management_property_test.go b/azurerm/resource_arm_api_management_property_test.go index 80716d77d302..964523264369 100644 --- a/azurerm/resource_arm_api_management_property_test.go +++ b/azurerm/resource_arm_api_management_property_test.go @@ -148,10 +148,7 @@ resource "azurerm_api_management" "test" { publisher_name = "pub1" publisher_email = "pub1@email.com" - sku { - name = "Developer" - capacity = 1 - } + sku_name = "Developer_1" } resource "azurerm_api_management_property" "test" { @@ -179,10 +176,7 @@ resource "azurerm_api_management" "test" { publisher_name = "pub1" publisher_email = "pub1@email.com" - sku { - name = "Developer" - capacity = 1 - } + sku_name = "Developer_1" } resource "azurerm_api_management_property" "test" { diff --git a/azurerm/resource_arm_api_management_subscription_test.go b/azurerm/resource_arm_api_management_subscription_test.go index 50cbeb667d5d..26ca2ab251cf 100644 --- a/azurerm/resource_arm_api_management_subscription_test.go +++ b/azurerm/resource_arm_api_management_subscription_test.go @@ -269,10 +269,7 @@ resource "azurerm_api_management" "test" { publisher_name = "pub1" publisher_email = "pub1@email.com" - sku { - name = "Developer" - capacity = 1 - } + sku_name = "Developer_1" } resource "azurerm_api_management_product" "test" { diff --git a/azurerm/resource_arm_api_management_test.go b/azurerm/resource_arm_api_management_test.go index 8256b254c467..14f790b6abd6 100644 --- a/azurerm/resource_arm_api_management_test.go +++ b/azurerm/resource_arm_api_management_test.go @@ -2,6 +2,7 @@ package azurerm import ( "fmt" + "regexp" "testing" "github.com/hashicorp/terraform/helper/resource" @@ -36,6 +37,50 @@ func TestAccAzureRMApiManagement_basic(t *testing.T) { }) } +// Remove in 2.0 +func TestAccAzureRMApiManagement_basicClassic(t *testing.T) { + resourceName := "azurerm_api_management.test" + ri := tf.AccRandTimeInt() + config := testAccAzureRMApiManagement_basicClassic(ri, testLocation()) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMApiManagementDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMApiManagementExists(resourceName), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +// Remove in 2.0 +func TestAccAzureRMApiManagement_basicNotDefined(t *testing.T) { + ri := tf.AccRandTimeInt() + config := testAccAzureRMApiManagement_basicNotDefined(ri, testLocation()) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMApiManagementDestroy, + Steps: []resource.TestStep{ + { + Config: config, + ExpectError: regexp.MustCompile("either 'sku_name' or 'sku' must be defined in the configuration file"), + }, + }, + }) +} + func TestAccAzureRMApiManagement_requiresImport(t *testing.T) { if !features.ShouldResourcesBeImported() { t.Skip("Skipping since resources aren't required to be imported") @@ -179,10 +224,12 @@ func TestAccAzureRMApiManagement_policy(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"policy.0.xml_link"}, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "policy.0.xml_link", + }, }, { Config: testAccAzureRMApiManagement_policyRemoved(ri, location), @@ -262,6 +309,26 @@ resource "azurerm_resource_group" "test" { location = "%s" } +resource "azurerm_api_management" "test" { + name = "acctestAM-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + publisher_name = "pub1" + publisher_email = "pub1@email.com" + + sku_name = "Developer_1" +} +`, rInt, location, rInt) +} + +// Remove in 2.0 +func testAccAzureRMApiManagement_basicClassic(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + resource "azurerm_api_management" "test" { name = "acctestAM-%d" location = "${azurerm_resource_group.test.location}" @@ -270,9 +337,27 @@ resource "azurerm_api_management" "test" { publisher_email = "pub1@email.com" sku { - name = "Developer" + name = "Developer" capacity = 1 - } + } +} +`, rInt, location, rInt) +} + +// Remove in 2.0 +func testAccAzureRMApiManagement_basicNotDefined(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_api_management" "test" { + name = "acctestAM-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + publisher_name = "pub1" + publisher_email = "pub1@email.com" } `, rInt, location, rInt) } @@ -291,10 +376,7 @@ resource "azurerm_api_management" "test" { publisher_name = "pub1" publisher_email = "pub1@email.com" - sku { - name = "Developer" - capacity = 1 - } + sku_name = "Developer_1" policy { xml_content = < **Note:** This property has been deprecated in favour of the `sku_name` property and will be removed in version 2.0 of the provider. + --- A `sign_in` block supports the following: diff --git a/website/docs/r/api_management_api.html.markdown b/website/docs/r/api_management_api.html.markdown index c54c81aa4dd0..68f045a1b2f6 100644 --- a/website/docs/r/api_management_api.html.markdown +++ b/website/docs/r/api_management_api.html.markdown @@ -25,10 +25,7 @@ resource "azurerm_api_management" "test" { publisher_name = "My Company" publisher_email = "company@terraform.io" - sku { - name = "Developer" - capacity = 1 - } + sku_name = "Developer_1" } resource "azurerm_api_management_api" "test" { diff --git a/website/docs/r/api_management_group.html.markdown b/website/docs/r/api_management_group.html.markdown index 6c6d6deaef85..9edf41102c4d 100644 --- a/website/docs/r/api_management_group.html.markdown +++ b/website/docs/r/api_management_group.html.markdown @@ -26,10 +26,7 @@ resource "azurerm_api_management" "example" { publisher_name = "pub1" publisher_email = "pub1@email.com" - sku { - name = "Developer" - capacity = 1 - } + sku_name = "Developer_1" } resource "azurerm_api_management_group" "example" { diff --git a/website/docs/r/api_management_logger.html.markdown b/website/docs/r/api_management_logger.html.markdown index c35c07ac8ff1..e59cbd2b3f20 100644 --- a/website/docs/r/api_management_logger.html.markdown +++ b/website/docs/r/api_management_logger.html.markdown @@ -33,10 +33,7 @@ resource "azurerm_api_management" "example" { publisher_name = "My Company" publisher_email = "company@terraform.io" - sku { - name = "Developer" - capacity = 1 - } + sku_name = "Developer_1" } resource "azurerm_api_management_logger" "example" { diff --git a/website/docs/r/api_management_product.html.markdown b/website/docs/r/api_management_product.html.markdown index c42a30241be7..4b77321a1b20 100644 --- a/website/docs/r/api_management_product.html.markdown +++ b/website/docs/r/api_management_product.html.markdown @@ -25,10 +25,7 @@ resource "azurerm_api_management" "test" { publisher_name = "My Company" publisher_email = "company@terraform.io" - sku { - name = "Developer" - capacity = 1 - } + sku_name = "Developer_1" } resource "azurerm_api_management_product" "test" { diff --git a/website/docs/r/api_management_property.html.markdown b/website/docs/r/api_management_property.html.markdown index 2ad9cc8a3692..8956c7eff089 100644 --- a/website/docs/r/api_management_property.html.markdown +++ b/website/docs/r/api_management_property.html.markdown @@ -26,10 +26,7 @@ resource "azurerm_api_management" "example" { publisher_name = "pub1" publisher_email = "pub1@email.com" - sku { - name = "Developer" - capacity = 1 - } + sku_name = "Developer_1" } resource "azurerm_api_management_property" "example" { diff --git a/website/docs/r/api_management_user.html.markdown b/website/docs/r/api_management_user.html.markdown index 94d9663386bc..05ff000de36e 100644 --- a/website/docs/r/api_management_user.html.markdown +++ b/website/docs/r/api_management_user.html.markdown @@ -25,10 +25,7 @@ resource "azurerm_api_management" "test" { publisher_name = "My Company" publisher_email = "company@terraform.io" - sku { - name = "Developer" - capacity = 1 - } + sku_name = "Developer_1" } resource "azurerm_api_management_user" "test" {