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_storage_share_file closes #455 #464

Merged
merged 4 commits into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"id": "{{ output.resource_id.value }}",
"name": "{{ resourceName }}",
"storage_account_name": "{{ resourceName }}"
}
]
3 changes: 3 additions & 0 deletions azure-test/tests/azure_storage_share_file/test-get-query.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
select name, id, storage_account_name
from azure_storage_share_file
where name = '{{resourceName}}' and resource_group = '{{resourceName}}' and storage_account_name = '{{resourceName}}';
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_storage_share_file/test-list-query.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
select name, id
from azure_storage_share_file
where name = '{{resourceName}}';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
null
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
select name, id
from azure_storage_share_file
where name = 'dummy{{resourceName}}' and resource_group = '{{resourceName}}';
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"akas": [
"{{ output.resource_aka.value }}",
"{{ output.resource_aka_lower.value }}"
],
"title": "{{ resourceName }}"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
select title, akas
from azure_storage_share_file
where name = '{{resourceName}}' and resource_group = '{{resourceName}}';
1 change: 1 addition & 0 deletions azure-test/tests/azure_storage_share_file/variables.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
80 changes: 80 additions & 0 deletions azure-test/tests/azure_storage_share_file/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@

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-53b9616fc6c1"
description = "Azure subscription used for the test."
}

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

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_kind = "StorageV2"
access_tier = "Cool"
account_replication_type = "LRS"

tags = {
name = var.resource_name
}
}

resource "azurerm_storage_share" "named_test_resource" {
name = var.resource_name
storage_account_name = azurerm_storage_account.named_test_resource.name
quota = 50
}

resource "azurerm_storage_share_file" "named_test_resource" {
name = var.resource_name
storage_share_id = azurerm_storage_share.named_test_resource.id
}

output "resource_aka" {
value = "azure:///subscriptions/${var.azure_subscription}/resourceGroups/${var.resource_name}/providers/Microsoft.Storage/storageAccounts/${var.resource_name}/fileServices/default/shares/${var.resource_name}"
}

output "resource_aka_lower" {
value = "azure:///subscriptions/${lower(var.azure_subscription)}/resourcegroups/${lower(var.resource_name)}/providers/microsoft.storage/storageaccounts/${lower(var.resource_name)}/fileservices/default/shares/${lower(var.resource_name)}"
}

output "resource_name" {
value = var.resource_name
}

output "resource_id" {
value = "/subscriptions/${var.azure_subscription}/resourceGroups/${var.resource_name}/providers/Microsoft.Storage/storageAccounts/${var.resource_name}/fileServices/default/shares/${var.resource_name}"
}
1 change: 1 addition & 0 deletions azure/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ func Plugin(ctx context.Context) *plugin.Plugin {
"azure_sql_database": tableAzureSqlDatabase(ctx),
"azure_sql_server": tableAzureSQLServer(ctx),
"azure_storage_account": tableAzureStorageAccount(ctx),
"azure_storage_share_file": tableAzureStorageShareFile(ctx),
"azure_storage_blob": tableAzureStorageBlob(ctx),
"azure_storage_blob_service": tableAzureStorageBlobService(ctx),
"azure_storage_container": tableAzureStorageContainer(ctx),
Expand Down
Loading