Yaml
Yaml is a data type used to save object definitions in YAML.
💡 Common yaml usage
The yaml property type can be used to store any key/value based data, for example:
- Configurations;
- Helm charts;
- Dictionaries/Hash maps;
- Manifests;
values.yml
;- etc.
In this live demo example, we can see the Helm Chart
yaml property. 🎬
API definition
- Basic
- Array
{
"myYAMLProp": {
"title": "My yaml",
"icon": "My icon",
"description": "My yaml property",
"type": "string",
"format": "yaml"
}
}
{
"myYamlArray": {
"title": "My yaml array",
"icon": "My icon",
"description": "My yaml array",
"type": "array",
"items": {
"type": "string",
"format": "yaml"
}
}
}
Check out Port's API reference to learn more.
Terraform definition
- Basic
- Array
resource "port_blueprint" "myBlueprint" {
# ...blueprint properties
properties = {
string_props = {
"myYamlProp" = {
title = "My yaml"
required = false
format = "yaml"
}
}
}
}
resource "port_blueprint" "myBlueprint" {
# ...blueprint properties
properties = {
array_props = {
"myYamlArray" = {
identifier = "myYamlArray"
title = "My yaml array"
required = false
string_items = {
format = "yaml"
}
}
}
}
}
Pulumi definition
- Basic
- Enum - coming soon
- Python
- TypeScript
- JavaScript
- GO
"""A Python Pulumi program"""
import pulumi
from port_pulumi import Blueprint,BlueprintPropertiesArgs,BlueprintPropertyArgs
blueprint = Blueprint(
"myBlueprint",
identifier="myBlueprint",
title="My Blueprint",
properties=BlueprintPropertiesArgs(
string_props={
"myYamlProp": BlueprintPropertyArgs(
title="My yaml",
required=False,
format="yaml",
)
}
),
relations={}
)
import * as pulumi from "@pulumi/pulumi";
import * as port from "@port-labs/port";
export const blueprint = new port.Blueprint("myBlueprint", {
identifier: "myBlueprint",
title: "My Blueprint",
properties: {
stringProps: {
myYamlProp: {
title: "My yaml",
required: false,
format: "yaml",
},
},
},
});
"use strict";
const pulumi = require("@pulumi/pulumi");
const port = require("@port-labs/port");
const entity = new port.Blueprint("myBlueprint", {
title: "My Blueprint",
identifier: "myBlueprint",
properties: {
stringProps: {
myYamlProp: {
title: "My yaml",
required: false,
format: "yaml",
},
},
},
relations: [],
});
exports.title = entity.title;
package main
import (
"github.com/port-labs/pulumi-port/sdk/go/port"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
blueprint, err := port.NewBlueprint(ctx, "myBlueprint", &port.BlueprintArgs{
Identifier: pulumi.String("myBlueprint"),
Title: pulumi.String("My Blueprint"),
Properties: port.BlueprintPropertiesArgs{
"myYAMLProp": port.BlueprintPropertiesStringPropsArgs{
Title: pulumi.String("My yaml"),
Required: pulumi.Bool(false),
Format: pulumi.String("yaml"),
},
},
})
ctx.Export("blueprint", blueprint.Title)
if err != nil {
return err
}
return nil
})
}