1. Packages
  2. Zitadel
  3. API Docs
  4. MachineKey
zitadel v0.2.0 published on Monday, Mar 24, 2025 by pulumiverse

zitadel.MachineKey

Explore with Pulumi AI

Resource representing a machine key

Example Usage

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Zitadel = Pulumiverse.Zitadel;

return await Deployment.RunAsync(() => 
{
    var @default = new Zitadel.MachineKey("default", new()
    {
        OrgId = defaultZitadelOrg.Id,
        UserId = defaultZitadelMachineUser.Id,
        KeyType = "KEY_TYPE_JSON",
        ExpirationDate = "2519-04-01T08:45:00Z",
    });

});
Copy
package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumiverse/pulumi-zitadel/sdk/go/zitadel"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := zitadel.NewMachineKey(ctx, "default", &zitadel.MachineKeyArgs{
			OrgId:          pulumi.Any(defaultZitadelOrg.Id),
			UserId:         pulumi.Any(defaultZitadelMachineUser.Id),
			KeyType:        pulumi.String("KEY_TYPE_JSON"),
			ExpirationDate: pulumi.String("2519-04-01T08:45:00Z"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.zitadel.MachineKey;
import com.pulumi.zitadel.MachineKeyArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var default_ = new MachineKey("default", MachineKeyArgs.builder()        
            .orgId(defaultZitadelOrg.id())
            .userId(defaultZitadelMachineUser.id())
            .keyType("KEY_TYPE_JSON")
            .expirationDate("2519-04-01T08:45:00Z")
            .build());

    }
}
Copy
import * as pulumi from "@pulumi/pulumi";
import * as zitadel from "@pulumiverse/zitadel";

const _default = new zitadel.MachineKey("default", {
    orgId: defaultZitadelOrg.id,
    userId: defaultZitadelMachineUser.id,
    keyType: "KEY_TYPE_JSON",
    expirationDate: "2519-04-01T08:45:00Z",
});
Copy
import pulumi
import pulumiverse_zitadel as zitadel

default = zitadel.MachineKey("default",
    org_id=default_zitadel_org["id"],
    user_id=default_zitadel_machine_user["id"],
    key_type="KEY_TYPE_JSON",
    expiration_date="2519-04-01T08:45:00Z")
Copy
resources:
  default:
    type: zitadel:MachineKey
    properties:
      orgId: ${defaultZitadelOrg.id}
      userId: ${defaultZitadelMachineUser.id}
      keyType: KEY_TYPE_JSON
      expirationDate: 2519-04-01T08:45:00Z
Copy

Create MachineKey Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new MachineKey(name: string, args: MachineKeyArgs, opts?: CustomResourceOptions);
@overload
def MachineKey(resource_name: str,
               args: MachineKeyArgs,
               opts: Optional[ResourceOptions] = None)

@overload
def MachineKey(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               key_type: Optional[str] = None,
               user_id: Optional[str] = None,
               expiration_date: Optional[str] = None,
               org_id: Optional[str] = None)
func NewMachineKey(ctx *Context, name string, args MachineKeyArgs, opts ...ResourceOption) (*MachineKey, error)
public MachineKey(string name, MachineKeyArgs args, CustomResourceOptions? opts = null)
public MachineKey(String name, MachineKeyArgs args)
public MachineKey(String name, MachineKeyArgs args, CustomResourceOptions options)
type: zitadel:MachineKey
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. MachineKeyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. MachineKeyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. MachineKeyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. MachineKeyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. MachineKeyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var machineKeyResource = new Zitadel.MachineKey("machineKeyResource", new()
{
    KeyType = "string",
    UserId = "string",
    ExpirationDate = "string",
    OrgId = "string",
});
Copy
example, err := zitadel.NewMachineKey(ctx, "machineKeyResource", &zitadel.MachineKeyArgs{
	KeyType:        pulumi.String("string"),
	UserId:         pulumi.String("string"),
	ExpirationDate: pulumi.String("string"),
	OrgId:          pulumi.String("string"),
})
Copy
var machineKeyResource = new MachineKey("machineKeyResource", MachineKeyArgs.builder()
    .keyType("string")
    .userId("string")
    .expirationDate("string")
    .orgId("string")
    .build());
Copy
machine_key_resource = zitadel.MachineKey("machineKeyResource",
    key_type="string",
    user_id="string",
    expiration_date="string",
    org_id="string")
Copy
const machineKeyResource = new zitadel.MachineKey("machineKeyResource", {
    keyType: "string",
    userId: "string",
    expirationDate: "string",
    orgId: "string",
});
Copy
type: zitadel:MachineKey
properties:
    expirationDate: string
    keyType: string
    orgId: string
    userId: string
Copy

MachineKey Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The MachineKey resource accepts the following input properties:

KeyType
This property is required.
Changes to this property will trigger replacement.
string
Type of the machine key, supported values: KEYTYPEUNSPECIFIED, KEYTYPEJSON
UserId
This property is required.
Changes to this property will trigger replacement.
string
ID of the user
ExpirationDate Changes to this property will trigger replacement. string
Expiration date of the machine key in the RFC3339 format
OrgId Changes to this property will trigger replacement. string
ID of the organization
KeyType
This property is required.
Changes to this property will trigger replacement.
string
Type of the machine key, supported values: KEYTYPEUNSPECIFIED, KEYTYPEJSON
UserId
This property is required.
Changes to this property will trigger replacement.
string
ID of the user
ExpirationDate Changes to this property will trigger replacement. string
Expiration date of the machine key in the RFC3339 format
OrgId Changes to this property will trigger replacement. string
ID of the organization
keyType
This property is required.
Changes to this property will trigger replacement.
String
Type of the machine key, supported values: KEYTYPEUNSPECIFIED, KEYTYPEJSON
userId
This property is required.
Changes to this property will trigger replacement.
String
ID of the user
expirationDate Changes to this property will trigger replacement. String
Expiration date of the machine key in the RFC3339 format
orgId Changes to this property will trigger replacement. String
ID of the organization
keyType
This property is required.
Changes to this property will trigger replacement.
string
Type of the machine key, supported values: KEYTYPEUNSPECIFIED, KEYTYPEJSON
userId
This property is required.
Changes to this property will trigger replacement.
string
ID of the user
expirationDate Changes to this property will trigger replacement. string
Expiration date of the machine key in the RFC3339 format
orgId Changes to this property will trigger replacement. string
ID of the organization
key_type
This property is required.
Changes to this property will trigger replacement.
str
Type of the machine key, supported values: KEYTYPEUNSPECIFIED, KEYTYPEJSON
user_id
This property is required.
Changes to this property will trigger replacement.
str
ID of the user
expiration_date Changes to this property will trigger replacement. str
Expiration date of the machine key in the RFC3339 format
org_id Changes to this property will trigger replacement. str
ID of the organization
keyType
This property is required.
Changes to this property will trigger replacement.
String
Type of the machine key, supported values: KEYTYPEUNSPECIFIED, KEYTYPEJSON
userId
This property is required.
Changes to this property will trigger replacement.
String
ID of the user
expirationDate Changes to this property will trigger replacement. String
Expiration date of the machine key in the RFC3339 format
orgId Changes to this property will trigger replacement. String
ID of the organization

Outputs

All input properties are implicitly available as output properties. Additionally, the MachineKey resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
KeyDetails string
Value of the machine key
Id string
The provider-assigned unique ID for this managed resource.
KeyDetails string
Value of the machine key
id String
The provider-assigned unique ID for this managed resource.
keyDetails String
Value of the machine key
id string
The provider-assigned unique ID for this managed resource.
keyDetails string
Value of the machine key
id str
The provider-assigned unique ID for this managed resource.
key_details str
Value of the machine key
id String
The provider-assigned unique ID for this managed resource.
keyDetails String
Value of the machine key

Look up Existing MachineKey Resource

Get an existing MachineKey resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: MachineKeyState, opts?: CustomResourceOptions): MachineKey
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        expiration_date: Optional[str] = None,
        key_details: Optional[str] = None,
        key_type: Optional[str] = None,
        org_id: Optional[str] = None,
        user_id: Optional[str] = None) -> MachineKey
func GetMachineKey(ctx *Context, name string, id IDInput, state *MachineKeyState, opts ...ResourceOption) (*MachineKey, error)
public static MachineKey Get(string name, Input<string> id, MachineKeyState? state, CustomResourceOptions? opts = null)
public static MachineKey get(String name, Output<String> id, MachineKeyState state, CustomResourceOptions options)
resources:  _:    type: zitadel:MachineKey    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
ExpirationDate Changes to this property will trigger replacement. string
Expiration date of the machine key in the RFC3339 format
KeyDetails string
Value of the machine key
KeyType Changes to this property will trigger replacement. string
Type of the machine key, supported values: KEYTYPEUNSPECIFIED, KEYTYPEJSON
OrgId Changes to this property will trigger replacement. string
ID of the organization
UserId Changes to this property will trigger replacement. string
ID of the user
ExpirationDate Changes to this property will trigger replacement. string
Expiration date of the machine key in the RFC3339 format
KeyDetails string
Value of the machine key
KeyType Changes to this property will trigger replacement. string
Type of the machine key, supported values: KEYTYPEUNSPECIFIED, KEYTYPEJSON
OrgId Changes to this property will trigger replacement. string
ID of the organization
UserId Changes to this property will trigger replacement. string
ID of the user
expirationDate Changes to this property will trigger replacement. String
Expiration date of the machine key in the RFC3339 format
keyDetails String
Value of the machine key
keyType Changes to this property will trigger replacement. String
Type of the machine key, supported values: KEYTYPEUNSPECIFIED, KEYTYPEJSON
orgId Changes to this property will trigger replacement. String
ID of the organization
userId Changes to this property will trigger replacement. String
ID of the user
expirationDate Changes to this property will trigger replacement. string
Expiration date of the machine key in the RFC3339 format
keyDetails string
Value of the machine key
keyType Changes to this property will trigger replacement. string
Type of the machine key, supported values: KEYTYPEUNSPECIFIED, KEYTYPEJSON
orgId Changes to this property will trigger replacement. string
ID of the organization
userId Changes to this property will trigger replacement. string
ID of the user
expiration_date Changes to this property will trigger replacement. str
Expiration date of the machine key in the RFC3339 format
key_details str
Value of the machine key
key_type Changes to this property will trigger replacement. str
Type of the machine key, supported values: KEYTYPEUNSPECIFIED, KEYTYPEJSON
org_id Changes to this property will trigger replacement. str
ID of the organization
user_id Changes to this property will trigger replacement. str
ID of the user
expirationDate Changes to this property will trigger replacement. String
Expiration date of the machine key in the RFC3339 format
keyDetails String
Value of the machine key
keyType Changes to this property will trigger replacement. String
Type of the machine key, supported values: KEYTYPEUNSPECIFIED, KEYTYPEJSON
orgId Changes to this property will trigger replacement. String
ID of the organization
userId Changes to this property will trigger replacement. String
ID of the user

Import

bash The resource can be imported using the ID format <id:user_id[:org_id][:key_details]>, e.g.

 $ pulumi import zitadel:index/machineKey:MachineKey imported '123456789012345678:123456789012345678:123456789012345678:{"type":"serviceaccount","keyId":"123456789012345678","key":"-----BEGIN RSA PRIVATE KEY-----\nMIIEpQ...-----END RSA PRIVATE KEY-----\n","userId":"123456789012345678"}'
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
zitadel pulumiverse/pulumi-zitadel
License
Apache-2.0
Notes
This Pulumi package is based on the zitadel Terraform Provider.