Skip to content

aq17/pulumi-yaml

 
 

Repository files navigation

PulumiYAML

A YAML (and JSON) language provider for Pulumi.

Preview

To use YAML language support in Pulumi, either:

  • Clone this repo and run make install to build from source.

  • Download the latest release for your platform and place pulumi-language-yaml on your PATH. This can be in ~/.pulumi/bin or any other location.

  • (Requires Pulumi 3.27.0) Configure a GitHub personal access token with the "repo" scope and set the GITHUB_TOKEN environment variable to your token before running:

    pulumi plugin install language yaml
    

Examples

See examples dir for tested examples.

The Pulumi Getting Started:

name: simple-yaml
runtime: yaml
resources:
  my-bucket:
    type: aws:s3:Bucket
    properties:
      website:
        indexDocument: index.html
  index.html:
    type: aws:s3:BucketObject
    properties:
      bucket: ${my-bucket}
      source:
        Fn::StringAsset: <h1>Hello, world!</h1>
      acl: public-read
      contentType: text/html
outputs:
  bucketEndpoint: http://${my-bucket.websiteEndpoint}

Webserver + kitchen sink (providers, config, resource options, invokes, interpolations):

name: webserver
runtime: yaml
description: Basic example of an AWS web server accessible over HTTP
configuration:
  InstanceType:
    default: t3.micro
variables:
  AmazonLinuxAmi:
    Fn::Invoke:
      Function: aws:getAmi
      Arguments:
        filters:
          - name: name
            values: ["amzn-ami-hvm-*-x86_64-ebs"]
        owners: ["137112412989"]
        mostRecent: true
      Return: id
resources:
  WebSecGrp:
    type: aws:ec2:SecurityGroup
    properties:
      ingress:
        - protocol: tcp
          fromPort: 80
          toPort: 80
          cidrBlocks: ["0.0.0.0/0"]
    protect: true
  WebServer:
    type: aws:ec2:Instance
    properties:
      instanceType: ${InstanceType}
      ami: ${AmazonLinuxAmi}
      userData: |-
          #!/bin/bash
          echo 'Hello, World from ${WebSecGrp.arn}!' > index.html
          nohup python -m SimpleHTTPServer 80 &
      vpcSecurityGroupIds:
        - ${WebSecGrp}
  UsEast2Provider:
    type: pulumi:providers:aws
    properties:
      region: us-east-2
  MyBucket:
    type: aws:s3:Bucket
    options:
      provider: ${UsEast2Provider}
outputs:
  InstanceId: ${WebServer.id}
  PublicIp: ${WebServer.publicIp}
  PublicHostName: ${WebServer.publicDns}

Spec

The specification for the Pulumi YAML format, and documentation for built-in functions, is in the Pulumi YAML reference.

Contribute to the specification by editing the markdown file in pulumi/pulumi-hugo.

About

YAML language provider for Pulumi

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 88.5%
  • Puppet 3.3%
  • Python 2.5%
  • TypeScript 2.4%
  • C# 2.4%
  • Makefile 0.6%
  • Other 0.3%