Skip to content

Commit 4489df7

Browse files
authored
Merge pull request #1 from data-platform-hq/extension
feat: vm extention
2 parents 8231d87 + c712aca commit 4489df7

File tree

5 files changed

+102
-3
lines changed

5 files changed

+102
-3
lines changed

README.md

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,76 @@
1-
# Azure <> Terraform module
2-
Terraform module for creation Azure <>
1+
# Azure Vm Extension Terraform module
2+
Terraform module for creation Azure Vm Extension
3+
34

45
## Usage
6+
```hcl
7+
# Prerequisite resources
8+
9+
data "azurerm_virtual_machine" "example" {
10+
name = "production"
11+
resource_group_name = "networking"
12+
}
13+
14+
locals {
15+
extentions = {
16+
name = "example"
17+
virtual_machine_id = data.azurerm_virtual_machine.example.id
18+
settings = jsonencode({
19+
"script" : (base64encode(templatefile("./script.sh", {
20+
var = "example"
21+
})))
22+
})
23+
}
24+
}
525
26+
module "virtual_machine_extension" {
27+
source = "data-platform-hq/vm-extension/azurerm"
28+
version = "~> 1.0"
29+
30+
extentions = local.extentions
31+
}
32+
```
633
<!-- BEGIN_TF_DOCS -->
34+
## Requirements
35+
36+
| Name | Version |
37+
| ---------------------------------------------------------------------------- | --------- |
38+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0 |
39+
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | >= 3.40.0 |
40+
41+
## Providers
42+
43+
| Name | Version |
44+
| ---------------------------------------------------------------------- | ------- |
45+
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | 3.40.0 |
46+
47+
48+
## Inputs
49+
50+
| Name | Description | Type | Default | Required |
51+
|------|-------------|------|---------|:--------:|
52+
| <a name="input_extentions"></a> [extentions](#input\_extentions)| Objects to configure extentions for virtual machine | <pre>object({<br> name = optional(string),<br> virtual_machine_id = optional(string),<br> publisher = optional(string),<br> type = optional(string),<br> type_handler_version = optional(string),<br> settings = optional(string),<br> tags = optional(map(any))<br>})</pre> | <pre>object({<br> name = optional(string),<br> virtual_machine_id = optional(string),<br> publisher = optional(string, "Microsoft.Azure.Extensions"),<br> type = optional(string, "CustomScript"),<br> type_handler_version = optional(string, "2.0"),<br> settings = optional(string),<br> tags = optional(map(any))<br>})</pre> | no |
53+
54+
55+
## Modules
56+
57+
No modules.
58+
59+
## Resources
60+
61+
| Name | Type |
62+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
63+
| [azurerm_virtual_machine_extension.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_machine_extension) | resource |
64+
65+
66+
67+
## Outputs
768

69+
| Name | Description |
70+
| ----------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
71+
| <a name="output_id"></a> [id](#output\_id) | The ID of the Virtual Machine Extension. |
872
<!-- END_TF_DOCS -->
973

1074
## License
1175

12-
Apache 2 Licensed. For more information please see [LICENSE](https://github.com/data-platform-hq/terraform-azurerm<>/tree/master/LICENSE)
76+
Apache 2 Licensed. For more information please see [LICENSE](https://github.com/data-platform-hq/terraform-azurerm-vm-extension/blob/main/LICENSE)

main.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
resource "azurerm_virtual_machine_extension" "this" {
2+
name = var.extentions.name
3+
virtual_machine_id = var.extentions.virtual_machine_id
4+
publisher = var.extentions.publisher
5+
type = var.extentions.type
6+
type_handler_version = var.extentions.type_handler_version
7+
settings = var.extentions.settings
8+
tags = var.extentions.tags
9+
}

outputs.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
output "id" {
2+
value = azurerm_virtual_machine_extension.this.id
3+
description = "The ID of the Virtual Machine Extension."
4+
}

variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
variable "extentions" {
2+
type = object({
3+
name = string,
4+
virtual_machine_id = string,
5+
publisher = optional(string, "Microsoft.Azure.Extensions"),
6+
type = optional(string, "CustomScript"),
7+
type_handler_version = optional(string, "2.0"),
8+
settings = optional(string),
9+
tags = optional(map(any))
10+
})
11+
description = "Objects to configure extentions for virtual machine"
12+
}

versions.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
terraform {
2+
required_version = ">=1.0.0"
3+
4+
required_providers {
5+
azurerm = {
6+
source = "hashicorp/azurerm"
7+
version = ">=3.40.0"
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)