From dce0ae51b3500373892a8426b9bb35130faca512 Mon Sep 17 00:00:00 2001 From: Andrey Viktorov <538401+sabbox@users.noreply.github.com> Date: Sun, 15 Apr 2018 20:56:00 +0300 Subject: [PATCH 1/8] Add MSI support for App service --- azurerm/resource_arm_app_service.go | 85 ++++++++++++++++++++++ azurerm/resource_arm_app_service_test.go | 92 ++++++++++++++++++++++++ 2 files changed, 177 insertions(+) diff --git a/azurerm/resource_arm_app_service.go b/azurerm/resource_arm_app_service.go index aa64de2cfda4..3a5ea1ac101e 100644 --- a/azurerm/resource_arm_app_service.go +++ b/azurerm/resource_arm_app_service.go @@ -29,6 +29,33 @@ func resourceArmAppService() *schema.Resource { ValidateFunc: validateAppServiceName, }, + "identity": { + Type: schema.TypeList, + Optional: true, + Computed: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": { + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: ignoreCaseDiffSuppressFunc, + ValidateFunc: validation.StringInSlice([]string{ + "SystemAssigned", + }, true), + }, + "principal_id": { + Type: schema.TypeString, + Computed: true, + }, + "tenant_id": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "resource_group_name": resourceGroupNameSchema(), "location": locationSchema(), @@ -336,6 +363,11 @@ func resourceArmAppServiceCreate(d *schema.ResourceData, meta interface{}) error }, } + if _, ok := d.GetOk("identity"); ok { + appServiceIdentity := expandAzureRmAppServiceIdentity(d) + siteEnvelope.Identity = appServiceIdentity + } + if v, ok := d.GetOkExists("client_affinity_enabled"); ok { enabled := v.(bool) siteEnvelope.SiteProperties.ClientAffinityEnabled = utils.Bool(enabled) @@ -364,6 +396,16 @@ func resourceArmAppServiceCreate(d *schema.ResourceData, meta interface{}) error return resourceArmAppServiceUpdate(d, meta) } +func expandAzureRmAppServiceIdentity(d *schema.ResourceData) *web.ManagedServiceIdentity { + v := d.Get("identity") + identities := v.([]interface{}) + identity := identities[0].(map[string]interface{}) + identityType := identity["type"].(string) + return &web.ManagedServiceIdentity{ + Type: web.ManagedServiceIdentityType(identityType), + } +} + func resourceArmAppServiceUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*ArmClient).appServicesClient ctx := meta.(*ArmClient).StopContext @@ -431,6 +473,24 @@ func resourceArmAppServiceUpdate(d *schema.ResourceData, meta interface{}) error } } + if d.HasChange("identity") { + + site, err := client.Get(ctx, resGroup, name) + if err != nil { + return fmt.Errorf("Error getting configuration for App Service %q: %+v", name, err) + } + + appServiceIdentity := expandAzureRmAppServiceIdentity(d) + site.Identity = appServiceIdentity + + future, err := client.CreateOrUpdate(ctx, resGroup, name, site) + err = future.WaitForCompletion(ctx, client.Client) + + if err != nil { + return fmt.Errorf("Error updating Managed Service Identity for App Service %q: %+v", name, err) + } + } + return resourceArmAppServiceRead(d, meta) } @@ -528,9 +588,34 @@ func resourceArmAppServiceRead(d *schema.ResourceData, meta interface{}) error { flattenAndSetTags(d, resp.Tags) + identity := flattenAzureRmAppServiceMachineIdentity(resp.Identity) + log.Printf("##foo MSI read %v", identity) + if err := d.Set("identity", identity); err != nil { + return err + } + return nil } +func flattenAzureRmAppServiceMachineIdentity(identity *web.ManagedServiceIdentity) []interface{} { + + if identity == nil { + return make([]interface{}, 0) + } + + result := make(map[string]interface{}) + result["type"] = string(identity.Type) + + if identity.PrincipalID != nil { + result["principal_id"] = *identity.PrincipalID + } + if identity.TenantID != nil { + result["tenant_id"] = *identity.TenantID + } + + return []interface{}{result} +} + func resourceArmAppServiceDelete(d *schema.ResourceData, meta interface{}) error { client := meta.(*ArmClient).appServicesClient diff --git a/azurerm/resource_arm_app_service_test.go b/azurerm/resource_arm_app_service_test.go index 8c5fce4d1169..70383acd0791 100644 --- a/azurerm/resource_arm_app_service_test.go +++ b/azurerm/resource_arm_app_service_test.go @@ -3,6 +3,7 @@ package azurerm import ( "fmt" "testing" + "regexp" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" @@ -236,6 +237,67 @@ func TestAccAzureRMAppService_clientAffinityDisabled(t *testing.T) { }) } +func TestAccAzureRMAppService_enableManageServiceIdentity(t *testing.T) { + + resourceName := "azurerm_app_service.test" + ri := acctest.RandInt() + config := testAccAzureRMAppService_mangedServiceIdentity(ri, testLocation()) + + uuidMatch := regexp.MustCompile("^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[8|9|aA|bB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$") + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMAppServiceDestroy, + Steps: []resource.TestStep{ + { + Config: config, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMAppServiceExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "identity.0.type", "SystemAssigned"), + resource.TestMatchResourceAttr(resourceName, "identity.0.principal_id", uuidMatch), + resource.TestMatchResourceAttr(resourceName, "identity.0.tenant_id", uuidMatch), + ), + }, + }, + }) +} + +func TestAccAzureRMAppService_updateResourceByEnablingManageServiceIdentity(t *testing.T) { + + resourceName := "azurerm_app_service.test" + ri := acctest.RandInt() + + basicResourceNoManagedIdentity := testAccAzureRMAppService_basic(ri, testLocation()) + managedIdentityEnabled := testAccAzureRMAppService_mangedServiceIdentity(ri, testLocation()) + + uuidMatch := regexp.MustCompile("^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[8|9|aA|bB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$") + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMAppServiceDestroy, + Steps: []resource.TestStep{ + { + Config: basicResourceNoManagedIdentity, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMAppServiceExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "identity.#", "0"), + ), + }, + { + Config: managedIdentityEnabled, + Check: resource.ComposeTestCheckFunc( + testCheckAzureRMAppServiceExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "identity.0.type", "SystemAssigned"), + resource.TestMatchResourceAttr(resourceName, "identity.0.principal_id", uuidMatch), + resource.TestMatchResourceAttr(resourceName, "identity.0.tenant_id", uuidMatch), + ), + }, + }, + }) +} + func TestAccAzureRMAppService_clientAffinityUpdate(t *testing.T) { resourceName := "azurerm_app_service.test" ri := acctest.RandInt() @@ -976,6 +1038,36 @@ resource "azurerm_app_service" "test" { `, rInt, location, rInt, rInt, clientAffinity) } +func testAccAzureRMAppService_mangedServiceIdentity(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_app_service_plan" "test" { + name = "acctestASP-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + + sku { + tier = "Standard" + size = "S1" + } +} + +resource "azurerm_app_service" "test" { + name = "acctestAS-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + app_service_plan_id = "${azurerm_app_service_plan.test.id}" + identity = { + type = "SystemAssigned" + } +} +`, rInt, location, rInt, rInt) +} + func testAccAzureRMAppService_connectionStrings(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { From 91c4e5442d9c8bd4d8c6ea920d3843a0f928bc60 Mon Sep 17 00:00:00 2001 From: Andrey Viktorov <538401+sabbox@users.noreply.github.com> Date: Tue, 17 Apr 2018 00:50:26 +0300 Subject: [PATCH 2/8] Fix formatting --- azurerm/resource_arm_app_service_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azurerm/resource_arm_app_service_test.go b/azurerm/resource_arm_app_service_test.go index 70383acd0791..51b180d7d5b6 100644 --- a/azurerm/resource_arm_app_service_test.go +++ b/azurerm/resource_arm_app_service_test.go @@ -2,8 +2,8 @@ package azurerm import ( "fmt" - "testing" "regexp" + "testing" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" From 97f3ea396abdf067ea9b20d44e45c1141cc39b7f Mon Sep 17 00:00:00 2001 From: Andrey Viktorov <538401+sabbox@users.noreply.github.com> Date: Tue, 17 Apr 2018 00:55:11 +0300 Subject: [PATCH 3/8] Clean up debug log --- azurerm/resource_arm_app_service.go | 1 - 1 file changed, 1 deletion(-) diff --git a/azurerm/resource_arm_app_service.go b/azurerm/resource_arm_app_service.go index 3a5ea1ac101e..6c326c769d06 100644 --- a/azurerm/resource_arm_app_service.go +++ b/azurerm/resource_arm_app_service.go @@ -589,7 +589,6 @@ func resourceArmAppServiceRead(d *schema.ResourceData, meta interface{}) error { flattenAndSetTags(d, resp.Tags) identity := flattenAzureRmAppServiceMachineIdentity(resp.Identity) - log.Printf("##foo MSI read %v", identity) if err := d.Set("identity", identity); err != nil { return err } From 1e8ae9df074be5a390cec83f69e8c834b5a41051 Mon Sep 17 00:00:00 2001 From: Andrey Viktorov <538401+sabbox@users.noreply.github.com> Date: Tue, 17 Apr 2018 14:14:50 +0300 Subject: [PATCH 4/8] Handle client error --- azurerm/resource_arm_app_service.go | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/azurerm/resource_arm_app_service.go b/azurerm/resource_arm_app_service.go index 6c326c769d06..57f207f4e941 100644 --- a/azurerm/resource_arm_app_service.go +++ b/azurerm/resource_arm_app_service.go @@ -5,6 +5,7 @@ import ( "log" "regexp" + "context" "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" @@ -483,17 +484,37 @@ func resourceArmAppServiceUpdate(d *schema.ResourceData, meta interface{}) error appServiceIdentity := expandAzureRmAppServiceIdentity(d) site.Identity = appServiceIdentity - future, err := client.CreateOrUpdate(ctx, resGroup, name, site) - err = future.WaitForCompletion(ctx, client.Client) - + err = updateAppServiceSettings(client, ctx, resGroup, name, site) if err != nil { - return fmt.Errorf("Error updating Managed Service Identity for App Service %q: %+v", name, err) + return err } } return resourceArmAppServiceRead(d, meta) } +func updateAppServiceSettings( + client web.AppsClient, + ctx context.Context, + resGroup string, + name string, + site web.Site) error { + + future, err := client.CreateOrUpdate(ctx, resGroup, name, site) + + if err != nil { + return fmt.Errorf("Error updating Managed Service Identity for App Service %q: %+v", name, err) + } + + err = future.WaitForCompletion(ctx, client.Client) + + if err != nil { + return fmt.Errorf("Error updating Managed Service Identity for App Service %q: %+v", name, err) + } + + return nil +} + func resourceArmAppServiceRead(d *schema.ResourceData, meta interface{}) error { client := meta.(*ArmClient).appServicesClient From 3afa18e786c757a0619e17b2fedac9cebbf636ba Mon Sep 17 00:00:00 2001 From: Andrey Viktorov <538401+sabbox@users.noreply.github.com> Date: Tue, 17 Apr 2018 14:55:37 +0300 Subject: [PATCH 5/8] Add MSI documentation --- website/docs/r/app_service.html.markdown | 42 ++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/website/docs/r/app_service.html.markdown b/website/docs/r/app_service.html.markdown index 7d27dc467325..b00cc0137cd9 100644 --- a/website/docs/r/app_service.html.markdown +++ b/website/docs/r/app_service.html.markdown @@ -131,6 +131,8 @@ The following arguments are supported: * `tags` - (Optional) A mapping of tags to assign to the resource. Changing this forces a new resource to be created. +* `identity` - (Optional) A Managed Service Identity block as defined below. + --- `connection_string` supports the following: @@ -153,6 +155,43 @@ The following arguments are supported: * `local_mysql_enabled` - (Optional) Is "MySQL In App" Enabled? This runs a local MySQL instance with your app and shares resources from the App Service plan. +--- + +`identity` supports the following: + +* `type` - (Required) Specifies the identity type of the App Service. The only allowable value is `SystemAssigned`. +The assigned `principal_id` and `tenant_id` can be retrieved after the App Service has been created, e.g. + +```hcl +resource "azurerm_app_service" "test" { + name = "${random_id.server.hex}" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + app_service_plan_id = "${azurerm_app_service_plan.test.id}" + + site_config { + always_on = true + } + + identity = { + type = "SystemAssigned" + } + + client_affinity_enabled = false + + app_settings { + "SOME_KEY" = "some-value" + } + +} + +output "test_service_principal_id" { + value = "${lookup(azurerm_app_service.test.identity[0], "principal_id")}" +} +output "test_service_tenant_id" { + value = "${lookup(azurerm_app_service.test.identity[0], "tenant_id")}" +} +``` ~> **NOTE:** MySQL In App is not intended for production environments and will not scale beyond a single instance. Instead you may wish [to use Azure Database for MySQL](/docs/providers/azurerm/r/mysql_database.html). * `managed_pipeline_mode` - (Optional) The Managed Pipeline Mode. Possible values are `Integrated` and `Classic`. Defaults to `Integrated`. @@ -184,6 +223,9 @@ The following attributes are exported: * `site_credential` - (Optional) The site-level credential used to publish files to Azure Web App. +* `principal_id` - When Identity is `SystemAssigned` attribute exposes Service Principal id created by Azure Resource Manager. + +* `tenant_id` - When Identity is `SystemAssigned` attribute exposes Azure AD tenant id where Service Principal was created. --- `source_control` supports the following: From f68b8e59ef11e08dbe08b1d2afce7486217c44a3 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Tue, 1 May 2018 14:17:38 +0100 Subject: [PATCH 6/8] Refactoring the separate method calls into the update block --- azurerm/resource_arm_app_service.go | 89 ++++++++++++----------------- 1 file changed, 36 insertions(+), 53 deletions(-) diff --git a/azurerm/resource_arm_app_service.go b/azurerm/resource_arm_app_service.go index 57f207f4e941..5f9fb526f97f 100644 --- a/azurerm/resource_arm_app_service.go +++ b/azurerm/resource_arm_app_service.go @@ -5,7 +5,6 @@ import ( "log" "regexp" - "context" "github.com/Azure/azure-sdk-for-go/services/web/mgmt/2016-09-01/web" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" @@ -397,16 +396,6 @@ func resourceArmAppServiceCreate(d *schema.ResourceData, meta interface{}) error return resourceArmAppServiceUpdate(d, meta) } -func expandAzureRmAppServiceIdentity(d *schema.ResourceData) *web.ManagedServiceIdentity { - v := d.Get("identity") - identities := v.([]interface{}) - identity := identities[0].(map[string]interface{}) - identityType := identity["type"].(string) - return &web.ManagedServiceIdentity{ - Type: web.ManagedServiceIdentityType(identityType), - } -} - func resourceArmAppServiceUpdate(d *schema.ResourceData, meta interface{}) error { client := meta.(*ArmClient).appServicesClient ctx := meta.(*ArmClient).StopContext @@ -475,7 +464,6 @@ func resourceArmAppServiceUpdate(d *schema.ResourceData, meta interface{}) error } if d.HasChange("identity") { - site, err := client.Get(ctx, resGroup, name) if err != nil { return fmt.Errorf("Error getting configuration for App Service %q: %+v", name, err) @@ -484,35 +472,22 @@ func resourceArmAppServiceUpdate(d *schema.ResourceData, meta interface{}) error appServiceIdentity := expandAzureRmAppServiceIdentity(d) site.Identity = appServiceIdentity - err = updateAppServiceSettings(client, ctx, resGroup, name, site) + future, err := client.CreateOrUpdate(ctx, resGroup, name, site) + if err != nil { - return err + return fmt.Errorf("Error updating Managed Service Identity for App Service %q: %+v", name, err) } - } - return resourceArmAppServiceRead(d, meta) -} + err = future.WaitForCompletion(ctx, client.Client) -func updateAppServiceSettings( - client web.AppsClient, - ctx context.Context, - resGroup string, - name string, - site web.Site) error { - - future, err := client.CreateOrUpdate(ctx, resGroup, name, site) - - if err != nil { - return fmt.Errorf("Error updating Managed Service Identity for App Service %q: %+v", name, err) - } - - err = future.WaitForCompletion(ctx, client.Client) + if err != nil { + return fmt.Errorf("Error updating Managed Service Identity for App Service %q: %+v", name, err) + } - if err != nil { - return fmt.Errorf("Error updating Managed Service Identity for App Service %q: %+v", name, err) + return nil } - return nil + return resourceArmAppServiceRead(d, meta) } func resourceArmAppServiceRead(d *schema.ResourceData, meta interface{}) error { @@ -617,25 +592,6 @@ func resourceArmAppServiceRead(d *schema.ResourceData, meta interface{}) error { return nil } -func flattenAzureRmAppServiceMachineIdentity(identity *web.ManagedServiceIdentity) []interface{} { - - if identity == nil { - return make([]interface{}, 0) - } - - result := make(map[string]interface{}) - result["type"] = string(identity.Type) - - if identity.PrincipalID != nil { - result["principal_id"] = *identity.PrincipalID - } - if identity.TenantID != nil { - result["tenant_id"] = *identity.TenantID - } - - return []interface{}{result} -} - func resourceArmAppServiceDelete(d *schema.ResourceData, meta interface{}) error { client := meta.(*ArmClient).appServicesClient @@ -889,6 +845,33 @@ func flattenAppServiceAppSettings(input map[string]*string) map[string]string { return output } +func expandAzureRmAppServiceIdentity(d *schema.ResourceData) *web.ManagedServiceIdentity { + identities := d.Get("identity").([]interface{}) + identity := identities[0].(map[string]interface{}) + identityType := identity["type"].(string) + return &web.ManagedServiceIdentity{ + Type: web.ManagedServiceIdentityType(identityType), + } +} + +func flattenAzureRmAppServiceMachineIdentity(identity *web.ManagedServiceIdentity) []interface{} { + if identity == nil { + return make([]interface{}, 0) + } + + result := make(map[string]interface{}) + result["type"] = string(identity.Type) + + if identity.PrincipalID != nil { + result["principal_id"] = *identity.PrincipalID + } + if identity.TenantID != nil { + result["tenant_id"] = *identity.TenantID + } + + return []interface{}{result} +} + func validateAppServiceName(v interface{}, k string) (ws []string, es []error) { value := v.(string) From 0132836645ec9ba15e2b43a7b5fd9127a917643a Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Tue, 1 May 2018 14:17:58 +0100 Subject: [PATCH 7/8] Updating the documentation for consistency purposes --- website/docs/r/app_service.html.markdown | 77 +++++++++--------------- 1 file changed, 29 insertions(+), 48 deletions(-) diff --git a/website/docs/r/app_service.html.markdown b/website/docs/r/app_service.html.markdown index b00cc0137cd9..92ac0d4f5bc0 100644 --- a/website/docs/r/app_service.html.markdown +++ b/website/docs/r/app_service.html.markdown @@ -143,6 +143,14 @@ The following arguments are supported: --- +`identity` supports the following: + +* `type` - (Required) Specifies the identity type of the App Service. At this time the only allowed value is `SystemAssigned`. + +~> The assigned `principal_id` and `tenant_id` can be retrieved after the App Service has been created. More details are available below. + +--- + `site_config` supports the following: * `always_on` - (Optional) Should the app be loaded at all times? Defaults to `false`. @@ -155,43 +163,6 @@ The following arguments are supported: * `local_mysql_enabled` - (Optional) Is "MySQL In App" Enabled? This runs a local MySQL instance with your app and shares resources from the App Service plan. ---- - -`identity` supports the following: - -* `type` - (Required) Specifies the identity type of the App Service. The only allowable value is `SystemAssigned`. -The assigned `principal_id` and `tenant_id` can be retrieved after the App Service has been created, e.g. - -```hcl -resource "azurerm_app_service" "test" { - name = "${random_id.server.hex}" - location = "${azurerm_resource_group.test.location}" - resource_group_name = "${azurerm_resource_group.test.name}" - app_service_plan_id = "${azurerm_app_service_plan.test.id}" - - site_config { - always_on = true - } - - identity = { - type = "SystemAssigned" - } - - client_affinity_enabled = false - - app_settings { - "SOME_KEY" = "some-value" - } - -} - -output "test_service_principal_id" { - value = "${lookup(azurerm_app_service.test.identity[0], "principal_id")}" -} -output "test_service_tenant_id" { - value = "${lookup(azurerm_app_service.test.identity[0], "tenant_id")}" -} -``` ~> **NOTE:** MySQL In App is not intended for production environments and will not scale beyond a single instance. Instead you may wish [to use Azure Database for MySQL](/docs/providers/azurerm/r/mysql_database.html). * `managed_pipeline_mode` - (Optional) The Managed Pipeline Mode. Possible values are `Integrated` and `Classic`. Defaults to `Integrated`. @@ -206,7 +177,6 @@ output "test_service_tenant_id" { * `websockets_enabled` - (Optional) Should WebSockets be enabled? - ~> **NOTE:** Additional Source Control types will be added in the future, once support for them has been added in the Azure SDK for Go. ## Attributes Reference @@ -219,24 +189,35 @@ The following attributes are exported: * `outbound_ip_addresses` - A comma separated list of outbound IP addresses - such as `52.23.25.3,52.143.43.12` -* `source_control` - (Optional) The default local Git source control information if deployment option is set to `LocalGit`. +* `source_control` - A `source_control` block as defined below, which contains the Source Control information when `scm_type` is set to `LocalGit`. -* `site_credential` - (Optional) The site-level credential used to publish files to Azure Web App. +* `site_credential` - A `site_credential` block as defined below, which contains the site-level credentials used to publish to this App Service. -* `principal_id` - When Identity is `SystemAssigned` attribute exposes Service Principal id created by Azure Resource Manager. +* `identity` - An `identity` block as defined below, which contains the Managed Service Identity information for this App Service. -* `tenant_id` - When Identity is `SystemAssigned` attribute exposes Azure AD tenant id where Service Principal was created. --- -`source_control` supports the following: +`identity` exports the following: -* `repo_url` - URL of the Git repository for this App Service. -* `branch` - Branch name of the Git repository for this App Service. +* `principal_id` - The Principal ID for the Service Principal associated with the Managed Service Identity of this App Service. + +* `tenant_id` - The Tenant ID for the Service Principal associated with the Managed Service Identity of this App Service. + +--- + +`site_credential` exports the following: + +* `username` - The username which can be used to publish to this App Service +* `password` - The password associated with the username, which can be used to publish to this App Service. -`site_credential` supports the following: +~> **NOTE:** both `username` and `password` for the `site_credential` block are only exported when `scm_type` is set to `LocalGit` -* `username` - If your site is named 'MySite', the user name will be '$MySite'. -* `password` - Some long random string. +--- + +`source_control` exports the following: + +* `repo_url` - URL of the Git repository for this App Service. +* `branch` - Branch name of the Git repository for this App Service. ## Import From a730b047105c90780f52ca8c54fdfde70d95a828 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Tue, 1 May 2018 15:23:10 +0100 Subject: [PATCH 8/8] Fixing a bug where we returned incorrectly --- azurerm/resource_arm_app_service.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/azurerm/resource_arm_app_service.go b/azurerm/resource_arm_app_service.go index 5f9fb526f97f..c70de45d6037 100644 --- a/azurerm/resource_arm_app_service.go +++ b/azurerm/resource_arm_app_service.go @@ -483,8 +483,6 @@ func resourceArmAppServiceUpdate(d *schema.ResourceData, meta interface{}) error if err != nil { return fmt.Errorf("Error updating Managed Service Identity for App Service %q: %+v", name, err) } - - return nil } return resourceArmAppServiceRead(d, meta)