Skip to content

Commit

Permalink
Add table azure_lb. Closes #182 (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
c0d3r-arnab authored Aug 12, 2021
1 parent 31aa007 commit 56c4f34
Show file tree
Hide file tree
Showing 14 changed files with 432 additions and 0 deletions.
Empty file.
13 changes: 13 additions & 0 deletions azure-test/tests/azure_lb/test-get-expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
{
"id": "{{ output.resource_id.value }}",
"name": "{{ resourceName }}",
"region": "{{ output.region.value }}",
"resource_group": "{{ resourceName }}",
"subscription_id": "{{ output.subscription_id.value }}",
"tags": {
"name": "{{ resourceName }}"
},
"type": "Microsoft.Network/loadBalancers"
}
]
3 changes: 3 additions & 0 deletions azure-test/tests/azure_lb/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, tags
from azure.azure_lb
where name = '{{ resourceName }}' and resource_group = '{{ resourceName }}';
6 changes: 6 additions & 0 deletions azure-test/tests/azure_lb/test-list-expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
{
"id": "{{ output.resource_id.value }}",
"name": "{{ resourceName }}"
}
]
3 changes: 3 additions & 0 deletions azure-test/tests/azure_lb/test-list-query.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
select name, id
from azure.azure_lb
where name = '{{ resourceName }}';
1 change: 1 addition & 0 deletions azure-test/tests/azure_lb/test-not-found-expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
null
3 changes: 3 additions & 0 deletions azure-test/tests/azure_lb/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_lb
where name = 'dummy-test{{ resourceName }}' and resource_group = '{{ resourceName }}';
13 changes: 13 additions & 0 deletions azure-test/tests/azure_lb/test-turbot-expected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
{
"akas": [
"{{ output.resource_aka.value }}",
"{{ output.resource_aka_lower.value }}"
],
"name": "{{ resourceName }}",
"tags": {
"name": "{{ resourceName }}"
},
"title": "{{ resourceName }}"
}
]
3 changes: 3 additions & 0 deletions azure-test/tests/azure_lb/test-turbot-query.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
select name, akas, tags, title
from azure.azure_lb
where name = '{{ resourceName }}' and resource_group = '{{ resourceName }}';
1 change: 1 addition & 0 deletions azure-test/tests/azure_lb/variables.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
65 changes: 65 additions & 0 deletions azure-test/tests/azure_lb/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
variable "resource_name" {
type = string
default = "turbot-test-20200125-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-53c0616fc6c1"
description = "Azure environment 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 "azuread_client_config" "current" {}

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

resource "azurerm_lb" "named_test_resource" {
name = var.resource_name
location = azurerm_resource_group.named_test_resource.location
resource_group_name = azurerm_resource_group.named_test_resource.name
tags = {
name = var.resource_name
}
}

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

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

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

output "resource_name" {
value = var.resource_name
}

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

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 @@ -66,6 +66,7 @@ func Plugin(ctx context.Context) *plugin.Plugin {
"azure_key_vault_managed_hardware_security_module": tableAzureKeyVaultManagedHardwareSecurityModule(ctx),
"azure_key_vault_secret": tableAzureKeyVaultSecret(ctx),
"azure_kubernetes_cluster": tableAzureKubernetesCluster(ctx),
"azure_lb": tableAzureLoadBalancer(ctx),
"azure_location": tableAzureLocation(ctx),
"azure_log_alert": tableAzureLogAlert(ctx),
"azure_log_profile": tableAzureLogProfile(ctx),
Expand Down
Loading

0 comments on commit 56c4f34

Please sign in to comment.