VirtusLab / besom

Besom - a Pulumi SDK for Scala. Also, incidentally, a broom made of twigs tied round a stick. Brooms and besoms are used for protection, to ward off evil spirits, and cleansing of ritual spaces.
https://virtuslab.github.io/besom/
Apache License 2.0
114 stars 7 forks source link

Is colon allowed in resourceName? #387

Closed dubinsky closed 4 months ago

dubinsky commented 4 months ago

As a part of https://github.com/VirtusLab/besom/pull/328, besom.URN.UrnRegex changed, including the change from (?<resourceName>.+) to (?<resourceName>[^:]+|[^:]*::[^:]*).

With this change, URNs that contain a single colon : in the resourceName (e.g., group:info) became illegal, although the comment in the code suggests that they should remain legal:

Stack, Project, and Name Regex: These are strings that do not contain ::.

Was this change intentional?

Thanks!

lbialy commented 4 months ago

Possibly a mistake, let me investigate, we have few quick patches that are coming out very soon in 0.2.1 (core only, packages won't need to be republished, hence the change in versioning scheme for packages with patch version dropped).

pawelprazak commented 4 months ago

Looks like the answer is yes, anything is permitted as a resource name in Pulumi since November, including empty string: https://github.com/pulumi/pulumi/commit/516979770f11d3a426239429731cf9f327c38836

Thank you for the report, we plan to release 0.2.1 soon with few minor fixes like this one :)

lbialy commented 4 months ago

We are obviously not going to follow that folly to the letter. Empty strings make absolutely no sense for Stack names, Project names and Resource names. However, Pulumi's test suite does test against an URN with empty resource name. We are going to allow any garbage in resource names, including empty strings, if that's something that comes from the engine but still require non-empty strings that adhere to the spec from our users because why propagate a mistake.

dubinsky commented 4 months ago

anything is permitted as a resource name in Pulumi since November require non-empty strings that adhere to the spec from our users

I am pretty sure that colon was allowed in the resource name even before November; thank you for fixing it soon!

lbialy commented 4 months ago

I got tests green few minutes ago, adding cases to catch garbage in compile time but allow garbage when coming from the wire :shrug:

On Mon 12. Feb 2024 at 16:01, Leonid Dubinsky @.***> wrote:

anything is permitted as a resource name in Pulumi since November require non-empty strings that adhere to the spec from our users

I am pretty sure that colon was allowed in the resource name even before November; thank you for fixing it soon!

— Reply to this email directly, view it on GitHub https://github.com/VirtusLab/besom/issues/387#issuecomment-1938844076, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACBVNURGKDTVWJE2BPIMRK3YTIVFBAVCNFSM6AAAAABDD73RLWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZYHA2DIMBXGY . You are receiving this because you commented.Message ID: @.***>