Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add table azure_batch_account. Closes #222 #242

Merged
merged 8 commits into from
Aug 11, 2021
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
Empty file.
10 changes: 10 additions & 0 deletions azure-test/tests/azure_batch_account/test-get-expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"id": "{{ output.resource_id.value }}",
"name": "{{ resourceName }}",
"region": "{{ output.location.value }}",
"resource_group": "{{ resourceName }}",
"subscription_id": "{{ output.subscription_id.value }}",
"type": "Microsoft.Batch/batchAccounts"
}
]
3 changes: 3 additions & 0 deletions azure-test/tests/azure_batch_account/test-get-query.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
select name, id, type, region, resource_group, subscription_id
from azure.azure_batch_account
where name = '{{ resourceName }}' and resource_group = '{{ resourceName }}';
7 changes: 7 additions & 0 deletions azure-test/tests/azure_batch_account/test-list-expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"id": "{{ output.resource_id.value }}",
"name": "{{ resourceName }}",
"type": "Microsoft.Batch/batchAccounts"
}
]
3 changes: 3 additions & 0 deletions azure-test/tests/azure_batch_account/test-list-query.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
select name, id, type
from azure.azure_batch_account
where name = '{{ resourceName }}';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
null
3 changes: 3 additions & 0 deletions azure-test/tests/azure_batch_account/test-not-found-query.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
select name, tags, title, akas
from azure.azure_batch_account
where name = 'dummy-{{ resourceName }}' and resource_group = '{{ resourceName }}';
10 changes: 10 additions & 0 deletions azure-test/tests/azure_batch_account/test-turbot-expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"akas": [
"{{ output.resource_aka.value }}",
"{{ output.resource_aka_lower.value }}"
],
"name": "{{ resourceName }}",
"title": "{{ resourceName }}"
}
]
3 changes: 3 additions & 0 deletions azure-test/tests/azure_batch_account/test-turbot-query.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
select name, title, akas
from azure.azure_batch_account
where name = '{{ resourceName }}' and resource_group = '{{ resourceName }}';
1 change: 1 addition & 0 deletions azure-test/tests/azure_batch_account/variables.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
77 changes: 77 additions & 0 deletions azure-test/tests/azure_batch_account/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
variable "resource_name" {
type = string
default = "steampipe-test"
description = "Name of the resource used throughout the test."
}

variable "azure_environment" {
type = string
default = "public"
description = "Azure environment used for the test."
}

variable "azure_subscription" {
type = string
default = "3510ae4d-530b-497d-8f30-53b9616fc6c1"
description = "Azure subscription used for the test."
}

provider "azurerm" {
# Cannot be passed as a variable
version = "=1.36.0"
environment = var.azure_environment
subscription_id = var.azure_subscription
}

data "azurerm_client_config" "current" {}

data "null_data_source" "resource" {
inputs = {
scope = "azure:///subscriptions/${data.azurerm_client_config.current.subscription_id}"
}
}

resource "azurerm_resource_group" "named_test_resource" {
name = var.resource_name
location = "East US"
}

resource "azurerm_storage_account" "named_test_resource" {
name = var.resource_name
resource_group_name = azurerm_resource_group.named_test_resource.name
location = azurerm_resource_group.named_test_resource.location
account_tier = "Standard"
account_replication_type = "LRS"
}

resource "azurerm_batch_account" "named_test_resource" {
name = var.resource_name
resource_group_name = azurerm_resource_group.named_test_resource.name
location = azurerm_resource_group.named_test_resource.location
pool_allocation_mode = "BatchService"
storage_account_id = azurerm_storage_account.named_test_resource.id
}

output "resource_aka" {
value = "azure://${azurerm_batch_account.named_test_resource.id}"
}

output "resource_aka_lower" {
value = "azure://${lower(azurerm_batch_account.named_test_resource.id)}"
}

output "resource_name" {
value = var.resource_name
}

output "resource_id" {
value = azurerm_batch_account.named_test_resource.id
}

output "location" {
value = azurerm_resource_group.named_test_resource.location
}

output "subscription_id" {
value = var.azure_subscription
}
1 change: 1 addition & 0 deletions azure/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func Plugin(ctx context.Context) *plugin.Plugin {
"azure_app_service_plan": tableAzureAppServicePlan(ctx),
"azure_app_service_web_app": tableAzureAppServiceWebApp(ctx),
"azure_application_security_group": tableAzureApplicationSecurityGroup(ctx),
"azure_batch_account": tableAzureBatchAccount(ctx),
"azure_compute_availability_set": tableAzureComputeAvailabilitySet(ctx),
"azure_compute_disk": tableAzureComputeDisk(ctx),
"azure_compute_disk_encryption_set": tableAzureComputeDiskEncryptionSet(ctx),
Expand Down
Loading