Skip to content

Commit 65bb2ae

Browse files
chore: replace local exec with azapi action
1 parent 3fa6ff1 commit 65bb2ae

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ All code contributions made by Lacework customers to this repo are considered
4848
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | ~> 4.37 |
4949
| <a name="provider_lacework"></a> [lacework](#provider\_lacework) | ~> 2.0 |
5050
| <a name="provider_random"></a> [random](#provider\_random) | n/a |
51-
| <a name="provider_terraform"></a> [terraform](#provider\_terraform) | n/a |
5251
| <a name="provider_time"></a> [time](#provider\_time) | n/a |
5352

5453
## Modules
@@ -60,6 +59,7 @@ No modules.
6059
| Name | Type |
6160
|------|------|
6261
| [azapi_resource.container_app_job_agentless](https://registry.terraform.io/providers/Azure/azapi/latest/docs/resources/resource) | resource |
62+
| [azapi_resource_action.job_execution_now](https://registry.terraform.io/providers/Azure/azapi/latest/docs/resources/resource_action) | resource |
6363
| [azuread_application.lw](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/resources/application) | resource |
6464
| [azuread_service_principal.data_loader](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/resources/service_principal) | resource |
6565
| [azuread_service_principal_password.data_loader](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/resources/service_principal_password) | resource |
@@ -91,7 +91,6 @@ No modules.
9191
| [azurerm_virtual_network.agentless_orchestrate](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_network) | resource |
9292
| [lacework_integration_azure_agentless_scanning.lacework_cloud_account](https://registry.terraform.io/providers/lacework/lacework/latest/docs/resources/integration_azure_agentless_scanning) | resource |
9393
| [random_id.uniq](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/id) | resource |
94-
| [terraform_data.job_execution_now](https://registry.terraform.io/providers/hashicorp/terraform/latest/docs/resources/data) | resource |
9594
| [time_sleep.wait_for_role_assignment_propagation](https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep) | resource |
9695
| [azurerm_client_config.current](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/client_config) | data source |
9796
| [azurerm_resource_group.scanning_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/resource_group) | data source |

main.tf

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -625,16 +625,13 @@ resource "azapi_resource" "container_app_job_agentless" {
625625
}
626626

627627
# Trigger execution, if requested
628-
resource "terraform_data" "job_execution_now" {
629-
count = var.execute_now && var.regional ? 1 : 0
630-
631-
provisioner "local-exec" {
632-
command = "az containerapp job start --name ${azapi_resource.container_app_job_agentless[0].name} --resource-group ${local.scanning_resource_group_name}"
633-
}
634-
635-
triggers_replace = {
636-
always_run = timestamp()
637-
}
628+
resource "azapi_resource_action" "job_execution_now" {
629+
count = var.execute_now && var.regional ? 1 : 0
630+
type = "Microsoft.App/jobs@2023-05-01"
631+
resource_id = azapi_resource.container_app_job_agentless[0].id
632+
action = "start"
633+
method = "POST"
634+
response_export_values = ["*"]
638635

639636
depends_on = [azapi_resource.container_app_job_agentless]
640637
}

0 commit comments

Comments
 (0)