https://pulumi.com logo
#yaml
Title
# yaml
g

gifted-gigabyte-53859

01/09/2024, 8:41 AM
Is it possible to use yaml anchors with Pulumi?
I tried
Copy code
# Pulumi.yaml

name: my-app
runtime: yaml
description: my app

# template
tags: &defaultTags
  Environment: ${pulumi.stack}
  CreatedBy: pulumi

resources:
  ####################################
  # L O G   G R O U P S
  # --------------------------------
  # <https://www.pulumi.com/registry/packages/aws/api->  docs/cloudwatch/loggroup/
  ####################################

  # template for log groups
  logGroupTemplate: &logGroupTemplate
    type: aws:cloudwatch:LogGroup
    properties:
      tags:
        <<: *defaultTags
      logGroupClass: STANDARD
      retentionInDays: 731
      skipDestroy: True # leave logs there in case we want to go back to them. They'll fall off after the retention period

  # log group for lambda admin auth
  lg_lambda_admin_auth:
    <<: *logGroupTemplate
and am getting
Copy code
error: failed to discover plugin requirements: 
-error: Pulumi.yaml:1086,13-24: alias nodes are not supported; 
-error: Pulumi.yaml:1093,9-25: alias nodes are not supported;
f

fast-vase-27755

01/09/2024, 5:51 PM
but you can use variables and constants/configs.. looks like they replace the need of anchors
g

gifted-gigabyte-53859

01/10/2024, 2:49 AM
I don't see how that replaces the need for anchors. With anchors, I can avoid repeating many lines of code
f

fast-vase-27755

01/10/2024, 2:53 AM
if you need to split into multiple files you'll need smth like
spruce
anyway and with that there are virtually infinite possibilities for yaml
g

gifted-gigabyte-53859

01/10/2024, 2:58 AM
I may look into that, thanks. My Pulumi.yaml file is getting quite large 😅 nearly 3000 lines. But, we will likely start switching to a different language soon anyway, since yaml simply has some limitations that cannot be overcome, which are not present in a proper programming language. It is good for simpler projects though.