Skip to content

Commit

Permalink
Add table azure_hpc_cache. Closes #320 (#374)
Browse files Browse the repository at this point in the history
  • Loading branch information
c0d3r-arnab authored Oct 5, 2021
1 parent b3f45a1 commit 1cabbac
Show file tree
Hide file tree
Showing 15 changed files with 494 additions and 2 deletions.
Empty file.
11 changes: 11 additions & 0 deletions azure-test/tests/azure_hpc_cache/test-get-expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"id": "{{ output.resource_id.value }}",
"name": "{{ resourceName }}",
"region": "{{ output.region.value }}",
"resource_group": "{{ resourceName }}",
"sku_name": "{{ output.sku_name.value }}",
"subscription_id": "{{ output.subscription_id.value }}",
"type": "Microsoft.StorageCache/caches"
}
]
3 changes: 3 additions & 0 deletions azure-test/tests/azure_hpc_cache/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, sku_name
from azure.azure_hpc_cache
where name = '{{ resourceName }}' and resource_group = '{{ resourceName }}';
11 changes: 11 additions & 0 deletions azure-test/tests/azure_hpc_cache/test-list-expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"id": "{{ output.resource_id_upper.value }}",
"name": "{{ resourceName }}",
"region": "{{ output.region.value }}",
"resource_group": "{{ resourceName }}",
"sku_name": "{{ output.sku_name.value }}",
"subscription_id": "{{ output.subscription_id.value }}",
"type": "Microsoft.StorageCache/caches"
}
]
3 changes: 3 additions & 0 deletions azure-test/tests/azure_hpc_cache/test-list-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, sku_name
from azure.azure_hpc_cache
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_hpc_cache/test-not-found-query.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
select name, id, type, region
from azure.azure_hpc_cache
where name = 'dummy-test{{ resourceName }}' and resource_group = '{{ resourceName }}';
10 changes: 10 additions & 0 deletions azure-test/tests/azure_hpc_cache/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_hpc_cache/test-turbot-query.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
select name, akas, title
from azure.azure_hpc_cache
where name = '{{ resourceName }}' and resource_group = '{{ resourceName }}';
1 change: 1 addition & 0 deletions azure-test/tests/azure_hpc_cache/variables.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
94 changes: 94 additions & 0 deletions azure-test/tests/azure_hpc_cache/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
variable "resource_name" {
type = string
default = "turbot-test-20201001-create-update"
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 environment used for the test."
}

terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=2.78.0"
}
}
}

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

resource "azurerm_resource_group" "named_test_resource" {
name = var.resource_name
location = "West Europe"
}

resource "azurerm_virtual_network" "named_test_resource" {
name = var.resource_name
address_space = ["10.0.0.0/16"]
location = azurerm_resource_group.named_test_resource.location
resource_group_name = azurerm_resource_group.named_test_resource.name
}

resource "azurerm_subnet" "named_test_resource" {
name = var.resource_name
resource_group_name = azurerm_resource_group.named_test_resource.name
virtual_network_name = azurerm_virtual_network.named_test_resource.name
address_prefixes = ["10.0.1.0/24"]
}

resource "azurerm_hpc_cache" "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
cache_size_in_gb = 3072
subnet_id = azurerm_subnet.named_test_resource.id
sku_name = "Standard_2G"
}

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

output "resource_aka" {
depends_on = [azurerm_hpc_cache.named_test_resource]
value = "azure://${azurerm_hpc_cache.named_test_resource.id}"
}

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

output "resource_name" {
value = var.resource_name
}

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

output "resource_id_upper" {
value = "/subscriptions/${var.azure_subscription}/resourceGroups/${upper(var.resource_name)}/providers/Microsoft.StorageCache/caches/${var.resource_name}"
}

output "subscription_id" {
value = var.azure_subscription
}

output "sku_name" {
value = azurerm_hpc_cache.named_test_resource.sku_name
}
1 change: 1 addition & 0 deletions azure/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func Plugin(ctx context.Context) *plugin.Plugin {
"azure_firewall": tableAzureFirewall(ctx),
"azure_frontdoor": tableAzureFrontDoor(ctx),
"azure_healthcare_service": tableAzureHealthcareService(ctx),
"azure_hpc_cache": tableAzureHPCCache(ctx),
"azure_iothub": tableAzureIotHub(ctx),
"azure_iothub_dps": tableAzureIotHubDps(ctx),
"azure_key_vault": tableAzureKeyVault(ctx),
Expand Down
Loading

0 comments on commit 1cabbac

Please sign in to comment.