In Terraform, is it possible to change the casing of values? - terraform

I have an ID of a resource and the ID states that the value is known as "/Subscriptions/xxxxxxx-xxxxxx-xxxxxx-xxxxx/" and when leveraging the data resource, "azurerm_subscription "current" ", to get the current subscription data, I get the output of "/subscriptions/xxxxxxx-xxxxxx-xxxxxx-xxxxx/".
You will notice that the only difference between the two values is the Upper case S in the word "Subscriptions". When making terraform changes to use "azurerm_subscription.current.id", instead of hardcoding the Subscription ID value in other resources, it fails to acknowledge the syntax is the same and is telling me that I need to replace the resource I am working with (in this situation I am working with a data disk on a vm). I do not want to destroy the disk and recreate it using just a different casing of the word subscription.
Is this task possible? Am I able to place anything into the main.tf file I am working with to change this casing? I have tried "title(data.azurerm_subscription.current.id)" and it does work in changing the s to an upper case S, however, it also makes all other "first words" that start with an alphabet letter upper case as well (not desired result). I just want to upper case the very first word.
Kind of a loaded question, but any thoughts on this?

Related

Assign a Group Variable to a Project Variable in the GitLab UI

I have a GitLab Project that belongs to a Group. I've defined a number of common variables in the group that I would like to reuse in my projects. I know these variables are inherited by the project, but I would like to be able to re-assign the target group variables from the project as needed.
Is there way to target a group variable from a project? I suspect not, because using the $VAR_NAME syntax results in a warning stating the variable cannot be masked (due to the $).
"Masking" in GitLab means that it would replace the value with asterisks. I.e. *******. Which, if it is not able to, like on your screenshot, GitLab warns about.
According to the warning the variable will get expanded if such a group level variable exists; means it would do what you expect it to. Though you need to be aware, that your variables values may be in plaintext in the job log.
How it behaves depends on how you configured the group level variable in this case:
If the group level variable is set to be masked, then it will be masked in the expanded project level variable as well.
But you can not mask the expanded variable at the project level, if you did not set the group level variable to be masked in the first place.
A way to work around this uncertainty would be, to directly use the group level variable. Though I can see that this might not always be possible depending on for example differing frameworks used in the projects of a group.

How to create datadog 'change alerts' using terraform?

I am trying to create a change monitor using terraform. To create a monitor that checks that overtime a count stays at 0 for example every day (the value will go up to one some times and get back to 0).
I found on the UI the capacity to create a change alert.
I cant seem to find a way to define the configuration for this type. Is terraform just supporting only a subset of the monitors? or does the query need to be change in some specific way that I cant find documentation for?.
I've stumbled upon this as well. I just figured out you have to manually create the monitor using "change alerts" then go to "manage monitors" page, open the one you just created and you'll see the query that starts with change(...). Copy the whole query to the query field in your terraform config.

PXFormula and SumCalc not calculating correctly (doubling value of field)

Where does the code that makes a PX Formula work exist? I at first assumed it was a SQL Trigger, but I can't seem to find it there. This is why I ask....
I've added a custom field to the SO, called usrSpeedyTotalExt2. I'm trying to get that to sum the SOLine.CuryLineAmt. I added attributes to the SOLine DAC to append the follwing:
[PXFormula(null, typeof(SumCalc<SOOrderExt.usrSpeedyTotalExt2>))]
This seemed to work, but know I'm fining that the value is consistently twice as high as it should be. I've got a second field that's doing the exact same thing.
What's increasingly odd is that I had the same problem with the field, and I thought I had done something wrong so I deleted the PXFormula, created a new field and then added the PX Formula to populate the new field. As such, there shouldn't be any code populating the old field, but strangely it's populated, so there must b e some business logic that's stuck and somehow still populating it.
Any thoughts on how I track this down?
I believe that I figured out the problem...I think that the code may have been imported and published on more than one company, then published from the proper company to multiple tenants.
My fix was to go to the live company, un-publish all, then go back to the company the customizations live in and publish to the appropriate tenants. It would appear that now I'm only getting the proper totals. IDK how that might have happened, but at least it appears to be fixed.

msproject - creating an indicator that more than one resource is allocated to the task

I'm fairly new to MSProject and i believe my request is pretty simple:
I would like that an indicator show an icon when a task has more than one resource allocated to it.
is it possible?
p.s my goal is that people wont be able to add more than one resources per task. if there is a way to enforce it the indicator is not necessary
thanks
The basic formula is something like that: InStr([Resource Initials],","). Please pay attention that "," is a list separator in my locale. For other people that could be ";" and so on. There is a property of Application object: Application.ListSeparator but it isn't available in plain formula definition - you can create your VBA function which will just return the value and use your function.
Variation of the formula depends on what field are you going to use for it. If you plan to use one of Flag fields - just add > 0 at the end, for Number field you can just define a graphical indicator with greater than 0 condition.
Another option is to write your handler for event Application.ProjectBeforeAssignmentNew and check if there are any assignments defined for the task already

Convert a alpha-numeric string into a gibberish barcode?

A container is identified with the label JA1234. This container should always go to destination A.
Another container is identified with the label 1234. The vast majority of containers are labeled this way and these always go to destination B.
(Note: The pool of containers constantly fluctates so we can't maintain a master list.)
The users can either scan/key in the container identifier. Many of the containers aren't barcoded so they need to type in the number. When it gets typed in the prefix 'JA' gets ignored and suddenly the programs error checks fail (allowing wrong destinations).
To prevent entry and to force barcoding I would like to require the program to scan a barcode. The only way to get the users to scan the barcode consistently is the provide a barcode in a gibberish (ie hexadecimal) format.
Is there a any built-in .NET framework feature that would convert the readable string into something unreadable that would require scanning? It would need to be reversible.
It sounds like you want the users to input the whole string always and you users are ignoring part of the string. To solve this you want the users to just use the barcode scanner.
But you really have three choices.
Only print out the barcode. They can't type what they can't see. However this is bad because if a barcode is damaged you won't be able to fallback to user entry
Encode it using something like System.Convert.ToBase64String. This is bad because then you'll have to print values like SkExMjM0 and MTIzNA== for JA1234 and 1234 which is easy to mistype when the users needs to type.
Use a check digit and append it to the string. You can then reject codes incorrectly entered or incorrectly read by the barcode scanner. The downside is there's nothing built in that can directly convert "JA2134" and you have to create your own check digit function.

Resources