Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ All code contributions made by Lacework customers to this repo are considered
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | ~> 4.37 |
| <a name="provider_lacework"></a> [lacework](#provider\_lacework) | ~> 2.0 |
| <a name="provider_random"></a> [random](#provider\_random) | n/a |
| <a name="provider_terraform"></a> [terraform](#provider\_terraform) | n/a |
| <a name="provider_time"></a> [time](#provider\_time) | n/a |

## Modules
Expand All @@ -60,6 +59,7 @@ No modules.
| Name | Type |
|------|------|
| [azapi_resource.container_app_job_agentless](https://registry.terraform.io/providers/Azure/azapi/latest/docs/resources/resource) | resource |
| [azapi_resource_action.job_execution_now](https://registry.terraform.io/providers/Azure/azapi/latest/docs/resources/resource_action) | resource |
| [azuread_application.lw](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/resources/application) | resource |
| [azuread_service_principal.data_loader](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/resources/service_principal) | resource |
| [azuread_service_principal_password.data_loader](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/resources/service_principal_password) | resource |
Expand Down Expand Up @@ -91,7 +91,6 @@ No modules.
| [azurerm_virtual_network.agentless_orchestrate](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_network) | resource |
| [lacework_integration_azure_agentless_scanning.lacework_cloud_account](https://registry.terraform.io/providers/lacework/lacework/latest/docs/resources/integration_azure_agentless_scanning) | resource |
| [random_id.uniq](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/id) | resource |
| [terraform_data.job_execution_now](https://registry.terraform.io/providers/hashicorp/terraform/latest/docs/resources/data) | resource |
| [time_sleep.wait_for_role_assignment_propagation](https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep) | resource |
| [azurerm_client_config.current](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/client_config) | data source |
| [azurerm_resource_group.scanning_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/resource_group) | data source |
Expand Down
20 changes: 11 additions & 9 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -625,16 +625,18 @@ resource "azapi_resource" "container_app_job_agentless" {
}

# Trigger execution, if requested
resource "terraform_data" "job_execution_now" {
count = var.execute_now && var.regional ? 1 : 0
resource "azapi_resource_action" "job_execution_now" {
count = var.execute_now && var.regional ? 1 : 0
type = "Microsoft.App/jobs@2023-05-01"
resource_id = azapi_resource.container_app_job_agentless[0].id
action = "start"
method = "POST"
response_export_values = ["*"]

provisioner "local-exec" {
command = "az containerapp job start --name ${azapi_resource.container_app_job_agentless[0].name} --resource-group ${local.scanning_resource_group_name}"
}

triggers_replace = {
always_run = timestamp()
}
Comment on lines -635 to -637
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lokesh-vadlamudi

This trigger_replace block ensures that this resource is always replaced on every terraform apply — i.e., this call is made during every terraform apply and the job will always execute immediately when terraform apply is run.

I don't see anything in the new code that would maintain this behavior. Can you please confirm that the behavior is maintained? If so, can you please also update the testing section in your PR description?

body = jsonencode({
# Add a dynamic field to force re-creation on every apply
trigger = timestamp()
})

depends_on = [azapi_resource.container_app_job_agentless]
}
Expand Down