Skip to content

Commit

Permalink
r/storage_blob: documenting the deprecated fields
Browse files Browse the repository at this point in the history
  • Loading branch information
tombuildsstuff committed Sep 2, 2019
1 parent 805c3a4 commit cab451f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
11 changes: 6 additions & 5 deletions azurerm/resource_arm_storage_blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(),
},
}
}
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
6 changes: 6 additions & 0 deletions website/docs/guides/2.0-upgrade-guide.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
15 changes: 7 additions & 8 deletions website/docs/r/storage_blob.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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"
}
Expand Down Expand Up @@ -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.

Expand All @@ -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:
Expand Down

0 comments on commit cab451f

Please sign in to comment.