Skip to content

Commit 5dbd80a

Browse files
committed
initial put
1 parent f737fe9 commit 5dbd80a

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
title: Create a storage task using Terraform
3+
titleSuffix: Azure Storage Actions Preview
4+
description: Learn how to create a storage task using Terraform. A storage task can perform on blobs in one or more Azure Storage accounts.
5+
author: normesta
6+
ms.service: azure-storage-actions
7+
ms.custom: devx-track-terraform;build-2023-metadata-update
8+
ms.topic: how-to
9+
ms.author: normesta
10+
ms.date: 03/25/2025
11+
#customer intent: As a Terraform user, I want to see how to create a storage task using Terraform.
12+
content_well_notification:
13+
- AI-contribution
14+
---
15+
16+
# Create a storage task using Terraform
17+
18+
A storage task can perform operations on blobs in an Azure Storage account. As you create a task, you can define the conditions that must be met by each object (container or blob), and the operations to perform on the object. You can also identify one or more Azure Storage account targets. See [What are Azure Storage Actions?](../overview.md).
19+
20+
In this how-to article, you'll learn how to create a storage task using Terraform.
21+
22+
> [!IMPORTANT]
23+
> Azure Storage Actions is currently in PREVIEW and is available these [regions](../overview.md#supported-regions).
24+
> See the [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/) for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability.
25+
26+
[!INCLUDE [About Terraform](~/azure-dev-docs-pr/articles/terraform/includes/abstract.md)]
27+
28+
> [!div class="checklist"]
29+
> * Retrieve the current Azure client configuration.
30+
> * Generate a random name for the resource group.
31+
> * Create a new Azure resource group with the generated name.
32+
> * Generate a random string to be used as the storage task name.
33+
> * Calculate a future date by offsetting the current date by a certain number of days.
34+
> * Create a new Azure API resource of type "Microsoft.StorageActions/storageTasks".
35+
> * Specify the required providers for Terraform, including their sources and versions.
36+
> * Configure the Azure provider with specific features.
37+
> * Define several variables, including the location of the resource group, the prefix for the resource group name, the number of offset days, and the description of the storage task.
38+
39+
## Prerequisites
40+
41+
- Create an Azure account with an active subscription. You can [create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
42+
43+
- [Install and configure Terraform](/azure/developer/terraform/quickstart-configure)
44+
45+
## Implement the Terraform code
46+
47+
> [!NOTE]
48+
> The sample code for this article is located in the [Azure Terraform GitHub repo](https://github.com/Azure/terraform/tree/master/quickstart/101-azure-storage-actions-create-storage-task). You can view the log file containing the [test results from current and previous versions of Terraform](https://github.com/Azure/terraform/tree/master/quickstart/101-azure-storage-actions-create-storage-task/TestRecord.md).
49+
>
50+
> See more [articles and sample code showing how to use Terraform to manage Azure resources](/azure/terraform)
51+
52+
1. Create a directory in which to test and run the sample Terraform code, and make it the current directory.
53+
54+
1. Create a file named `providers.tf` and insert the following code.
55+
:::code language="Terraform" source="~/terraform_samples/quickstart/101-azure-storage-actions-create-storage-task/providers.tf":::
56+
57+
1. Create a file named `main.tf` and insert the following code.
58+
:::code language="Terraform" source="~/terraform_samples/quickstart/101-azure-storage-actions-create-storage-task/main.tf":::
59+
60+
1. Create a file named `variables.tf` and insert the following code.
61+
:::code language="Terraform" source="~/terraform_samples/quickstart/101-azure-storage-actions-create-storage-task/variables.tf":::
62+
63+
1. Create a file named `outputs.tf` and insert the following code.
64+
:::code language="Terraform" source="~/terraform_samples/quickstart/101-azure-storage-actions-create-storage-task/outputs.tf":::
65+
66+
## Initialize Terraform
67+
68+
[!INCLUDE [terraform-init.md](~/azure-dev-docs-pr/articles/terraform/includes/terraform-init.md)]
69+
70+
## Create a Terraform execution plan
71+
72+
[!INCLUDE [terraform-plan.md](~/azure-dev-docs-pr/articles/terraform/includes/terraform-plan.md)]
73+
74+
## Apply a Terraform execution plan
75+
76+
[!INCLUDE [terraform-apply-plan.md](~/azure-dev-docs-pr/articles/terraform/includes/terraform-apply-plan.md)]
77+
78+
## Clean up resources
79+
80+
[!INCLUDE [terraform-plan-destroy.md](~/azure-dev-docs-pr/articles/terraform/includes/terraform-plan-destroy.md)]
81+
82+
## Troubleshoot Terraform on Azure
83+
84+
[Troubleshoot common problems when using Terraform on Azure](/azure/developer/terraform/troubleshoot).
85+
86+
## See also
87+
88+
- [Azure Storage Actions overview](../overview.md)
89+
- [Create, assign, and run a storage task](storage-task-quickstart-portal.md)
90+
- [Define conditions and operations](storage-task-conditions-operations-edit.md)

0 commit comments

Comments
 (0)