PakaHuszar
All about my DIY electronics projects
2024. szeptember 4., szerda
Terraform, AzApi, Sql Managed Instance, DTC and it's consequences
I got an assignment to enhance out Azure SQL Managed Instances Terraform deployment module with DTC (Yes, it is a good question, why on earth this outdated technology is still needed).
For the DTC you will need two resources added to your managed instance. One is the DTC configuration, the other is the serverTrustGroup what determine which of your managed instances trust each other for the distributed transaction.
As I not even surprised, none of the above exists in the Terrafrom AzureRM provider, so you need to use AzAPI provider for it.
The DTC setting itself is a piece of cake - if you have experience using the AzAPI resources you can easily handle it.
The trustGroup is a different animal.
Here you can find the Microsoft documentation for it: https://learn.microsoft.com/en-us/azure/templates/microsoft.sql/2023-05-01-preview/locations/servertrustgroups?pivots=deployment-language-terraform
You just add the resource and done...
resource "azapi_resource" "symbolicname" {
type = "Microsoft.Sql/locations/serverTrustGroups@2023-05-01-preview"
name = "string"
parent_id = "string"
body = jsonencode({
properties = {
groupMembers = [
{
serverId = "string"
}
]
trustScopes = [
"string"
]
}
})
}
Not exactly. The name, groupMembers, trustScopes are explained in the documentation. The parent_id is not exactly. The documentation said:
"The ID of the resource that is the parent for this resource.
ID for resource of type: locations"
What this means to you?
Usually in the Azure "location" is used as the synonym of "region" - here: wrong
Even, if it would be the region, where should it be located in the management group/subscription/resource group hierarchy?
Anyway, as a normal Azure resource, it should be located in a resource group. Ok, add the resource group ID there. The Terraform give back this error:
"Error: `parent_id is invalid`: expect ID of `Microsoft.Sql/locations`"
What a hack is this Microsoft.Sql/locations ?
Looked through the internet. Yes it is part of the object hierarchy of the serverTrustGroups but, as resource it doesn't exists.
Ok. Deploy the Trust Group manually. Done it. On the portal you can't see the JSON of it.
Try other way.
Try to get it back via AZ CLI:
az sql stg list -g <resource group name> --instance-name <name>
The result:
[
{
"groupMembers": [
{
"serverId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/<resource group name>/providers/Microsoft.Sql/managedInstances/sql-test-01"
},
{
"serverId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/<resource group name>/providers/Microsoft.Sql/managedInstances/sql-test-02"
}
],
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/<resource group name>/providers/Microsoft.Sql/locations/West Europe/serverTrustGroups/trust-group",
"name": "trust-group",
"resourceGroup": " <resource group name>",
"trustScopes": [
"GlobalTransactions",
"ServiceBroker"
],
"type": "Microsoft.Sql/locations/serverTrustGroups"
}
]
Now, can you see?
After this, our code will look like something this:
resource "azapi_resource" "trust-group" {
type = "Microsoft.Sql/locations/serverTrustGroups@2023-05-01-preview"
name = var.trust_group_name
parent_id = "${var.resource_group_id}/providers/Microsoft.Sql/locations/${var.region}"
body = jsonencode({
properties = {
groupMembers = [for ServerID in var.groupMembers : { "serverId" = ServerID }]
trustScopes = var.trustScopes
}
})
}
And I try not to judge the quality of the Microsoft documentation ...
2024. augusztus 31., szombat
Reorganizing lab 2.
2024. augusztus 28., szerda
Reorganizing the lab 1.
2024. július 2., kedd
My new toys
2024. január 9., kedd
I'm back - Thingiverse
In December I started to think about to continue my things, first in 3D printing, but not too much happened (I'll write about it later).
A few years ago when I involved myself in the 3D printing also registered an account on Thingiverse.
I published there a few things: https://www.thingiverse.com/suf/designs
After a while (not really remember exactly when) Thingiverse accused me with a copyright fraud and disabled my account. To understand, all of the designs I published designed by myself and not connected to any copyright protected thing, so I still don't understand why.
I took several attempts to recover my account - unsuccessfully, then I gave up.
Yesterday I got two notifications that somebody commented one of my designs and remixed it. It was interesting as I didn't se such in the last years.
Just tired to login. And miraculously it let me in.
I don't know what happened but I'm happy on it anyways. I just guess it has some connection with the recent events described here: https://3dprintingcenter.net/ultimaker-announces-a-major-update-to-the-thingiverse-platform/
Anyways, I'm happy with it. I feel that an indication to come back in many ways.
2023. szeptember 16., szombat
Building my rack(s)
I was thinking about some Panduit modular patch panels, but never bought it. So just left it.
2023. szeptember 5., kedd
Fluke 787 "Repair"
"i purchased this at an estate sale. i don't know if it works or how to turn it on. but as it is right now i have pushed every button and nothing comes on the screen. so because of that i am selling it for parts or repair."