Skip to content

Commit

Permalink
Replace data source with generated managed disk ID (#35)
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Schwarz <[email protected]>
  • Loading branch information
rswrz authored Oct 9, 2024
1 parent 369ea94 commit 559260f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ The following resources are used by this module:
- [azapi_client_config.current](https://registry.terraform.io/providers/azure/azapi/latest/docs/data-sources/client_config) (data source)
- [azapi_resource.virtual_machine_image](https://registry.terraform.io/providers/azure/azapi/latest/docs/data-sources/resource) (data source)
- [azapi_resource_list.virtual_machine_images](https://registry.terraform.io/providers/azure/azapi/latest/docs/data-sources/resource_list) (data source)
- [azurerm_managed_disk.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/managed_disk) (data source)

## Required Inputs

Expand Down
7 changes: 1 addition & 6 deletions r-vm.tf
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,9 @@ resource "azurerm_windows_virtual_machine" "this" {
}
}

data "azurerm_managed_disk" "this" {
name = local.virtual_machine.os_disk[0].name
resource_group_name = var.resource_group_name
}

resource "azapi_resource_action" "this" {
type = "Microsoft.Compute/disks@2024-03-02"
resource_id = data.azurerm_managed_disk.this.id
resource_id = "${join("/", slice(split("/", local.virtual_machine.id), 0, 5))}/providers/Microsoft.Compute/disks/${local.virtual_machine.os_disk[0].name}"
method = "PATCH"

body = {
Expand Down

0 comments on commit 559260f

Please sign in to comment.