diff --git a/azurerm/resource_arm_storage_blob.go b/azurerm/resource_arm_storage_blob.go index 612514d2386c..3797e37aec95 100644 --- a/azurerm/resource_arm_storage_blob.go +++ b/azurerm/resource_arm_storage_blob.go @@ -36,9 +36,6 @@ func resourceArmStorageBlob() *schema.Resource { // TODO: add validation }, - // TODO: this can be deprecated with the new sdk? - "resource_group_name": azure.SchemaResourceGroupName(), - "storage_account_name": { Type: schema.TypeString, Required: true, @@ -114,6 +111,8 @@ func resourceArmStorageBlob() *schema.Resource { Deprecated: "Retries are now handled by the Azure SDK as such this field is no longer necessary and will be removed in v2.0 of the Azure Provider", ValidateFunc: validation.IntAtLeast(1), }, + + "resource_group_name": azure.SchemaResourceGroupNameDeprecated(), }, } } @@ -175,7 +174,8 @@ func resourceArmStorageBlobCreate(d *schema.ResourceData, meta interface{}) erro log.Printf("[DEBUG] Created Blob %q in Container %q within Storage Account %q.", name, containerName, accountName) d.SetId(id) - return resourceArmStorageBlobRead(d, meta) + + return resourceArmStorageBlobUpdate(d, meta) } func resourceArmStorageBlobUpdate(d *schema.ResourceData, meta interface{}) error { @@ -200,10 +200,11 @@ func resourceArmStorageBlobUpdate(d *schema.ResourceData, meta interface{}) erro return fmt.Errorf("Error building Blobs Client: %s", err) } + // TODO: changing the access tier + if d.HasChange("content_type") { log.Printf("[DEBUG] Updating Properties for Blob %q (Container %q / Account %q)...", id.BlobName, id.ContainerName, id.AccountName) input := blobs.SetPropertiesInput{ - // TODO: other properties (Access Tier)? ContentType: utils.String(d.Get("content_type").(string)), } if _, err := blobsClient.SetProperties(ctx, id.AccountName, id.ContainerName, id.BlobName, input); err != nil { diff --git a/website/docs/guides/2.0-upgrade-guide.html.markdown b/website/docs/guides/2.0-upgrade-guide.html.markdown index ce9bad625e29..a8e0ed69dccc 100644 --- a/website/docs/guides/2.0-upgrade-guide.html.markdown +++ b/website/docs/guides/2.0-upgrade-guide.html.markdown @@ -347,6 +347,12 @@ The deprecated `enable_filtering_messages_before_publishing` field will be remov The deprecated `account_type` field will be removed. This has been split into the fields `account_tier` and `account_replication_type`. +### Resource: `azurerm_storage_blob` + +The deprecated `attempts` field will be removed, since Terraform now handles retries automatically. + +The deprecated `resource_group_name` field will be removed, since this is no longer used. + ### Resource: `azurerm_storage_container` The deprecated `resource_group_name` field will be removed, since this is no longer used. diff --git a/website/docs/r/storage_blob.html.markdown b/website/docs/r/storage_blob.html.markdown index fd917d77f967..187d77d7fadd 100644 --- a/website/docs/r/storage_blob.html.markdown +++ b/website/docs/r/storage_blob.html.markdown @@ -3,12 +3,12 @@ layout: "azurerm" page_title: "Azure Resource Manager: azurerm_storage_blob" sidebar_current: "docs-azurerm-resource-storage-blob" description: |- - Manages a Azure Storage Blob. + Manages a Blob within a Storage Container. --- # azurerm_storage_blob -Manages an Azure Storage Blob. +Manages a Blob within a Storage Container. ## Example Usage @@ -21,7 +21,7 @@ resource "azurerm_resource_group" "test" { resource "azurerm_storage_account" "test" { name = "acctestaccs" resource_group_name = "${azurerm_resource_group.test.name}" - location = "westus" + location = "${azurerm_resource_group.test.location}" account_tier = "Standard" account_replication_type = "LRS" } @@ -51,9 +51,6 @@ The following arguments are supported: * `name` - (Required) The name of the storage blob. Must be unique within the storage container the blob is located. -* `resource_group_name` - (Required) The name of the resource group in which to - create the storage container. Changing this forces a new resource to be created. - * `storage_account_name` - (Required) Specifies the storage account in which to create the storage container. Changing this forces a new resource to be created. @@ -73,10 +70,12 @@ The following arguments are supported: * `parallelism` - (Optional) The number of workers per CPU core to run for concurrent uploads. Defaults to `8`. -* `attempts` - (Optional) The number of attempts to make per page or block when uploading. Defaults to `1`. - * `metadata` - (Optional) A map of custom blob metadata. +* `attempts` - (Optional / **Deprecated**) The number of attempts to make per page or block when uploading. Defaults to `1`. + +* `resource_group_name` - (Optional / **Deprecated**) The name of the resource group in which to create the storage container. + ## Attributes Reference The following attributes are exported in addition to the arguments listed above: