Pulumi
Our integration with Pulumi allows you to combine the state of your infrastructure with the entities representing them in Port.
By using Port's Pulumi provider you make it easy to integrate Port with your existing IaC definitions, every resource provisioned by Pulumi can also be reported to the software catalog using the same definition file.
💡 Pulumi provider common use cases​
Our Pulumi provider makes it easy to fill the software catalog with data directly from your IaC definitions, for example:
- Report cloud accounts.
- Report databases.
- Report lambdas and managed Kubernetes services (EKS, AKS, GKE, etc.).
Installation​
To install and use Port's Pulumi provider, you will need to install the Pulumi CLI
To install the Pulumi provider, use your preferred method of installing Pulumi providers.
- Pip
- Yarn
- NPM
- GO
pip install port_pulumi
yarn add @port-labs/port
npm install @port-labs/port
go get github.com/port-labs/pulumi-port/sdk
Configuration​
Please make sure to configure the clientId and secret to Port using the commands
Get your Port credentials
To get your Port credentials, go to your Port application, click on the ...
button in the top right corner, and select Credentials
. Here you can view and copy your CLIENT_ID
and CLIENT_SECRET
:
pulumi config set port:clientId <clientId>
pulumi config set port:secret <clientSecret> --secret
pulumi config set port:baseUrl <baseUrl>
The baseUrl
, port_region
, port.baseUrl
, portBaseUrl
, port_base_url
and OCEAN__PORT__BASE_URL
parameters are used to select which instance or Port API will be used.
Port exposes two API instances, one for the EU region of Port, and one for the US region of Port.
- If you use the EU region of Port (https://app.getport.io), your API URL is
https://api.getport.io
. - If you use the US region of Port (https://app.us.getport.io), your API URL is
https://api.us.getport.io
.
Pulumi definition structure​
Port's Pulumi provider supports The following resources to ingest data to the catalog:
Entity
​
The Entity
resource defines a basic entity:
- Python
- TypeScript
- JavaScript
- GO
"""A Python Pulumi program"""
import pulumi
from port_pulumi import Entity,BlueprintPropertiesArgs
entity = Entity(
"myEntity",
title="My Entity",
blueprint="myBlueprint",
properties=BlueprintPropertiesArgs(),
relations={}
)
import * as pulumi from "@pulumi/pulumi";
import { Entity } from "@port-labs/port";
export const entity = new Entity("myEntity", {
title: "My Entity",
blueprint: "myBlueprint",
properties: {},
relations: {},
});
"use strict";
const pulumi = require("@pulumi/pulumi");
const port = require("@port-labs/port");
const entity = new Entity("myEntity", {
title: "My Entity",
blueprint: "myBlueprint",
properties: {},
relations: {},
});
exports.title = entity.title;
// A Go Pulumi program
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/port-labs/pulumi-port/sdk/go/port"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
entity, err := port_pulumi.NewEntity(ctx, "myEntity", &port_pulumi.EntityArgs{
Title: pulumi.String("My Entity"),
Blueprint: pulumi.String("myBlueprint"),
Properties: port.EntityPropertiesArgs{},
Relations: port.EntityRelations{},
})
if err != nil {
return err
}
ctx.Export("entityId", entity.ID())
return nil
})
}
The following parameters are required:
blueprint
- the identifier of the blueprint to create this entity from;title
- the title of the entity;- One or more
properties
schema definitions.
It is also possible to specify the following parameters as part of the port_entity
resource:
identifier
- the identifier of the entity;- If an
identifier
is not provided, an identifier will be autogenerated.
- If an
team
- the team that owns the entity;teams
- an array of teams that own the entity;run_id
- the run ID of the action that created the entity.
properties
schema​
The properties
schema assigns a specified value to one of the entity's properties.
Definition​
- String
- Number
- Boolean
- Object
- Array
- URL
- User
- Team
- Datetime
- Timer
- YAML
- Python
- TypeScript
- JavaScript
- GO
"""A Python Pulumi program"""
from port_pulumi import Entity,EntityPropertiesArgs
entity = Entity(
"myEntity",
identifier="myEntity",
title="My Entity",
blueprint="myBlueprint",
properties=EntityPropertiesArgs(
string_props={
"myStringProp": "My string"
}
),
relations={}
)
import * as pulumi from "@pulumi/pulumi";
import { Entity } from "@port-labs/port";
export const entity = new Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {
stringProps: {
myStringProp: {
title: "My string",
required: false
}
}
},
relations: {},
});
"use strict";
const pulumi = require("@pulumi/pulumi");
const port = require("@port-labs/port");
const entity = new port.Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {
stringProps: {
myStringProp: {
title: "My string",
required: false
}
}
},
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 {
entity, err := port.NewEntity(ctx, "entity", &port.EntityArgs{
Identifier: pulumi.String("myEntity"),
Title: pulumi.String("My Entity"),
Blueprint: pulumi.String("myBlueprint"),
Properties: port.EntityPropertiesArgs{
StringProps: pulumi.StringMap{
"myStringProp": pulumi.String("myStringValue"),
},
},
})
ctx.Export("entity", entity.Title)
if err != nil {
return err
}
return nil
})
}
- Python
- TypeScript
- JavaScript
- GO
"""A Python Pulumi program"""
import pulumi
from port_pulumi import Entity,EntityPropertiesArgs
entity = Entity(
"myEntity",
identifier="myEntity",
title="My Entity",
blueprint="myBlueprint",
properties=EntityPropertiesArgs(
number_props={
"myNumberProp": 7,
}
),
relations=[])
import * as pulumi from "@pulumi/pulumi";
import { Entity } from "@port-labs/port";
export const entity = new Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {
numberProps: {
"myNumberProp": 7
}
},
relations: {}
});
"use strict";
const pulumi = require("@pulumi/pulumi");
const port = require("@port-labs/port");
const entity = new Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {
numberProps: {
"myNumberProp": 7
}
},
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 {
entity, err := port.NewEntity(ctx, "entity", &port.EntityArgs{
Identifier: pulumi.String("myEntity"),
Title: pulumi.String("My Entity"),
Blueprint: pulumi.String("myBlueprint"),
Properties: port.EntityPropertiesArgs{
NumberProps: pulumi.Float64Map{
"myNumberProp": pulumi.Float64(7),
},
},
})
ctx.Export("entity", entity.Title)
if err != nil {
return err
}
return nil
})
}
- Python
- TypeScript
- JavaScript
- GO
"""A Python Pulumi program"""
import pulumi
from port_pulumi import Entity,EntityPropertiesArgs
entity = Entity(
"myEntity",
identifier="myEntity",
title="My Entity",
blueprint="myBlueprint",
properties=EntityPropertiesArgs(
boolean_props={
"myBooleanProp": True
},
),
relations={}
)
import * as pulumi from "@pulumi/pulumi";
import { Entity } from "@port-labs/port";
export const entity = new Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {
booleanProps: {
"myBooleanProp": true
}
},
relations: {},
});
"use strict";
const pulumi = require("@pulumi/pulumi");
const port = require("@port-labs/port");
const entity = new Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {
booleanProps: {
"myBooleanProp": true
}
},
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 {
entity, err := port.NewEntity(ctx, "entity", &port.EntityArgs{
Identifier: pulumi.String("myEntity"),
Title: pulumi.String("My Entity"),
Blueprint: pulumi.String("myBlueprint"),
Properties: port.EntityPropertiesArgs{
BooleanProps: pulumi.BoolMap{
"myBooleanProp": pulumi.Bool(true),
},
},
})
ctx.Export("entity", entity.Title)
if err != nil {
return err
}
return nil
})
}
- Python
- TypeScript
- JavaScript
- GO
"""A Python Pulumi program"""
import json
import pulumi
from port_pulumi import Entity,EntityPropertiesArgs
entity = Entity(
"myEntity",
identifier="myEntity",
title="My Entity",
blueprint="myBlueprint",
properties=EntityPropertiesArgs(
object_props={
"myObjectProp": json.dumps({"hello": "world"})
}
),
relations={}
)
import * as pulumi from "@pulumi/pulumi";
import { Entity } from "@port-labs/port";
export const entity = new Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {
objectProps: {
"myObjectProp": JSON.stringify({hello: "world"})
}
},
relations: {},
});
"use strict";
const pulumi = require("@pulumi/pulumi");
const port = require("@port-labs/port");
const entity = new Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {
objectProps: {
"myObjectProp": JSON.stringify({hello: "world"})
}
},
relations: {},
});
exports.title = entity.title;
package main
import (
"encoding/json"
"github.com/port-labs/pulumi-port/sdk/go/port"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
obj := map[string]string{"hello": "world"}
objStr, err := json.Marshal(obj)
if err != nil {
panic(err)
}
pulumi.Run(func(ctx *pulumi.Context) error {
entity, err := port.NewEntity(ctx, "entity", &port.EntityArgs{
Identifier: pulumi.String("myEntity"),
Title: pulumi.String("My Entity"),
Blueprint: pulumi.String("myBlueprint"),
Properties: port.EntityPropertiesArgs{
ObjectProps: pulumi.StringMap{
"myObjectProperty": pulumi.String(objStr),
},
},
})
ctx.Export("entity", entity.Title)
if err != nil {
return err
}
return nil
})
}
- Python
- TypeScript
- JavaScript
- GO
"""A Python Pulumi program"""
import json
import pulumi
from port_pulumi import Entity,EntityPropertiesArgs
entity = Entity(
"myEntity",
identifier="myEntity",
title="My Entity",
blueprint="myBlueprint",
properties=EntityPropertiesArgs(
array_props={
"myArrayProp": ["hello", "world"]
}
),
relations={}
)
import * as pulumi from "@pulumi/pulumi";
import { Entity } from "@port-labs/port";
export const entity = new Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {
arrayProps: {
stringItems: {
"myArrayProp": ["a", "b", "c"]
}
}
},
relations: {},
});
"use strict";
const pulumi = require("@pulumi/pulumi");
const port = require("@port-labs/port");
const entity = new Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {
arrayProps: {
stringItems: {
"myArrayProp": ["a", "b", "c"]
}
}
},
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 {
entity, err := port.NewEntity(ctx, "entity", &port.EntityArgs{
Identifier: pulumi.String("myEntity"),
Title: pulumi.String("My Entity"),
Blueprint: pulumi.String("myBlueprint"),
Properties: port.EntityPropertiesArgs{
ArrayProps: port.EntityPropertiesArrayPropsArgs{
StringItems: pulumi.StringArrayMap{
"myArrayProp": pulumi.StringArray{
pulumi.String("hello"),
pulumi.String("world"),
pulumi.String("!"),
},
},
},
},
})
ctx.Export("entity", entity.Title)
if err != nil {
return err
}
return nil
})
}
- Python
- TypeScript
- JavaScript
- GO
"""A Python Pulumi program"""
import json
import pulumi
from port_pulumi import Entity,EntityPropertiesArgs
entity = Entity(
"myEntity",
identifier="myEntity",
title="My Entity",
blueprint="myBlueprint",
properties=EntityPropertiesArgs(
string_props={
"myUrlProp": "https://example.com"
}
),
relations={}
)
import * as pulumi from "@pulumi/pulumi";
import { Entity } from "@port-labs/port";
export const entity = new Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {
stringProps: {
myUrlProp: "https://example.com",
}
},
relations: {},
});
"use strict";
const pulumi = require("@pulumi/pulumi");
const port = require("@port-labs/port");
const entity = new Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {
stringProps: {
myUrlProp: "https://example.com",
}
},
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 {
entity, err := port.NewEntity(ctx, "entity", &port.EntityArgs{
Identifier: pulumi.String("myEntity"),
Title: pulumi.String("My Entity"),
Blueprint: pulumi.String("myBlueprint"),
Properties: port.EntityPropertiesArgs{
StringProps: pulumi.StringMap{
"myUrlProp": pulumi.String("https://example.com"),
},
},
})
ctx.Export("entity", entity.Title)
if err != nil {
return err
}
return nil
})
}
- Python
- TypeScript
- JavaScript
- GO
"""A Python Pulumi program"""
import json
import pulumi
from port_pulumi import Entity
entity = Entity(
"myEntity",
identifier="myEntity",
title="My Entity",
blueprint="myBlueprint",
properties=EntityPropertiesArgs(
string_props={
"myEmailProp": "me@example.com"
}
),
relations={}
)
import * as pulumi from "@pulumi/pulumi";
import { Entity } from "@port-labs/port";
export const entity = new Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {
stringProps: {
myEmailProp: "me@example.com",
}
},
relations: {},
});
"use strict";
const pulumi = require("@pulumi/pulumi");
const port = require("@port-labs/port");
const entity = new Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {
stringProps: {
myEmailProp: "me@example.com",
}
},
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 {
entity, err := port.NewEntity(ctx, "entity", &port.EntityArgs{
Identifier: pulumi.String("myEntity"),
Title: pulumi.String("My Entity"),
Blueprint: pulumi.String("myBlueprint"),
Properties: port.EntityPropertiesArgs{
StringProps: pulumi.StringMap{
"myEmailProp": pulumi.String("me@example.com"),
},
},
})
ctx.Export("entity", entity.Title)
if err != nil {
return err
}
return nil
})
}
- Python
- TypeScript
- JavaScript
- GO
"""A Python Pulumi program"""
import json
import pulumi
from port_pulumi import Entity,EntityPropertiesArgs
entity = Entity(
"myEntity",
identifier="myEntity",
title="My Entity",
blueprint="myBlueprint",
properties=EntityPropertiesArgs(
string_props={
"myUserProp": "argo-admin"
}
),
relations={}
)
import * as pulumi from "@pulumi/pulumi";
import { Entity } from "@port-labs/port";
export const entity = new Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {
stringProps: {
myUserProp: "argo-admin",
}
},
relations: {},
});
"use strict";
const pulumi = require("@pulumi/pulumi");
const port = require("@port-labs/port");
const entity = new Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {
stringProps: {
myUserProp: "argo-admin",
}
},
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 {
entity, err := port.NewEntity(ctx, "entity", &port.EntityArgs{
Identifier: pulumi.String("myEntity"),
Title: pulumi.String("My Entity"),
Blueprint: pulumi.String("myBlueprint"),
Properties: port.EntityPropertiesArgs{
StringProps: pulumi.StringMap{
"myUserProp": pulumi.String("argo-admin"),
},
},
})
ctx.Export("entity", entity.Title)
if err != nil {
return err
}
return nil
})
}
- Python
- TypeScript
- JavaScript
- GO
"""A Python Pulumi program"""
import json
import pulumi
from port_pulumi import Entity,EntityPropertiesArgs
entity = Entity(
"myEntity",
identifier="myEntity",
title="My Entity",
blueprint="myBlueprint",
properties=EntityPropertiesArgs(
string_props={
"myTeamProp": "My string"
}
),
relations={}
)
import * as pulumi from "@pulumi/pulumi";
import { Entity } from "@port-labs/port";
export const entity = new Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {
stringProps: {
myTeamProp: "argo-admins",
}
},
relations: {},
});
"use strict";
const pulumi = require("@pulumi/pulumi");
const port = require("@port-labs/port");
const entity = new Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {
stringProps: {
myTeamProp: "argo-admins",
}
},
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 {
entity, err := port.NewEntity(ctx, "entity", &port.EntityArgs{
Identifier: pulumi.String("myEntity"),
Title: pulumi.String("My Entity"),
Blueprint: pulumi.String("myBlueprint"),
Properties: port.EntityPropertiesArgs{
StringProps: pulumi.StringMap{
"myTeamProp": pulumi.String("argo-admins"),
},
},
})
ctx.Export("entity", entity.Title)
if err != nil {
return err
}
return nil
})
}
- Python
- TypeScript
- JavaScript
- GO
"""A Python Pulumi program"""
import json
import pulumi
from port_pulumi import Entity
entity = Entity(
"myEntity",
identifier="myEntity",
title="My Entity",
blueprint="myBlueprint",
properties=port.EntityPropertiesArgs(
string_props={
"myDatetimeProp": "2022-04-18T11:44:15.345Z"
}
),
relations={}
)
import * as pulumi from "@pulumi/pulumi";
import { Entity } from "@port-labs/port";
export const entity = new Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {
stringProps: {
myDatetimeProp: "2022-04-18T11:44:15.345Z",
}
},
relations: {},
});
"use strict";
const pulumi = require("@pulumi/pulumi");
const port = require("@port-labs/port");
const entity = new Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {
stringProps: {
myDatetimeProp: "2022-04-18T11:44:15.345Z",
}
},
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 {
entity, err := port.NewEntity(ctx, "entity", &port.EntityArgs{
Identifier: pulumi.String("myEntity"),
Title: pulumi.String("My Entity"),
Blueprint: pulumi.String("myBlueprint"),
Properties: port.EntityPropertiesArgs{
StringProps: pulumi.StringMap{
"myDatetimeProp": pulumi.String("2022-04-18T11:44:15.345Z"),
},
},
})
ctx.Export("entity", entity.Title)
if err != nil {
return err
}
return nil
})
}
- Python
- TypeScript
- JavaScript
- GO
"""A Python Pulumi program"""
import json
import pulumi
from port_pulumi import Entity,EntityPropertiesArgs
entity = Entity(
"myEntity",
identifier="myEntity",
title="My Entity",
blueprint="myBlueprint",
properties=EntityPropertiesArgs(
string_props={
"myTimerProp": "2022-04-18T11:44:15.345Z"
}
),
relations={}
)
import * as pulumi from "@pulumi/pulumi";
import { Entity } from "@port-labs/port";
export const entity = new Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {
stringProps: {
myTimerProp: "2022-04-18T11:44:15.345Z",
}
},
relations: {},
});
"use strict";
const pulumi = require("@pulumi/pulumi");
const port = require("@port-labs/port");
const entity = new Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {
stringProps: {
myTimerProp: "2022-04-18T11:44:15.345Z",
}
},
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 {
entity, err := port.NewEntity(ctx, "entity", &port.EntityArgs{
Identifier: pulumi.String("myEntity"),
Title: pulumi.String("My Entity"),
Blueprint: pulumi.String("myBlueprint"),
Properties: port.EntityPropertiesArgs{
StringProps: pulumi.StringMap{
"myTimerProp": pulumi.String("2022-04-18T11:44:15.345Z"),
},
},
})
ctx.Export("entity", entity.Title)
if err != nil {
return err
}
return nil
})
}
- Python
- TypeScript
- JavaScript
- GO
"""A Python Pulumi program"""
import json
import pulumi
from port_pulumi import Entity,EntityPropertiesArgs
entity = Entity(
"myEntity",
identifier="myEntity",
title="My Entity",
blueprint="myBlueprint",
properties=EntityPropertiesArgs(
string_props={
"myYAMLProp": "my: yaml"
}
),
relations={}
)
import * as pulumi from "@pulumi/pulumi";
import { Entity } from "@port-labs/port";
export const entity = new Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {
stringProps: {
myYAMLProp: "my: yaml",
}
},
relations: [],
});
"use strict";
const pulumi = require("@pulumi/pulumi");
const port = require("@port-labs/port");
const entity = new Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {
stringProps: {
myYAMLProp: "my: 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 {
entity, err := port.NewEntity(ctx, "entity", &port.EntityArgs{
Identifier: pulumi.String("myEntity"),
Title: pulumi.String("My Entity"),
Blueprint: pulumi.String("myBlueprint"),
Properties: port.EntityPropertiesArgs{
StringProps: pulumi.StringMap{
"myYAMLProp": pulumi.String("my: yaml"),
},
},
})
ctx.Export("entity", entity.Title)
if err != nil {
return err
}
return nil
})
}
The following parameters are required:
name
- the name of the property in the blueprint definition;value
- the value of the property (for non-array properties);items
- an array of values (for array properties).
relations
schema​
The relations
schema maps a target entity to the source entity definition:
- Python
- TypeScript
- JavaScript
- GO
"""A Python Pulumi program"""
import json
import pulumi
from port_pulumi import Entity,EntityRelationsArgs
entity = Entity(
"myEntity",
identifier="myEntity",
title="My Entity",
blueprint="myBlueprint",
properties={},
relations=EntityRelationsArgs(
many_relations={
"myManyRelation": ["myTargetEntityIdentifier", "myTargetEntityIdentifier2"]
},
single_relations={
"mySingleRelation": "myTargetEntityIdentifier"
},
),
)
import * as pulumi from "@pulumi/pulumi";
import { Entity } from "@port-labs/port";
export const entity = new Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {},
relations: {
singleRelations: {
myRelation: "myTargetEntityIdentifier"
},
manyRelations: {
myRelation: ["myTargetEntityIdentifier", "myTargetEntityIdentifier2"]
}
},
});
"use strict";
const pulumi = require("@pulumi/pulumi");
const port = require("@port-labs/port");
const entity = new Entity("myEntity", {
identifier: "myEntity",
title: "My Entity",
blueprint: "myBlueprint",
properties: {},
relations: {
singleRelations: {
myRelation: "myTargetEntityIdentifier"
},
manyRelations: {
myRelation: ["myTargetEntityIdentifier", "myTargetEntityIdentifier2"]
}
},
});
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 {
entity, err := port.NewEntity(ctx, "entity", &port.EntityArgs{
Identifier: pulumi.String("myEntity"),
Title: pulumi.String("My Entity"),
Blueprint: pulumi.String("myBlueprint"),
Relations: port.EntityRelationsArgs{
SingleRelations: pulumi.StringMap{
"mySingleRelation": pulumi.String("myTargetEntityIdentifier"),
},
ManyRelations: pulumi.StringArrayMap{
"myManyRelation": pulumi.StringArray{
pulumi.String("myTargetEntityIdentifier"),
pulumi.String("myTargetEntityIdentifier2"),
},
},
},
Properties: port.EntityPropertiesArgs{
// ..properties
},
})
ctx.Export("entity", entity.Title)
if err != nil {
return err
}
return nil
})
}
The following parameters are required:
name
- the name of the relation in the blueprint definition;identifier
- the identifier of the target entity.
Ingest data using the Pulumi provider​
To ingest data to the software catalog using the Pulumi provider, you will create an instance of port.Entity
resource in your preferred langauge:
- Create
- Update
- Delete
To create an entity using Pulumi, create a file in your prefered languague from and insert the following:
- Python
- TypeScript
- JavaScript
- GO
"""A Python Pulumi program"""
import pulumi
from port_pulumi import Entity
entity = Entity(
"myEntity",
title="My Entity",
blueprint="myBlueprint",
properties={},
relations={}
)
import * as pulumi from "@pulumi/pulumi";
import { Entity } from "@port-labs/port";
export const entity = new Entity("myEntity", {
title: "My Entity",
blueprint: "myBlueprint",
properties: {},
relations: {},
});
"use strict";
const pulumi = require("@pulumi/pulumi");
const port = require("@port-labs/port");
const entity = new Entity("myEntity", {
title: "My Entity",
blueprint: "myBlueprint",
properties: {},
relations: {},
});
exports.title = entity.title;
// A Go Pulumi program
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/port-labs/pulumi-port/sdk/go/port"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
entity, err := port_pulumi.NewEntity(ctx, "myEntity", &port_pulumi.EntityArgs{
Title: pulumi.String("My Entity"),
Blueprint: pulumi.String("myBlueprint"),
Properties: port.EntityPropertiesArgs{},
Relations: port.EntityRelationsArgs{},
})
if err != nil {
return err
}
ctx.Export("entityId", entity.ID())
return nil
})
}
Then run the following command to apply your changes and update the catalog:
pulumi up -y
After running these commands, you will see your catalog updated with the new entities.
To update an entity using Pulumi, update the existing port.Entity
resource in code file and then run pulumi up -y
.
It is also possible to start managing existing entities using Port's Pulumi provider, to begin managing an existing entity, add a new port.Entity
resource to your code file and make the desired changes
Important notes about adding existing entities to the Pulumi provider:
- It is important to specify the
identifier
of the entity, otherwise Pulumi will create a new entity with an autogenerated identifier. - Port's Pulumi provider uses the create/override strategy, meaning for an existing entity, any properties not defined in the resource definition will be overridden with empty values.
To delete an entity using Pulumi, simply remove the port.Entity
resource defined in code file and then run pulumi up -y
.