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_hdinsight_cluster. Closes #388 #395

Merged
merged 1 commit into from
Oct 7, 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_hdinsight_cluster/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.region.value }}",
"resource_group": "{{ resourceName }}",
"subscription_id": "{{ output.subscription_id.value }}",
"type": "Microsoft.HDInsight/clusters"
}
]
3 changes: 3 additions & 0 deletions azure-test/tests/azure_hdinsight_cluster/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_hdinsight_cluster
where name = '{{ resourceName }}' and resource_group = '{{ resourceName }}';
10 changes: 10 additions & 0 deletions azure-test/tests/azure_hdinsight_cluster/test-list-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.region.value }}",
"resource_group": "{{ resourceName }}",
"subscription_id": "{{ output.subscription_id.value }}",
"type": "Microsoft.HDInsight/clusters"
}
]
3 changes: 3 additions & 0 deletions azure-test/tests/azure_hdinsight_cluster/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
from azure.azure_hdinsight_cluster
where id = '{{ output.resource_id.value }}';
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, type, region
from azure.azure_hdinsight_cluster
where name = 'dummy-test{{ resourceName }}' and resource_group = '{{ resourceName }}';
10 changes: 10 additions & 0 deletions azure-test/tests/azure_hdinsight_cluster/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 }}"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
select name, akas, title
from azure.azure_hdinsight_cluster
where name = '{{ resourceName }}' and resource_group = '{{ resourceName }}';
1 change: 1 addition & 0 deletions azure-test/tests/azure_hdinsight_cluster/variables.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
126 changes: 126 additions & 0 deletions azure-test/tests/azure_hdinsight_cluster/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
variable "resource_name" {
type = string
default = "turbot-test-20211007-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.79.1"
}
}
}

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 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_storage_container" "named_test_resource" {
name = var.resource_name
storage_account_name = azurerm_storage_account.named_test_resource.name
container_access_type = "private"
}

resource "azurerm_hdinsight_hadoop_cluster" "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
cluster_version = "3.6"
tier = "Standard"

component_version {
hadoop = "2.7"
}

gateway {
enabled = true
username = "acctestusrgw"
password = "TerrAform123!"
}

storage_account {
storage_container_id = azurerm_storage_container.named_test_resource.id
storage_account_key = azurerm_storage_account.named_test_resource.primary_access_key
is_default = true
}

roles {
head_node {
vm_size = "Standard_D3_V2"
username = "acctestusrvm"
password = "AccTestvdSC4daf986!"
}

worker_node {
vm_size = "Standard_D4_V2"
username = "acctestusrvm"
password = "AccTestvdSC4daf986!"
target_instance_count = 3
}

zookeeper_node {
vm_size = "Standard_D3_V2"
username = "acctestusrvm"
password = "AccTestvdSC4daf986!"
}
}
}

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

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

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

output "resource_name" {
value = var.resource_name
}

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

output "subscription_id" {
value = var.azure_subscription
}

output "cluster_version" {
value = azurerm_hdinsight_hadoop_cluster.named_test_resource.cluster_version
}
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_express_route_circuit": tableAzureExpressRouteCircuit(ctx),
"azure_firewall": tableAzureFirewall(ctx),
"azure_frontdoor": tableAzureFrontDoor(ctx),
"azure_hdinsight_cluster": tableAzureHDInsightCluster(ctx),
"azure_healthcare_service": tableAzureHealthcareService(ctx),
"azure_hpc_cache": tableAzureHPCCache(ctx),
"azure_hybrid_compute_machine": tableAzureHybridComputeMachine(ctx),
Expand Down
Loading