diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e47863..0a68c0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +## v0.16.0 + +ENHANCEMENTS: +- Add more azapi examples for the dependency resolver. +- Update mapping of azurerm v4.14.0 + +BUG FIXES: +- Fix mockResourceIDFromType for special resource types. + +## v0.15.1 + +BUG FIXES: +- Fix a bug that root level discriminator is not handled correctly. + ## v0.15.0 ENHANCEMENTS: diff --git a/dependency/azapi_examples/Microsoft.Impact_connectors@2024-05-01-preview/main.tf b/dependency/azapi_examples/Microsoft.Impact_connectors@2024-05-01-preview/main.tf new file mode 100644 index 0000000..a79454f --- /dev/null +++ b/dependency/azapi_examples/Microsoft.Impact_connectors@2024-05-01-preview/main.tf @@ -0,0 +1,35 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "resource_name" { + type = string + default = "acctest0001" +} + +variable "location" { + type = string + default = "westeurope" +} + +data "azapi_client_config" "current" {} + +resource "azapi_resource" "connector" { + type = "Microsoft.Impact/connectors@2024-05-01-preview" + parent_id = "/subscriptions/${data.azapi_client_config.current.subscription_id}" + name = var.resource_name + body = { + properties = { + connectorType = "AzureMonitor" + } + } + schema_validation_enabled = false +} diff --git a/dependency/azapi_examples/Microsoft.Impact_workloadImpacts@2023-12-01-preview/main.tf b/dependency/azapi_examples/Microsoft.Impact_workloadImpacts@2023-12-01-preview/main.tf new file mode 100644 index 0000000..4ab757a --- /dev/null +++ b/dependency/azapi_examples/Microsoft.Impact_workloadImpacts@2023-12-01-preview/main.tf @@ -0,0 +1,216 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "resource_name" { + type = string + default = "acctest0001" +} + +variable "location" { + type = string + default = "westeurope" +} + +data "azapi_client_config" "current" {} + +resource "azapi_resource" "resourceGroup" { + type = "Microsoft.Resources/resourceGroups@2020-06-01" + name = var.resource_name + location = var.location +} + +resource "azapi_resource" "virtualNetwork" { + type = "Microsoft.Network/virtualNetworks@2022-07-01" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + body = { + properties = { + addressSpace = { + addressPrefixes = [ + "10.0.0.0/16", + ] + } + dhcpOptions = { + dnsServers = [ + ] + } + subnets = [ + ] + } + } + schema_validation_enabled = false + lifecycle { + ignore_changes = [body.properties.subnets] + } +} + +resource "azapi_resource" "subnet" { + type = "Microsoft.Network/virtualNetworks/subnets@2022-07-01" + parent_id = azapi_resource.virtualNetwork.id + name = var.resource_name + body = { + properties = { + addressPrefix = "10.0.2.0/24" + delegations = [ + ] + privateEndpointNetworkPolicies = "Enabled" + privateLinkServiceNetworkPolicies = "Enabled" + serviceEndpointPolicies = [ + ] + serviceEndpoints = [ + ] + } + } +} + +resource "azapi_resource" "networkInterface" { + type = "Microsoft.Network/networkInterfaces@2022-07-01" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + body = { + properties = { + enableAcceleratedNetworking = false + enableIPForwarding = false + ipConfigurations = [ + { + name = "testconfiguration1" + properties = { + primary = true + privateIPAddressVersion = "IPv4" + privateIPAllocationMethod = "Dynamic" + subnet = { + id = azapi_resource.subnet.id + } + } + }, + ] + } + } +} + +resource "azapi_resource" "virtualMachine" { + type = "Microsoft.Compute/virtualMachines@2023-03-01" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + body = { + properties = { + hardwareProfile = { + vmSize = "Standard_F2" + } + networkProfile = { + networkInterfaces = [ + { + id = azapi_resource.networkInterface.id + properties = { + primary = false + } + }, + ] + } + osProfile = { + adminPassword = "Password1234!" + adminUsername = "testadmin" + computerName = "hostname230630032848831819" + linuxConfiguration = { + disablePasswordAuthentication = false + } + } + storageProfile = { + imageReference = { + offer = "UbuntuServer" + publisher = "Canonical" + sku = "16.04-LTS" + version = "latest" + } + osDisk = { + caching = "ReadWrite" + createOption = "FromImage" + name = "myosdisk1" + writeAcceleratorEnabled = false + } + } + } + } +} + + + +resource "azapi_resource" "workloadImpact" { + type = "Microsoft.Impact/workloadImpacts@2023-12-01-preview" + parent_id = "/subscriptions/${data.azapi_client_config.current.subscription_id}" + name = var.resource_name + body = { + properties = { + additionalProperties = { + CollectTelemetry = true + Location = "DataCenter1" + LogUrl = "http://example.com/log" + Manufacturer = "ManufacturerName" + ModelNumber = "Model123" + NodeId = "node-123" + PhysicalHostName = "host123" + SerialNumber = "SN123456" + VmUniqueId = "vm-unique-id" + } + armCorrelationIds = [ + "id1", + "id2", + ] + clientIncidentDetails = { + clientIncidentId = "id" + clientIncidentSource = "AzureDevops" + } + confidenceLevel = "High" + connectivity = { + port = 1443 + protocol = "TCP" + source = { + azureResourceId = azapi_resource.virtualMachine.id + } + target = { + azureResourceId = azapi_resource.virtualMachine.id + } + } + endDateTime = "2024-12-04T01:15:00Z" + errorDetails = { + errorCode = "code" + errorMessage = "errorMessage" + } + impactCategory = "Resource.Availability" + impactDescription = "impact description" + impactGroupId = "impact groupid" + impactedResourceId = azapi_resource.virtualMachine.id + performance = [ + { + actual = 2 + expected = 2 + expectedValueRange = { + max = 5 + min = 1 + } + metricName = "example" + unit = "ByteSeconds" + }, + ] + startDateTime = "2024-12-03T01:15:00Z" + workload = { + context = "context" + toolset = "Ansible" + } + } + } + + schema_validation_enabled = false +} diff --git a/dependency/azapi_examples/Microsoft.Network_networkManagers_ipamPools@2024-01-01-preview/main.tf b/dependency/azapi_examples/Microsoft.Network_networkManagers_ipamPools@2024-01-01-preview/main.tf new file mode 100644 index 0000000..11b3a90 --- /dev/null +++ b/dependency/azapi_examples/Microsoft.Network_networkManagers_ipamPools@2024-01-01-preview/main.tf @@ -0,0 +1,75 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "resource_name" { + type = string + default = "acctest0001" +} + +variable "location" { + type = string + default = "westeurope" +} + +data "azapi_client_config" "current" {} + +resource "azapi_resource" "resourceGroup" { + type = "Microsoft.Resources/resourceGroups@2020-06-01" + name = var.resource_name + location = var.location +} + +resource "azapi_resource" "networkManager" { + type = "Microsoft.Network/networkManagers@2022-09-01" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + body = { + properties = { + description = "" + networkManagerScopeAccesses = [ + "SecurityAdmin", + ] + networkManagerScopes = { + managementGroups = [ + ] + subscriptions = [ + "/subscriptions/${data.azapi_client_config.current.subscription_id}", + ] + } + } + } + retry = { + error_message_regex = ["CannotDeleteResource"] + } +} + +resource "azapi_resource" "ipamPool" { + type = "Microsoft.Network/networkManagers/ipamPools@2024-01-01-preview" + parent_id = azapi_resource.networkManager.id + name = var.resource_name + location = var.location + body = { + properties = { + addressPrefixes = [ + "10.0.0.0/24", + ] + description = "Test description." + parentPoolName = "" + displayName = "testDisplayName" + } + } + + tags = { + myTag = "testTag" + } +} diff --git a/dependency/azapi_examples/Microsoft.Network_networkManagers_ipamPools_staticCidr@2024-01-01-preview/main.tf b/dependency/azapi_examples/Microsoft.Network_networkManagers_ipamPools_staticCidr@2024-01-01-preview/main.tf new file mode 100644 index 0000000..be5a679 --- /dev/null +++ b/dependency/azapi_examples/Microsoft.Network_networkManagers_ipamPools_staticCidr@2024-01-01-preview/main.tf @@ -0,0 +1,90 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "resource_name" { + type = string + default = "acctest0001" +} + +variable "location" { + type = string + default = "westeurope" +} + +data "azapi_client_config" "current" {} + +resource "azapi_resource" "resourceGroup" { + type = "Microsoft.Resources/resourceGroups@2020-06-01" + name = var.resource_name + location = var.location +} + +resource "azapi_resource" "networkManager" { + type = "Microsoft.Network/networkManagers@2022-09-01" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + body = { + properties = { + description = "" + networkManagerScopeAccesses = [ + "SecurityAdmin", + ] + networkManagerScopes = { + managementGroups = [ + ] + subscriptions = [ + "/subscriptions/${data.azapi_client_config.current.subscription_id}", + ] + } + } + } + retry = { + error_message_regex = ["CannotDeleteResource"] + } +} + +resource "azapi_resource" "ipamPool" { + type = "Microsoft.Network/networkManagers/ipamPools@2024-01-01-preview" + parent_id = azapi_resource.networkManager.id + name = var.resource_name + location = var.location + body = { + properties = { + addressPrefixes = [ + "10.0.0.0/24", + ] + description = "Test description." + parentPoolName = "" + displayName = "testDisplayName" + } + } + + tags = { + myTag = "testTag" + } +} + +resource "azapi_resource" "staticCidr" { + type = "Microsoft.Network/networkManagers/ipamPools/staticCidrs@2024-01-01-preview" + parent_id = azapi_resource.ipamPool.id + name = var.resource_name + body = { + properties = { + addressPrefixes = [ + "10.0.0.0/25", + ] + numberOfIPAddressesToAllocate = "" + description = "test description" + } + } +} diff --git a/dependency/azapi_examples/Microsoft.Network_networkManagers_verifierWorkspace@2024-01-01-preview/main.tf b/dependency/azapi_examples/Microsoft.Network_networkManagers_verifierWorkspace@2024-01-01-preview/main.tf new file mode 100644 index 0000000..7d5c84b --- /dev/null +++ b/dependency/azapi_examples/Microsoft.Network_networkManagers_verifierWorkspace@2024-01-01-preview/main.tf @@ -0,0 +1,70 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "resource_name" { + type = string + default = "acctest0001" +} + +variable "location" { + type = string + default = "westeurope" +} + +data "azapi_client_config" "current" {} + +resource "azapi_resource" "resourceGroup" { + type = "Microsoft.Resources/resourceGroups@2020-06-01" + name = var.resource_name + location = var.location +} + +resource "azapi_resource" "networkManager" { + type = "Microsoft.Network/networkManagers@2022-09-01" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + body = { + properties = { + description = "" + networkManagerScopeAccesses = [ + "SecurityAdmin", + ] + networkManagerScopes = { + managementGroups = [ + ] + subscriptions = [ + "/subscriptions/${data.azapi_client_config.current.subscription_id}", + ] + } + } + } + retry = { + error_message_regex = ["CannotDeleteResource"] + } +} + +resource "azapi_resource" "verifierWorkspace" { + type = "Microsoft.Network/networkManagers/verifierWorkspaces@2024-01-01-preview" + parent_id = azapi_resource.networkManager.id + name = var.resource_name + location = var.location + body = { + properties = { + description = "A sample workspace" + } + } + + tags = { + myTag = "testTag" + } +} \ No newline at end of file diff --git a/dependency/azapi_examples/Microsoft.Network_networkManagers_verifierWorkspace_reachabilityAnalysisIntent@2024-01-01-preview/main.tf b/dependency/azapi_examples/Microsoft.Network_networkManagers_verifierWorkspace_reachabilityAnalysisIntent@2024-01-01-preview/main.tf new file mode 100644 index 0000000..b05350b --- /dev/null +++ b/dependency/azapi_examples/Microsoft.Network_networkManagers_verifierWorkspace_reachabilityAnalysisIntent@2024-01-01-preview/main.tf @@ -0,0 +1,231 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "resource_name" { + type = string + default = "acctest0001" +} + +variable "location" { + type = string + default = "westeurope" +} + +data "azapi_client_config" "current" {} + +resource "azapi_resource" "resourceGroup" { + type = "Microsoft.Resources/resourceGroups@2020-06-01" + name = var.resource_name + location = var.location +} + +resource "azapi_resource" "virtualNetwork" { + type = "Microsoft.Network/virtualNetworks@2022-07-01" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + body = { + properties = { + addressSpace = { + addressPrefixes = [ + "10.0.0.0/16", + ] + } + dhcpOptions = { + dnsServers = [ + ] + } + subnets = [ + ] + } + } + lifecycle { + ignore_changes = [body.properties.subnets] + } + schema_validation_enabled = false +} + +resource "azapi_resource" "subnet" { + type = "Microsoft.Network/virtualNetworks/subnets@2022-07-01" + parent_id = azapi_resource.virtualNetwork.id + name = var.resource_name + body = { + properties = { + addressPrefix = "10.0.2.0/24" + delegations = [ + ] + privateEndpointNetworkPolicies = "Enabled" + privateLinkServiceNetworkPolicies = "Enabled" + serviceEndpointPolicies = [ + ] + serviceEndpoints = [ + ] + } + } + ignore_missing_property = true # ignore serviceEndpointPolicies NOT in GET subnet response +} + +resource "azapi_resource" "networkInterface" { + type = "Microsoft.Network/networkInterfaces@2022-07-01" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + body = { + properties = { + enableAcceleratedNetworking = false + enableIPForwarding = false + ipConfigurations = [ + { + name = "testconfiguration1" + properties = { + primary = true + privateIPAddressVersion = "IPv4" + privateIPAllocationMethod = "Dynamic" + subnet = { + id = azapi_resource.subnet.id + } + } + }, + ] + } + } +} + +resource "azapi_resource" "virtualMachine" { + type = "Microsoft.Compute/virtualMachines@2023-03-01" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + body = { + properties = { + hardwareProfile = { + vmSize = "Standard_F2" + } + networkProfile = { + networkInterfaces = [ + { + id = azapi_resource.networkInterface.id + properties = { + primary = false + } + }, + ] + } + osProfile = { + adminPassword = "Password1234!" + adminUsername = "testadmin" + computerName = "hostname230630032848831819" + linuxConfiguration = { + disablePasswordAuthentication = false + } + } + storageProfile = { + imageReference = { + offer = "UbuntuServer" + publisher = "Canonical" + sku = "16.04-LTS" + version = "latest" + } + osDisk = { + caching = "ReadWrite" + createOption = "FromImage" + name = "myosdisk1" + writeAcceleratorEnabled = false + } + } + } + } + ignore_missing_property = true # ignore adminPassword as NOT part of GET vm response +} + +resource "azapi_resource" "networkManager" { + type = "Microsoft.Network/networkManagers@2022-09-01" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + body = { + properties = { + description = "" + networkManagerScopeAccesses = [ + "SecurityAdmin", + ] + networkManagerScopes = { + managementGroups = [ + ] + subscriptions = [ + "/subscriptions/${data.azapi_client_config.current.subscription_id}", + ] + } + } + } + retry = { + error_message_regex = ["CannotDeleteResource"] + } +} + +resource "azapi_resource" "verifierWorkspace" { + type = "Microsoft.Network/networkManagers/verifierWorkspaces@2024-01-01-preview" + parent_id = azapi_resource.networkManager.id + name = var.resource_name + location = var.location + body = { + properties = { + description = "A sample workspace" + } + } + + tags = { + myTag = "testTag" + } +} + +resource "azapi_resource" "reachabilityAnalysisIntent" { + type = "Microsoft.Network/networkManagers/verifierWorkspaces/reachabilityAnalysisIntents@2024-01-01-preview" + parent_id = azapi_resource.verifierWorkspace.id + name = var.resource_name + body = { + properties = { + description = "A sample reachability analysis intent" + destinationResourceId = azapi_resource.virtualMachine.id + ipTraffic = { + destinationIps = [ + "10.4.0.1", + ] + destinationPorts = [ + "0", + ] + protocols = [ + "Any", + ] + sourceIps = [ + "10.4.0.0", + ] + sourcePorts = [ + "0", + ] + } + sourceResourceId = azapi_resource.virtualMachine.id + } + } +} + +resource "azapi_resource" "reachabilityAnalysisRun" { + type = "Microsoft.Network/networkManagers/verifierWorkspaces/reachabilityAnalysisRuns@2024-01-01-preview" + parent_id = azapi_resource.verifierWorkspace.id + name = var.resource_name + body = { + properties = { + description = "A sample reachability analysis run" + intentId = azapi_resource.reachabilityAnalysisIntent.id + } + } +} \ No newline at end of file diff --git a/dependency/azapi_examples/Microsoft.Network_networkManagers_verifierWorkspace_reachabilityAnalysisIntent_reachabilityAnalysisRun@2024-01-01-preview/main.tf b/dependency/azapi_examples/Microsoft.Network_networkManagers_verifierWorkspace_reachabilityAnalysisIntent_reachabilityAnalysisRun@2024-01-01-preview/main.tf new file mode 100644 index 0000000..08c4997 --- /dev/null +++ b/dependency/azapi_examples/Microsoft.Network_networkManagers_verifierWorkspace_reachabilityAnalysisIntent_reachabilityAnalysisRun@2024-01-01-preview/main.tf @@ -0,0 +1,219 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "resource_name" { + type = string + default = "acctest0001" +} + +variable "location" { + type = string + default = "westeurope" +} + +data "azapi_client_config" "current" {} + +resource "azapi_resource" "resourceGroup" { + type = "Microsoft.Resources/resourceGroups@2020-06-01" + name = var.resource_name + location = var.location +} + +resource "azapi_resource" "virtualNetwork" { + type = "Microsoft.Network/virtualNetworks@2022-07-01" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + body = { + properties = { + addressSpace = { + addressPrefixes = [ + "10.0.0.0/16", + ] + } + dhcpOptions = { + dnsServers = [ + ] + } + subnets = [ + ] + } + } + lifecycle { + ignore_changes = [body.properties.subnets] + } + schema_validation_enabled = false +} + +resource "azapi_resource" "subnet" { + type = "Microsoft.Network/virtualNetworks/subnets@2022-07-01" + parent_id = azapi_resource.virtualNetwork.id + name = var.resource_name + body = { + properties = { + addressPrefix = "10.0.2.0/24" + delegations = [ + ] + privateEndpointNetworkPolicies = "Enabled" + privateLinkServiceNetworkPolicies = "Enabled" + serviceEndpointPolicies = [ + ] + serviceEndpoints = [ + ] + } + } + ignore_missing_property = true # ignore serviceEndpointPolicies NOT in GET subnet response +} + +resource "azapi_resource" "networkInterface" { + type = "Microsoft.Network/networkInterfaces@2022-07-01" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + body = { + properties = { + enableAcceleratedNetworking = false + enableIPForwarding = false + ipConfigurations = [ + { + name = "testconfiguration1" + properties = { + primary = true + privateIPAddressVersion = "IPv4" + privateIPAllocationMethod = "Dynamic" + subnet = { + id = azapi_resource.subnet.id + } + } + }, + ] + } + } +} + +resource "azapi_resource" "virtualMachine" { + type = "Microsoft.Compute/virtualMachines@2023-03-01" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + body = { + properties = { + hardwareProfile = { + vmSize = "Standard_F2" + } + networkProfile = { + networkInterfaces = [ + { + id = azapi_resource.networkInterface.id + properties = { + primary = false + } + }, + ] + } + osProfile = { + adminPassword = "Password1234!" + adminUsername = "testadmin" + computerName = "hostname230630032848831819" + linuxConfiguration = { + disablePasswordAuthentication = false + } + } + storageProfile = { + imageReference = { + offer = "UbuntuServer" + publisher = "Canonical" + sku = "16.04-LTS" + version = "latest" + } + osDisk = { + caching = "ReadWrite" + createOption = "FromImage" + name = "myosdisk1" + writeAcceleratorEnabled = false + } + } + } + } + ignore_missing_property = true # ignore adminPassword as NOT part of GET vm response +} + +resource "azapi_resource" "networkManager" { + type = "Microsoft.Network/networkManagers@2022-09-01" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + body = { + properties = { + description = "" + networkManagerScopeAccesses = [ + "SecurityAdmin", + ] + networkManagerScopes = { + managementGroups = [ + ] + subscriptions = [ + "/subscriptions/${data.azapi_client_config.current.subscription_id}", + ] + } + } + } + retry = { + error_message_regex = ["CannotDeleteResource"] + } +} + +resource "azapi_resource" "verifierWorkspace" { + type = "Microsoft.Network/networkManagers/verifierWorkspaces@2024-01-01-preview" + parent_id = azapi_resource.networkManager.id + name = var.resource_name + location = var.location + body = { + properties = { + description = "A sample workspace" + } + } + + tags = { + myTag = "testTag" + } +} + +resource "azapi_resource" "reachabilityAnalysisIntent" { + type = "Microsoft.Network/networkManagers/verifierWorkspaces/reachabilityAnalysisIntents@2024-01-01-preview" + parent_id = azapi_resource.verifierWorkspace.id + name = var.resource_name + body = { + properties = { + description = "A sample reachability analysis intent" + destinationResourceId = azapi_resource.virtualMachine.id + ipTraffic = { + destinationIps = [ + "10.4.0.1", + ] + destinationPorts = [ + "0", + ] + protocols = [ + "Any", + ] + sourceIps = [ + "10.4.0.0", + ] + sourcePorts = [ + "0", + ] + } + sourceResourceId = azapi_resource.virtualMachine.id + } + } +} \ No newline at end of file diff --git a/dependency/azapi_examples/Microsoft.VoiceServices_communicationsGateways@2023-01-31/main.tf b/dependency/azapi_examples/Microsoft.VoiceServices_communicationsGateways@2023-01-31/main.tf new file mode 100644 index 0000000..2fe1f76 --- /dev/null +++ b/dependency/azapi_examples/Microsoft.VoiceServices_communicationsGateways@2023-01-31/main.tf @@ -0,0 +1,79 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "resource_name" { + type = string + default = "acctest0001" +} + +variable "location" { + type = string + default = "eastus2euap" +} + +resource "azapi_resource" "resourceGroup" { + type = "Microsoft.Resources/resourceGroups@2020-06-01" + name = var.resource_name + location = var.location +} + +resource "azapi_resource" "communicationsGateway" { + type = "Microsoft.VoiceServices/communicationsGateways@2023-01-31" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + + body = { + properties = { + autoGeneratedDomainNameLabelScope = "NoReuse" + codecs = [ + "PCMA", + ] + connectivity = "PublicAddress" + e911Type = "Standard" + platforms = [ + "OperatorConnect", + ] + serviceLocations = [ + { + name = "useast" + primaryRegionProperties = { + allowedMediaSourceAddressPrefixes = [ + "10.1.2.0/24", + ] + allowedSignalingSourceAddressPrefixes = [ + "10.1.1.0/24", + ] + operatorAddresses = [ + "198.51.100.1", + ] + } + }, + { + name = "useast2" + primaryRegionProperties = { + allowedMediaSourceAddressPrefixes = [ + "10.2.2.0/24", + ] + allowedSignalingSourceAddressPrefixes = [ + "10.2.1.0/24", + ] + operatorAddresses = [ + "198.51.100.2", + ] + } + }, + ] + teamsVoicemailPilotNumber = "1234567890" + } + } +} diff --git a/dependency/azapi_examples/Microsoft.VoiceServices_communicationsGateways_testLines@2023-01-31/main.tf b/dependency/azapi_examples/Microsoft.VoiceServices_communicationsGateways_testLines@2023-01-31/main.tf new file mode 100644 index 0000000..a0576d2 --- /dev/null +++ b/dependency/azapi_examples/Microsoft.VoiceServices_communicationsGateways_testLines@2023-01-31/main.tf @@ -0,0 +1,93 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "resource_name" { + type = string + default = "acctest0001" +} + +variable "location" { + type = string + default = "eastus2euap" +} + +resource "azapi_resource" "resourceGroup" { + type = "Microsoft.Resources/resourceGroups@2020-06-01" + name = var.resource_name + location = var.location +} + +resource "azapi_resource" "communicationsGateway" { + type = "Microsoft.VoiceServices/communicationsGateways@2023-01-31" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + + body = { + properties = { + autoGeneratedDomainNameLabelScope = "NoReuse" + codecs = [ + "PCMA", + ] + connectivity = "PublicAddress" + e911Type = "Standard" + platforms = [ + "OperatorConnect", + ] + serviceLocations = [ + { + name = "useast" + primaryRegionProperties = { + allowedMediaSourceAddressPrefixes = [ + "10.1.2.0/24", + ] + allowedSignalingSourceAddressPrefixes = [ + "10.1.1.0/24", + ] + operatorAddresses = [ + "198.51.100.1", + ] + } + }, + { + name = "useast2" + primaryRegionProperties = { + allowedMediaSourceAddressPrefixes = [ + "10.2.2.0/24", + ] + allowedSignalingSourceAddressPrefixes = [ + "10.2.1.0/24", + ] + operatorAddresses = [ + "198.51.100.2", + ] + } + }, + ] + teamsVoicemailPilotNumber = "1234567890" + } + } +} + +resource "azapi_resource" "TestLine" { + type = "Microsoft.VoiceServices/communicationsGateways/testLines@2023-01-31" + parent_id = azapi_resource.communicationsGateway.id + name = var.resource_name + location = var.location + + body = { + properties = { + phoneNumber = "123456789" + purpose = "Automated" + } + } +} diff --git a/version.go b/version.go index ede0ae0..412045e 100644 --- a/version.go +++ b/version.go @@ -1,5 +1,5 @@ package main func VersionString() string { - return "0.15.0" + return "0.15.1" }