Reputation: 5
I was new to Terraform & I am encountering an issue while trying to provision an azurerm_log_analytics_linked_storage_account resource using Terraform in Azure. The error message I receive is:
Error: Argument or block definition required
│
│ on main.tf line 21, in resource "azurerm_log_analytics_linked_storage_account" "example":
│ 21: resource "azurerm_log_analytics_linked_storage_account" "example" {
│
The variables azurerm_resource_group.example, azurerm_log_analytics_workspace.example, and azurerm_storage_account.example are defined earlier in my configuration file and have been validated to contain the correct values.
Can someone please help me understand what might be causing this error and provide guidance on how to resolve it?
To create the azurerm_log_analytics_linked_storage_account in my azure cloud
Upvotes: 0
Views: 188
Reputation: 2331
I tried to provision the azurerm_log_analytics_linked_storage_account as a resource using Terraform I was able to provision the resource without facing any issues.
The error message you're encountering, "Error: Argument or block definition required," typically indicates that Terraform is expecting some required arguments or blocks to be defined within the azurerm_log_analytics_linked_storage_account
resource block in your Terraform configuration.
Since you mentioned in a query that you checked with the modules of azurerm_resource_group.example
, azurerm_log_analytics_workspace.example
, and azurerm_storage_account.example
the issue with the main module placeholders itself.
My terraform configuration:
resource "azurerm_resource_group" "example" {
name = "demorg-vk"
location = "EastUS"
}
resource "azurerm_storage_account" "example" {
name = "demosbvk"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
account_tier = "Standard"
account_replication_type = "GRS"
}
resource "azurerm_log_analytics_workspace" "example" {
name = "demoworkspacesbvk"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
sku = "PerGB2018"
}
resource "azurerm_log_analytics_linked_storage_account" "example" {
data_source_type = "CustomLogs"
resource_group_name = azurerm_resource_group.example.name
workspace_resource_id = azurerm_log_analytics_workspace.example.id
storage_account_ids = [azurerm_storage_account.example.id]
}
So make sure the code you're using for "azurerm_log_analytics_linked_storage_account"
matches with the parameters in your local.
Output:
Upvotes: 0