https://pulumi.com logo
Title
a

adventurous-mechanic-24805

02/03/2023, 4:14 PM
Hello Everyone, I am trying to use Pulumi with Yaml file and when I try to do
pulumi preview
, I get the following error:
Previewing update (shared.shared):
     Type                                     Name                       Plan       Info
 +   pulumi:pulumi:Stack                      svcmeshdemo-shared.shared  create
     └─ azure-native:resources:ResourceGroup  resourceGroup                         1 error


Diagnostics:
  azure-native:resources:ResourceGroup (resourceGroup):
    error: azure-native:resources:ResourceGroup resource 'resourceGroup' has a problem: 'resourceGroupName' does not match expression '^[-\w\._\(\)]+$'
My
Pulumi.yaml
file is as follows:
name: svcmeshdemo
runtime: yaml
description: A minimal Azure Native Pulumi YAML program
config:
  env:
    type: string
    default: ${env}
  project:
    type: string
    default: ${project}
  projectShort:
    type: string
    default: ${projectShort}
  customer:
    type: string
    default: ${customer}
  customerShort:
    type: string
    default: ${customerShort}
  namePrefix:
    type: string
    default: ${customerShort}-${projectShort}
  namePrefixCleaned:
    type: string
    default: ${customerShort}${projectShort}

resources:
  # Create an Azure Resource Group
  resourceGroup:
    type: azure-native:resources:ResourceGroup
    properties:
      resourceGroupName: ${namePrefix}-${env}
      tags:
        Project: ${project}
        Environment: ${env}
        Source: Pulumi
        Customer: ${customer}
        Creator: ${customer}
Does anyone know what the problem is and how to fix it? Thanks 🙂
m

melodic-tomato-39005

02/03/2023, 4:28 PM
Hi @adventurous-mechanic-24805, it depends on the value of
resourceGroupName
, so on the values of
customerShort
,
projectShort
, and
env
. Somehow the resulting name is invalid. Does
env
maybe end in a
.
?
a

adventurous-mechanic-24805

02/03/2023, 4:39 PM
You maybe right. When you mention the
env
, does it take the pulumi stack environment or the
env
from
Pulumi.shared.shared.yaml
because the environment is
shared.shared
, but I want to reference it from the
Pulumi.shared.shared.yaml
whose value is
shared
m

melodic-tomato-39005

02/03/2023, 4:47 PM
I’m not sure where
env
is from. I’m not super familiar with Pulumi yaml and it’s actually not mentioned on https://www.pulumi.com/docs/reference/yaml/.
a

adventurous-mechanic-24805

02/03/2023, 6:29 PM
I figured out the problem. It was this part:
${namePrefix}-${env}
I resolved it by replacing
config
with
variables
because I am reusing the variables. But, thank you anyways