Skip to content

Commit

Permalink
Upgrade azapi dependency to 2.0´ (#45)
Browse files Browse the repository at this point in the history
Signed-off-by: Jan-Otto Kröpke <[email protected]>
  • Loading branch information
jkroepke authored Dec 3, 2024
1 parent 5d31502 commit 35c9c02
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 72 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ module "example" {

The following providers are used by this module:

- <a name="provider_azapi"></a> [azapi](#provider\_azapi) (~> 1.14)
- <a name="provider_azapi"></a> [azapi](#provider\_azapi) (~> 2.0)

- <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) (>= 4.1)

Expand Down
4 changes: 2 additions & 2 deletions d-image.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ locals {

virtual_machine_image = (
length(data.azapi_resource.virtual_machine_image) > 0 ?
jsondecode(one(data.azapi_resource.virtual_machine_image[*].output)) :
one(data.azapi_resource.virtual_machine_image[*].output) :
null
)

Expand All @@ -49,7 +49,7 @@ locals {

virtual_machine_images = (
length(data.azapi_resource_list.virtual_machine_images) > 0 ?
jsondecode(one(data.azapi_resource_list.virtual_machine_images[*].output)) :
one(data.azapi_resource_list.virtual_machine_images[*].output) :
[]
)

Expand Down
50 changes: 24 additions & 26 deletions tests/examples/mocks/azapi_resource.tfmock.hcl
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
mock_data "azapi_resource" {
defaults = {
output = <<-JSON
{
"id": "/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/MOCK_LOCATION/Publishers/MOCK_PUBLISHER/ArtifactTypes/MOCK_TYPE/Skus/MOCK_SKU/Versions/0.0.1",
"location": "MOCK_LOCATION",
"name": "0.0.1",
"properties": {
"architecture": "x64",
"automaticOSUpgradeProperties": { "automaticOSUpgradeSupported": false },
"dataDiskImages": [],
"disallowed": { "vmDiskType": "Unmanaged" },
"features": [
{
"name": "SecurityType",
"value": "TrustedLaunchAndConfidentialVmSupported"
},
{ "name": "IsAcceleratedNetworkSupported", "value": "True" },
{ "name": "DiskControllerTypes", "value": "SCSI, NVMe" },
{ "name": "IsHibernateSupported", "value": "True" }
],
"hyperVGeneration": "V2",
"imageDeprecationStatus": { "imageState": "Active" },
"osDiskImage": { "operatingSystem": "Windows", "sizeInGb": 127 },
"replicaCount": 10,
"replicaType": "Managed"
}
output = {
id = "/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/MOCK_LOCATION/Publishers/MOCK_PUBLISHER/ArtifactTypes/MOCK_TYPE/Skus/MOCK_SKU/Versions/0.0.1",
location = "MOCK_LOCATION",
name = "0.0.1",
properties = {
architecture = "x64",
automaticOSUpgradeProperties = { "automaticOSUpgradeSupported" : false },
dataDiskImages = [],
disallowed = { "vmDiskType" : "Unmanaged" },
features = [
{
name = "SecurityType",
value = "TrustedLaunchAndConfidentialVmSupported"
},
{ name = "IsAcceleratedNetworkSupported", value = "True" },
{ name = "DiskControllerTypes", value = "SCSI, NVMe" },
{ name = "IsHibernateSupported", value = "True" }
],
hyperVGeneration = "V2",
imageDeprecationStatus = { "imageState" : "Active" },
osDiskImage = { "operatingSystem" : "Windows", "sizeInGb" : 127 },
replicaCount = 10,
replicaType = "Managed"
}
JSON
}
}
}
12 changes: 6 additions & 6 deletions tests/local/input_image.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ mock_provider "azapi" {

mock_data "azapi_resource" {
defaults = {
output = <<-JSON
{
"properties": {
"architecture": "x64",
"osDiskImage": { "operatingSystem": "Linux" }
output = {
properties = {
architecture = "x64",
osDiskImage = {
operatingSystem = "Linux"
}
}
}
JSON
}
}
}
Expand Down
50 changes: 24 additions & 26 deletions tests/local/mocks/azapi_resource.tfmock.hcl
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
mock_data "azapi_resource" {
defaults = {
output = <<-JSON
{
"id": "/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/MOCK_LOCATION/Publishers/MOCK_PUBLISHER/ArtifactTypes/MOCK_TYPE/Skus/MOCK_SKU/Versions/0.0.1",
"location": "MOCK_LOCATION",
"name": "0.0.1",
"properties": {
"architecture": "x64",
"automaticOSUpgradeProperties": { "automaticOSUpgradeSupported": false },
"dataDiskImages": [],
"disallowed": { "vmDiskType": "Unmanaged" },
"features": [
{
"name": "SecurityType",
"value": "TrustedLaunchAndConfidentialVmSupported"
},
{ "name": "IsAcceleratedNetworkSupported", "value": "True" },
{ "name": "DiskControllerTypes", "value": "SCSI, NVMe" },
{ "name": "IsHibernateSupported", "value": "True" }
],
"hyperVGeneration": "V2",
"imageDeprecationStatus": { "imageState": "Active" },
"osDiskImage": { "operatingSystem": "Windows", "sizeInGb": 127 },
"replicaCount": 10,
"replicaType": "Managed"
}
output = {
id = "/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/MOCK_LOCATION/Publishers/MOCK_PUBLISHER/ArtifactTypes/MOCK_TYPE/Skus/MOCK_SKU/Versions/0.0.1",
location = "MOCK_LOCATION",
name = "0.0.1",
properties = {
architecture = "x64",
automaticOSUpgradeProperties = { automaticOSUpgradeSupported = false },
dataDiskImages = [],
disallowed = { vmDiskType = "Unmanaged" },
features = [
{
name = "SecurityType",
value = "TrustedLaunchAndConfidentialVmSupported"
},
{ name = "IsAcceleratedNetworkSupported", value = "True" },
{ name = "DiskControllerTypes", value = "SCSI, NVMe" },
{ name = "IsHibernateSupported", value = "True" }
],
hyperVGeneration = "V2",
imageDeprecationStatus = { imageState = "Active" },
osDiskImage = { operatingSystem = "Windows", sizeInGb = 127 },
replicaCount = 10,
replicaType = "Managed"
}
JSON
}
}
}
16 changes: 7 additions & 9 deletions tests/local/mocks/azapi_resource_list.tfmock.hcl
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
mock_data "azapi_resource_list" {
defaults = {
output = <<-JSON
[
{
"id": "/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/MOCK_LOCATION/Publishers/MOCK_PUBLISHER/ArtifactTypes/MOCK_TYPE/Skus/MOCK_SKU/Versions/0.0.1",
"location": "MOCK_LOCATION",
"name": "0.0.1"
}
]
JSON
output = [
{
id = "/Subscriptions/00000000-0000-0000-0000-000000000000/Providers/Microsoft.Compute/Locations/MOCK_LOCATION/Publishers/MOCK_PUBLISHER/ArtifactTypes/MOCK_TYPE/Skus/MOCK_SKU/Versions/0.0.1",
location = "MOCK_LOCATION",
name = "0.0.1"
}
]
}
}
2 changes: 1 addition & 1 deletion tests/remote/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
azapi = {
source = "azure/azapi"
version = "1.14.0"
version = "2.0.1"
}

azurerm = {
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
azapi = {
source = "azure/azapi"
version = "~> 1.14"
version = "~> 2.0"
}

azurerm = {
Expand Down

0 comments on commit 35c9c02

Please sign in to comment.