Skip to content

Commit

Permalink
Add table azure_compute_virtual_machine_scale_set. Closes turbot#190 (t…
Browse files Browse the repository at this point in the history
  • Loading branch information
ParthaI authored Aug 12, 2021
1 parent 61c11a5 commit f052375
Show file tree
Hide file tree
Showing 15 changed files with 584 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"id": "{{ output.resource_id.value }}",
"name": "{{ resourceName }}",
"sku_name": "Standard_F2",
"sku_tier": "Standard",
"tags": {
"Name": "{{ resourceName }}"
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
select name, id, sku_tier, sku_name, tags
from azure.azure_compute_virtual_machine_scale_set
where name = '{{resourceName}}' and resource_group = '{{resourceName}}';
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"id": "{{ output.resource_id.value }}",
"name": "{{ resourceName }}",
"type": "Microsoft.Compute/virtualMachineScaleSets"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
select name, id, type
from azure.azure_compute_virtual_machine_scale_set
where name = '{{resourceName}}' and resource_group = '{{resourceName}}';
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
{
"id": "{{ output.resource_id.value }}",
"name": "{{ resourceName }}"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
select name, id
from azure.azure_compute_virtual_machine_scale_set
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
from azure.azure_compute_virtual_machine_scale_set
where name = 'dummy{{ resourceName }}' and resource_group = '{{ resourceName }}';
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"akas": [
"{{ output.resource_aka.value }}",
"{{ output.resource_aka_lower.value }}"
],
"tags": {
"Name": "{{ resourceName }}"
},
"title": "{{ resourceName }}"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
select title, akas, tags
from azure.azure_compute_virtual_machine_scale_set
where name = '{{ resourceName }}' and resource_group = '{{ resourceName }}';
170 changes: 170 additions & 0 deletions azure-test/tests/azure_compute_virtual_machine_scale_set/varable.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@

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 = "=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_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_prefix = "10.0.2.0/24"
}

resource "azurerm_public_ip" "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
allocation_method = "Static"
domain_name_label = azurerm_resource_group.named_test_resource.name

tags = {
Name = var.resource_name
}
}

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

frontend_ip_configuration {
name = "PublicIPAddress"
public_ip_address_id = azurerm_public_ip.named_test_resource.id
}
}

resource "azurerm_lb_backend_address_pool" "named_test_resource" {
resource_group_name = azurerm_resource_group.named_test_resource.name
loadbalancer_id = azurerm_lb.named_test_resource.id
name = var.resource_name
}

resource "azurerm_lb_nat_pool" "named_test_resource" {
resource_group_name = azurerm_resource_group.named_test_resource.name
name = "ssh"
loadbalancer_id = azurerm_lb.named_test_resource.id
protocol = "Tcp"
frontend_port_start = 50000
frontend_port_end = 50119
backend_port = 22
frontend_ip_configuration_name = "PublicIPAddress"
}

resource "azurerm_virtual_machine_scale_set" "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

upgrade_policy_mode = "Manual"

sku {
name = "Standard_F2"
tier = "Standard"
capacity = 2
}

storage_profile_image_reference {
publisher = "Canonical"
offer = "UbuntuServer"
sku = "16.04-LTS"
version = "latest"
}

storage_profile_os_disk {
name = ""
caching = "ReadWrite"
create_option = "FromImage"
managed_disk_type = "Standard_LRS"
}

storage_profile_data_disk {
lun = 0
caching = "ReadWrite"
create_option = "Empty"
disk_size_gb = 10
}

os_profile {
computer_name_prefix = "testvm"
admin_username = "myadmin"
admin_password = "AdminPassword@123"
}

os_profile_linux_config {
disable_password_authentication = false
}

network_profile {
name = "terraformnetworkprofile"
primary = true

ip_configuration {
name = "TestIPConfiguration"
primary = true
subnet_id = azurerm_subnet.named_test_resource.id
load_balancer_backend_address_pool_ids = [azurerm_lb_backend_address_pool.named_test_resource.id]
load_balancer_inbound_nat_rules_ids = [azurerm_lb_nat_pool.named_test_resource.id]
}
}

tags = {
Name = var.resource_name
}
}

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

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

output "resource_name" {
value = var.resource_name
}

output "resource_id" {
value = azurerm_virtual_machine_scale_set.named_test_resource.id
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions azure/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func Plugin(ctx context.Context) *plugin.Plugin {
"azure_compute_virtual_machine_metric_cpu_utilization": tableAzureComputeVirtualMachineMetricCpuUtilization(ctx),
"azure_compute_virtual_machine_metric_cpu_utilization_daily": tableAzureComputeVirtualMachineMetricCpuUtilizationDaily(ctx),
"azure_compute_virtual_machine_metric_cpu_utilization_hourly": tableAzureComputeVirtualMachineMetricCpuUtilizationHourly(ctx),
"azure_compute_virtual_machine_scale_set": tableAzureComputeVirtualMachineScaleSet(ctx),
"azure_container_registry": tableAzureContainerRegistry(ctx),
"azure_cosmosdb_account": tableAzureCosmosDBAccount(ctx),
"azure_cosmosdb_mongo_database": tableAzureCosmosDBMongoDatabase(ctx),
Expand Down
Loading

0 comments on commit f052375

Please sign in to comment.