diff --git a/core/src/main/scala/besom/types.scala b/core/src/main/scala/besom/types.scala index 81700813..81fec3d6 100644 --- a/core/src/main/scala/besom/types.scala +++ b/core/src/main/scala/besom/types.scala @@ -181,7 +181,7 @@ object types: * * type = package ":" [ module ":" ] type name ; * package = identifier ; - * module = identifier ; + * module = identifier ; // this actually lies a bit because it has to allow "." * type name = identifier ; * identifier = unicode letter { unicode letter | unicode digit | "_" } ; // this actually lies a bit because it has to allow "/" * ``` @@ -202,7 +202,7 @@ object types: */ private inline val urnRegex = - """urn:pulumi:(?[^:]+|[^:]*::[^:]*)::(?[^:]+|[^:]*::[^:]*)::(?(?:(\p{L}[\p{L}\p{N}_/]*)(?::(\p{L}[\p{L}\p{N}_/]*))?:(\p{L}[\p{L}\p{N}_/]*)(?:\$))*)(?(\p{L}[\p{L}\p{N}_/]*)(?::(\p{L}[\p{L}\p{N}_/]*))?:(\p{L}[\p{L}\p{N}_/]*))::(?[^:]+|[^:]*::[^:]*)""" + """urn:pulumi:(?[^:]+|[^:]*::[^:]*)::(?[^:]+|[^:]*::[^:]*)::(?(?:(\p{L}[\p{L}\p{N}_/]*)(?::(\p{L}[\p{L}\p{N}_/\\.]*))?:(\p{L}[\p{L}\p{N}_/]*)(?:\$))*)(?(\p{L}[\p{L}\p{N}_/]*)(?::(\p{L}[\p{L}\p{N}_/\\.]*))?:(\p{L}[\p{L}\p{N}_/]*))::(?[^:]+|[^:]*::[^:]*)""" private[types] val UrnRegex = urnRegex.r diff --git a/core/src/test/scala/besom/util/URNTest.scala b/core/src/test/scala/besom/util/URNTest.scala index 208a025f..11e1ca46 100644 --- a/core/src/test/scala/besom/util/URNTest.scala +++ b/core/src/test/scala/besom/util/URNTest.scala @@ -25,6 +25,14 @@ class URNTest extends munit.FunSuite with CompileAssertions: "urn:pulumi:stack::project::pulumi:pulumi:Stack::stack-name" ) + val kubernetesIngressUrn = URN( + "urn:pulumi:stack::project::kubernetes:networking.k8s.io/v1:Ingress::my-ingress" + ) + + val doubleDottedResourceTypeUrn = URN( + "urn:pulumi:stack::project::custom:resources.example.org:Resource$besom:testing.example.com/test:Resource::my-test-resource" + ) + test("URN.apply should only work for correct URNs") { failsToCompile(""" import besom.types.URN