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 tfsort to pre-commit hooks #16

Merged
merged 2 commits into from
Sep 20, 2024
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
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ repos:
hooks:
- id: terraform-docs-system
args: ["."]
- repo: local
hooks:
- id: tfsort
name: Sort Terraform variables
language: system
types: [terraform]
entry: bash -c 'for f in $@; do tfsort "$f"; done' --
files: ^variables|outputs\.tf$
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: "v1.92.0"
hooks:
Expand Down
106 changes: 53 additions & 53 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
output "admin_username" {
description = "The admin username of the virtual machine."
value = local.virtual_machine.admin_username
}

output "admin_password" {
description = "The admin password of the virtual machine."
value = local.admin_password
Expand All @@ -20,6 +15,11 @@ output "admin_ssh_public_key" {
value = local.admin_ssh_public_key
}

output "admin_username" {
description = "The admin username of the virtual machine."
value = local.virtual_machine.admin_username
}

output "data_disks" {
description = <<-EOT
A list of data disks attached to the virtual machine. Each list element is an map with the following keys:
Expand All @@ -45,54 +45,6 @@ output "id" {
description = "The ID of the virtual machine."
}

output "user_assigned_identity" {
description = <<-EOT
The primary user assigned identity of the virtual machine

Attributes:

Attribute | Description
-- | --
`client_id` | The client id in uuid format of the user assigned identity.
`id` | The resource id of the user assgined identity.
`name` | The name of the user assigned identity.
`principal_id` | The Principal ID of the user assigned identity.
`tenant_id` | The Tenant ID of the user assigned identity.
EOT

value = one([for resource in azurerm_user_assigned_identity.this : {
client_id = resource.client_id
id = resource.id
name = resource.name
principal_id = resource.principal_id
tenant_id = resource.tenant_id
}])
}

output "user_assigned_identity_ids" {
description = "A list of all user assigned identities of the virtual machine."

value = local.virtual_machine.identity[*].identity_ids
}

output "system_assigned_identity" {
description = <<-EOT
The primary user assigned identity of the virtual machine

Attributes:

Attribute | Description
-- | --
`principal_id` | The Principal ID of the system assigned identity.
`tenant_id` | The Tenant ID of the system assigned identity.
EOT

value = one([for identity in local.virtual_machine.identity : {
principal_id = identity.principal_id
tenant_id = identity.tenant_id
}])
}

output "image" {
value = local.image
}
Expand Down Expand Up @@ -141,6 +93,54 @@ output "public_ip_addresses" {
value = local.virtual_machine.public_ip_addresses
}

output "system_assigned_identity" {
description = <<-EOT
The primary user assigned identity of the virtual machine

Attributes:

Attribute | Description
-- | --
`principal_id` | The Principal ID of the system assigned identity.
`tenant_id` | The Tenant ID of the system assigned identity.
EOT

value = one([for identity in local.virtual_machine.identity : {
principal_id = identity.principal_id
tenant_id = identity.tenant_id
}])
}

output "user_assigned_identity" {
description = <<-EOT
The primary user assigned identity of the virtual machine

Attributes:

Attribute | Description
-- | --
`client_id` | The client id in uuid format of the user assigned identity.
`id` | The resource id of the user assgined identity.
`name` | The name of the user assigned identity.
`principal_id` | The Principal ID of the user assigned identity.
`tenant_id` | The Tenant ID of the user assigned identity.
EOT

value = one([for resource in azurerm_user_assigned_identity.this : {
client_id = resource.client_id
id = resource.id
name = resource.name
principal_id = resource.principal_id
tenant_id = resource.tenant_id
}])
}

output "user_assigned_identity_ids" {
description = "A list of all user assigned identities of the virtual machine."

value = local.virtual_machine.identity[*].identity_ids
}

output "virtual_machine_extensions" {
description = <<-EOT
A list of virtual machine extensions installed on this virtual machine by this module. Each list element is a map with the following attributes:
Expand Down