-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* go mod vendor * new ephemeral resource: `azapi_resource_action` * use go 1.22 * use go 1.22.7
- Loading branch information
Showing
256 changed files
with
17,037 additions
and
8,479 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## v2.3.0 (unreleased) | ||
FEATURES: | ||
- **New Ephemeral Resource**: azapi_resource_action | ||
|
||
## v2.2.0 | ||
|
||
ENHANCEMENTS: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,6 @@ terraform { | |
} | ||
provider "azapi" { | ||
enable_hcl_output_for_data_source = true | ||
} | ||
provider "azurerm" { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,6 @@ terraform { | |
} | ||
provider "azapi" { | ||
enable_hcl_output_for_data_source = true | ||
} | ||
provider "azurerm" { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "azapi_resource_action Ephemeral Resource - terraform-provider-azapi" | ||
subcategory: "" | ||
description: |- | ||
Performs an action on an existing Azure resource. | ||
--- | ||
|
||
# azapi_resource_action (Ephemeral Resource) | ||
|
||
Performs an action on an existing Azure resource. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
terraform { | ||
required_providers { | ||
azapi = { | ||
source = "Azure/azapi" | ||
} | ||
} | ||
} | ||
provider "azapi" { | ||
} | ||
resource "azapi_resource" "resourceGroup" { | ||
type = "Microsoft.Resources/resourceGroups@2021-04-01" | ||
name = "example-rg" | ||
location = "westus" | ||
body = {} | ||
} | ||
resource "azapi_resource" "storageAccount" { | ||
type = "Microsoft.Storage/storageAccounts@2021-02-01" | ||
parent_id = azapi_resource.resourceGroup.id | ||
name = "exampleaccount" | ||
location = "westus" | ||
body = { | ||
kind = "StorageV2" | ||
sku = { | ||
name = "Premium_LRS" | ||
} | ||
} | ||
} | ||
ephemeral "azapi_resource_action" "listKeys" { | ||
type = "Microsoft.Storage/storageAccounts@2023-05-01" | ||
resource_id = azapi_resource.storageAccount.id | ||
action = "listKeys" | ||
method = "POST" | ||
response_export_values = { | ||
all = "@" | ||
} | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `resource_id` (String) The ID of an existing Azure source. | ||
- `type` (String) In a format like `<resource-type>@<api-version>`. `<resource-type>` is the Azure resource type, for example, `Microsoft.Storage/storageAccounts`. `<api-version>` is version of the API used to manage this azure resource. | ||
|
||
### Optional | ||
|
||
- `action` (String) The name of the resource action. It's also possible to make HTTP requests towards the resource ID if leave this field empty. | ||
- `body` (Dynamic) A dynamic attribute that contains the request body. | ||
- `headers` (Map of String) A map of headers to include in the request | ||
- `locks` (List of String) A list of ARM resource IDs which are used to avoid create/modify/delete azapi resources at the same time. | ||
- `method` (String) Specifies the HTTP method of the azure resource action. Allowed values are `POST`, `PATCH`, `PUT` and `DELETE`. Defaults to `POST`. | ||
- `query_parameters` (Map of List of String) A map of query parameters to include in the request | ||
- `response_export_values` (Dynamic) The attribute can accept either a list or a map. | ||
|
||
- **List**: A list of paths that need to be exported from the response body. Setting it to `["*"]` will export the full response body. Here's an example. If it sets to `["properties.loginServer", "properties.policies.quarantinePolicy.status"]`, it will set the following HCL object to the computed property output. | ||
|
||
```text | ||
{ | ||
properties = { | ||
loginServer = "registry1.azurecr.io" | ||
policies = { | ||
quarantinePolicy = { | ||
status = "disabled" | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
- **Map**: A map where the key is the name for the result and the value is a JMESPath query string to filter the response. Here's an example. If it sets to `{"login_server": "properties.loginServer", "quarantine_status": "properties.policies.quarantinePolicy.status"}`, it will set the following HCL object to the computed property output. | ||
|
||
```text | ||
{ | ||
"login_server" = "registry1.azurecr.io" | ||
"quarantine_status" = "disabled" | ||
} | ||
``` | ||
|
||
To learn more about JMESPath, visit [JMESPath](https://jmespath.org/). | ||
- `retry` (Attributes) The retry block supports the following arguments: (see [below for nested schema](#nestedatt--retry)) | ||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of the Azure resource. | ||
- `output` (Dynamic) The output HCL object containing the properties specified in `response_export_values`. Here are some examples to use the values. | ||
|
||
```terraform | ||
// it will output "registry1.azurecr.io" | ||
output "login_server" { | ||
value = ephemeral.azapi_resource_action.example.output.properties.loginServer | ||
} | ||
|
||
// it will output "disabled" | ||
output "quarantine_policy" { | ||
value = ephemeral.azapi_resource_action.example.output.properties.policies.quarantinePolicy.status | ||
} | ||
``` | ||
|
||
<a id="nestedatt--retry"></a> | ||
### Nested Schema for `retry` | ||
|
||
Required: | ||
|
||
- `error_message_regex` (List of String) A list of regular expressions to match against error messages. If any of the regular expressions match, the error is considered retryable. | ||
|
||
Optional: | ||
|
||
- `interval_seconds` (Number) The base number of seconds to wait between retries. Default is `10`. | ||
- `max_interval_seconds` (Number) The maximum number of seconds to wait between retries. Default is `180`. | ||
- `multiplier` (Number) The multiplier to apply to the interval between retries. Default is `1.5`. | ||
- `randomization_factor` (Number) The randomization factor to apply to the interval between retries. The formula for the randomized interval is: `RetryInterval * (random value in range [1 - RandomizationFactor, 1 + RandomizationFactor])`. Therefore set to zero `0.0` for no randomization. Default is `0.5`. | ||
|
||
|
||
<a id="nestedblock--timeouts"></a> | ||
### Nested Schema for `timeouts` | ||
|
||
Optional: | ||
|
||
- `read` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Read operations occur during any refresh or planning operation when refresh is enabled. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,6 @@ terraform { | |
} | ||
|
||
provider "azapi" { | ||
enable_hcl_output_for_data_source = true | ||
} | ||
|
||
provider "azurerm" { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,6 @@ terraform { | |
} | ||
|
||
provider "azapi" { | ||
enable_hcl_output_for_data_source = true | ||
} | ||
|
||
provider "azurerm" { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
examples/ephemeral-resources/azapi_resource_action/ephemeral-resource.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
terraform { | ||
required_providers { | ||
azapi = { | ||
source = "Azure/azapi" | ||
} | ||
} | ||
} | ||
|
||
provider "azapi" { | ||
} | ||
|
||
resource "azapi_resource" "resourceGroup" { | ||
type = "Microsoft.Resources/resourceGroups@2021-04-01" | ||
name = "example-rg" | ||
location = "westus" | ||
body = {} | ||
} | ||
|
||
resource "azapi_resource" "storageAccount" { | ||
type = "Microsoft.Storage/storageAccounts@2021-02-01" | ||
parent_id = azapi_resource.resourceGroup.id | ||
name = "exampleaccount" | ||
location = "westus" | ||
body = { | ||
kind = "StorageV2" | ||
sku = { | ||
name = "Premium_LRS" | ||
} | ||
} | ||
} | ||
|
||
ephemeral "azapi_resource_action" "listKeys" { | ||
type = "Microsoft.Storage/storageAccounts@2023-05-01" | ||
resource_id = azapi_resource.storageAccount.id | ||
action = "listKeys" | ||
method = "POST" | ||
response_export_values = { | ||
all = "@" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.