Skip to content
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
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
@@ -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"
}
}
Loading
Loading