Skip to content

Commit

Permalink
Add new Compute VM pipelines, update param descriptions, and update o…
Browse files Browse the repository at this point in the history
…utput for composite mod (#5)
  • Loading branch information
vkumbha authored Nov 20, 2023
1 parent cca6912 commit 4e7f277
Show file tree
Hide file tree
Showing 46 changed files with 242 additions and 167 deletions.
1 change: 1 addition & 0 deletions flowpipe.pvars.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ tenant_id="YourTenantID"
client_secret="YourClientSecret"
client_id="YourClientID"
subscription_id="SubscriptionID"
resource_group="ResourceGroupName"
1 change: 1 addition & 0 deletions locals.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ locals {
client_secret_param_description = "A client secret that was generated for the App Registration."
client_id_param_description = "The client (application) ID of an App Registration in the tenant."
subscription_id_param_description = "Azure Subscription Id. Examples: d46d7416-f95f-4771-bbb5-529d4c766."
resource_group_param_description = "Azure Resource Group. Examples: my-rg, my-rg-123."
}
6 changes: 2 additions & 4 deletions pipelines/compute/attach_compute_disk.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pipeline "attach_compute_disk" {

param "subscription_id" {
type = string
description = "Azure Subscription Id."
description = local.subscription_id_param_description
default = var.subscription_id
# TODO: Add once supported
#sensitive = true
Expand Down Expand Up @@ -36,10 +36,8 @@ pipeline "attach_compute_disk" {

param "resource_group" {
type = string
description = "Azure Resource Group."
description = local.resource_group_param_description
default = var.resource_group
# TODO: Add once supported
#sensitive = true
}

param "vm_name" {
Expand Down
6 changes: 2 additions & 4 deletions pipelines/compute/create_compute_virtual_machine.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,16 @@ pipeline "create_compute_virtual_machine" {

param "subscription_id" {
type = string
description = "Azure Subscription Id."
description = local.subscription_id_param_description
default = var.subscription_id
# TODO: Add once supported
#sensitive = true
}

param "resource_group" {
type = string
description = "Azure Resource Group."
description = local.resource_group_param_description
default = var.resource_group
# TODO: Add once supported
#sensitive = true
}

param "vm_name" {
Expand Down
10 changes: 5 additions & 5 deletions pipelines/compute/deallocate_compute_virtual_machine.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@ pipeline "deallocate_compute_virtual_machine" {

param "subscription_id" {
type = string
description = "Azure Subscription Id."
description = local.subscription_id_param_description
default = var.subscription_id
# TODO: Add once supported
#sensitive = true
}

param "resource_group" {
type = string
description = "Azure Resource Group."
description = local.resource_group_param_description
default = var.resource_group
# TODO: Add once supported
#sensitive = true
}

param "vm_name" {
Expand Down Expand Up @@ -60,7 +58,9 @@ pipeline "deallocate_compute_virtual_machine" {

output "stdout" {
description = "The standard output stream from the Azure CLI."
value = jsondecode(step.container.deallocate_compute_virtual_machine.stdout)
# When the VM is deallocated, the standard output (stdout) becomes an empty string.
# Therefore, this situation deviates from the usual practice of utilizing jsondecode.
value = step.container.deallocate_compute_virtual_machine.stdout
}

output "stderr" {
Expand Down
6 changes: 2 additions & 4 deletions pipelines/compute/delete_compute_disk.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pipeline "delete_compute_disk" {

param "subscription_id" {
type = string
description = "Azure Subscription Id."
description = local.subscription_id_param_description
default = var.subscription_id
# TODO: Add once supported
#sensitive = true
Expand Down Expand Up @@ -36,10 +36,8 @@ pipeline "delete_compute_disk" {

param "resource_group" {
type = string
description = "Azure Resource Group."
description = local.resource_group_param_description
default = var.resource_group
# TODO: Add once supported
#sensitive = true
}

param "disk_name" {
Expand Down
10 changes: 5 additions & 5 deletions pipelines/compute/delete_compute_virtual_machine.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@ pipeline "delete_compute_virtual_machine" {

param "subscription_id" {
type = string
description = "Azure Subscription Id."
description = local.subscription_id_param_description
default = var.subscription_id
# TODO: Add once supported
#sensitive = true
}

param "resource_group" {
type = string
description = "Azure Resource Group."
description = local.resource_group_param_description
default = var.resource_group
# TODO: Add once supported
#sensitive = true
}

param "vm_name" {
Expand Down Expand Up @@ -60,7 +58,9 @@ pipeline "delete_compute_virtual_machine" {

output "stdout" {
description = "The standard output stream from the Azure CLI."
value = jsondecode(step.container.delete_compute_virtual_machine.stdout)
# When the VM is deleted, the standard output (stdout) becomes an empty string.
# Therefore, this situation deviates from the usual practice of utilizing jsondecode.
value = step.container.delete_compute_virtual_machine.stdout
}

output "stderr" {
Expand Down
6 changes: 2 additions & 4 deletions pipelines/compute/detach_compute_disk.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pipeline "detach_compute_disk" {

param "subscription_id" {
type = string
description = "Azure Subscription Id."
description = local.subscription_id_param_description
default = var.subscription_id
# TODO: Add once supported
#sensitive = true
Expand Down Expand Up @@ -36,10 +36,8 @@ pipeline "detach_compute_disk" {

param "resource_group" {
type = string
description = "Azure Resource Group."
description = local.resource_group_param_description
default = var.resource_group
# TODO: Add once supported
#sensitive = true
}

param "vm_name" {
Expand Down
6 changes: 2 additions & 4 deletions pipelines/compute/get_compute_disk.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pipeline "get_compute_disk" {

param "subscription_id" {
type = string
description = "Azure Subscription Id."
description = local.subscription_id_param_description
default = var.subscription_id
# TODO: Add once supported
#sensitive = true
Expand Down Expand Up @@ -36,10 +36,8 @@ pipeline "get_compute_disk" {

param "resource_group" {
type = string
description = "Azure Resource Group."
description = local.resource_group_param_description
default = var.resource_group
# TODO: Add once supported
#sensitive = true
}

param "disk_name" {
Expand Down
6 changes: 2 additions & 4 deletions pipelines/compute/get_compute_virtual_machine.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@ pipeline "get_compute_virtual_machine" {

param "subscription_id" {
type = string
description = "Azure Subscription Id."
description = local.subscription_id_param_description
default = var.subscription_id
# TODO: Add once supported
#sensitive = true
}

param "resource_group" {
type = string
description = "Azure Resource Group."
description = local.resource_group_param_description
default = var.resource_group
# TODO: Add once supported
#sensitive = true
}

param "vm_name" {
Expand Down
77 changes: 77 additions & 0 deletions pipelines/compute/get_compute_virtual_machine_instance_view.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
pipeline "get_compute_virtual_machine_instance_view" {
title = "Get Compute Virtual Machine Instance View"
description = "Get the instance view of a compute virtual machine."

param "subscription_id" {
type = string
description = local.subscription_id_param_description
default = var.subscription_id
# TODO: Add once supported
#sensitive = true
}

param "resource_group" {
type = string
description = local.resource_group_param_description
default = var.resource_group
}

param "vm_name" {
type = string
description = "The name of the Virtual Machine."
}

param "tenant_id" {
type = string
description = local.tenant_id_param_description
default = var.tenant_id
# TODO: Add once supported
#sensitive = true
}

param "client_secret" {
type = string
description = local.client_secret_param_description
default = var.client_secret
# TODO: Add once supported
#sensitive = true
}

param "client_id" {
type = string
description = local.client_id_param_description
default = var.client_id
# TODO: Add once supported
#sensitive = true
}

param "query" {
type = string
description = "A JMESPath query to use in filtering the response data."
optional = true
}

step "container" "get_compute_virtual_machine_instance_view" {
image = "my-azure-image"
cmd = concat(
["vm", "get-instance-view", "--name", param.vm_name, "-g", param.resource_group, "--subscription", param.subscription_id],
param.query != null ? ["--query", param.query] : [],
)

env = {
AZURE_TENANT_ID = param.tenant_id
AZURE_CLIENT_ID = param.client_id
AZURE_CLIENT_SECRET = param.client_secret
}
}

output "stdout" {
description = "The standard output stream from the Azure CLI."
value = jsondecode(step.container.get_compute_virtual_machine_instance_view.stdout)
}

output "stderr" {
description = "The standard error stream from the Azure CLI."
value = step.container.get_compute_virtual_machine_instance_view.stderr
}
}
72 changes: 72 additions & 0 deletions pipelines/compute/list_compute_virtual_machines.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
pipeline "list_compute_virtual_machines" {
title = "List Compute Virtual Machines"
description = "List Compute Virtual Machines."

param "subscription_id" {
type = string
description = local.subscription_id_param_description
default = var.subscription_id
# TODO: Add once supported
#sensitive = true
}

param "resource_group" {
type = string
description = local.resource_group_param_description
default = var.resource_group
}

param "tenant_id" {
type = string
description = local.tenant_id_param_description
default = var.tenant_id
# TODO: Add once supported
#sensitive = true
}

param "client_secret" {
type = string
description = local.client_secret_param_description
default = var.client_secret
# TODO: Add once supported
#sensitive = true
}

param "client_id" {
type = string
description = local.client_id_param_description
default = var.client_id
# TODO: Add once supported
#sensitive = true
}

param "query" {
type = string
description = "A JMESPath query to use in filtering the response data."
optional = true
}

step "container" "list_compute_virtual_machines" {
image = "my-azure-image"
cmd = concat(
["vm", "list", "-g", param.resource_group, "--subscription", param.subscription_id],
param.query != null ? ["--query", param.query] : [],
)

env = {
AZURE_TENANT_ID = param.tenant_id
AZURE_CLIENT_ID = param.client_id
AZURE_CLIENT_SECRET = param.client_secret
}
}

output "stdout" {
description = "The standard output stream from the Azure CLI."
value = jsondecode(step.container.list_compute_virtual_machines.stdout)
}

output "stderr" {
description = "The standard error stream from the Azure CLI."
value = step.container.list_compute_virtual_machines.stderr
}
}
6 changes: 2 additions & 4 deletions pipelines/compute/start_compute_virtual_machine.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,16 @@ pipeline "start_compute_virtual_machine" {

param "subscription_id" {
type = string
description = "Azure Subscription Id."
description = local.subscription_id_param_description
default = var.subscription_id
# TODO: Add once supported
#sensitive = true
}

param "resource_group" {
type = string
description = "Azure Resource Group."
description = local.resource_group_param_description
default = var.resource_group
# TODO: Add once supported
#sensitive = true
}

param "vm_name" {
Expand Down
6 changes: 2 additions & 4 deletions pipelines/compute/stop_compute_virtual_machine.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,16 @@ pipeline "stop_compute_virtual_machine" {

param "subscription_id" {
type = string
description = "Azure Subscription Id."
description = local.subscription_id_param_description
default = var.subscription_id
# TODO: Add once supported
#sensitive = true
}

param "resource_group" {
type = string
description = "Azure Resource Group."
description = local.resource_group_param_description
default = var.resource_group
# TODO: Add once supported
#sensitive = true
}

param "vm_name" {
Expand Down
Loading

0 comments on commit 4e7f277

Please sign in to comment.