Hello, I’m using the Automation API to implement a...
# automation-api
l
Hello, I’m using the Automation API to implement an integration for Pulumi with Concourse CI: https://github.com/ringods/pulumi-resource/ Any resource (Concourse term) you use in a build pipeline is configured in YAML. You have the identification of the resource and some parameters. For example, to apply a Pulumi stack, this is the snippet I intend to use:
Copy code
resource_types:
- name: pulumi
  type: docker-image
  source:
    repository: <http://ghcr.io/ringods/pulumi-resource|ghcr.io/ringods/pulumi-resource>
    tag: v0.0.6

resources:
  - name: myinfracode
    type: pulumi
    source:
      organization: companyname
      project: network
      stack: staging
      token: pul-XXXXXXXXXXXXXXXXX

jobs:
  - name: nextstack
    plan:
      - task: build-artifact
        ...
      - put: myinfracode
        params:
          aws:region: eu-west-1
          network:cidr: 'x.x.x.x'
In my Concourse resource, I want to allow anything in the
params
section above which is valid Pulumi stack config (nested et all). In my resource implementation, I get this passed as JSON though:
Copy code
{
  "source": {
    "organization": "company",
    "project": "network",
    "stack": "staging",
    "token": "pul-XXXXXXXXXXXXXXXXX"
  },
  "params": {
    "aws:region": "eu-west-1",
    "network:cidr": "x.x.x.x"
  }
}
The
source
section is specific to Pulumi, but the
params
is the JSON equivalent of what I configured as YAML in my pipeline. Is there any function in the Pulumi code base that can Unmarshal this to a Pulumi type representing this Config?
p
If you use structured config, you can assign the whole json to a particular config key, sending the JSON object as string