1. Packages
  2. Coder Provider
  3. API Docs
  4. AgentInstance
coder 2.4.0-pre1 published on Tuesday, Apr 15, 2025 by coder

coder.AgentInstance

Explore with Pulumi AI

coder logo
coder 2.4.0-pre1 published on Tuesday, Apr 15, 2025 by coder

    Use this resource to associate an instance ID with an agent for zero-trust authentication. This association is done automatically for "google_compute_instance", "aws_instance", "azurerm_linux_virtual_machine", and "azurerm_windows_virtual_machine" resources.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as coder from "@pulumi/coder";
    import * as google from "@pulumi/google";
    
    const devAgent = new coder.Agent("devAgent", {
        os: "linux",
        arch: "amd64",
        auth: "google-instance-identity",
    });
    const devgoogle_compute_instance = new google.index.Google_compute_instance("devgoogle_compute_instance", {zone: "us-central1-a"});
    const devAgentInstance = new coder.AgentInstance("devAgentInstance", {
        agentId: devAgent.agentId,
        instanceId: devgoogle_compute_instance.instanceId,
    });
    
    import pulumi
    import pulumi_coder as coder
    import pulumi_google as google
    
    dev_agent = coder.Agent("devAgent",
        os="linux",
        arch="amd64",
        auth="google-instance-identity")
    devgoogle_compute_instance = google.index.Google_compute_instance("devgoogle_compute_instance", zone=us-central1-a)
    dev_agent_instance = coder.AgentInstance("devAgentInstance",
        agent_id=dev_agent.agent_id,
        instance_id=devgoogle_compute_instance["instanceId"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-google/sdk/go/google"
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/coder/v2/coder"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		devAgent, err := coder.NewAgent(ctx, "devAgent", &coder.AgentArgs{
    			Os:   pulumi.String("linux"),
    			Arch: pulumi.String("amd64"),
    			Auth: pulumi.String("google-instance-identity"),
    		})
    		if err != nil {
    			return err
    		}
    		devgoogle_compute_instance, err := google.NewGoogle_compute_instance(ctx, "devgoogle_compute_instance", &google.Google_compute_instanceArgs{
    			Zone: "us-central1-a",
    		})
    		if err != nil {
    			return err
    		}
    		_, err = coder.NewAgentInstance(ctx, "devAgentInstance", &coder.AgentInstanceArgs{
    			AgentId:    devAgent.AgentId,
    			InstanceId: devgoogle_compute_instance.InstanceId,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Coder = Pulumi.Coder;
    using Google = Pulumi.Google;
    
    return await Deployment.RunAsync(() => 
    {
        var devAgent = new Coder.Agent("devAgent", new()
        {
            Os = "linux",
            Arch = "amd64",
            Auth = "google-instance-identity",
        });
    
        var devgoogle_compute_instance = new Google.Index.Google_compute_instance("devgoogle_compute_instance", new()
        {
            Zone = "us-central1-a",
        });
    
        var devAgentInstance = new Coder.AgentInstance("devAgentInstance", new()
        {
            AgentId = devAgent.AgentId,
            InstanceId = devgoogle_compute_instance.InstanceId,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.coder.Agent;
    import com.pulumi.coder.AgentArgs;
    import com.pulumi.google.google_compute_instance;
    import com.pulumi.google.Google_compute_instanceArgs;
    import com.pulumi.coder.AgentInstance;
    import com.pulumi.coder.AgentInstanceArgs;
    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 devAgent = new Agent("devAgent", AgentArgs.builder()
                .os("linux")
                .arch("amd64")
                .auth("google-instance-identity")
                .build());
    
            var devgoogle_compute_instance = new Google_compute_instance("devgoogle_compute_instance", Google_compute_instanceArgs.builder()
                .zone("us-central1-a")
                .build());
    
            var devAgentInstance = new AgentInstance("devAgentInstance", AgentInstanceArgs.builder()
                .agentId(devAgent.agentId())
                .instanceId(devgoogle_compute_instance.instanceId())
                .build());
    
        }
    }
    
    resources:
      devAgent:
        type: coder:Agent
        properties:
          os: linux
          arch: amd64
          auth: google-instance-identity
      devgoogle_compute_instance:
        type: google:google_compute_instance
        properties:
          zone: us-central1-a
      devAgentInstance:
        type: coder:AgentInstance
        properties:
          agentId: ${devAgent.agentId}
          instanceId: ${devgoogle_compute_instance.instanceId}
    

    Create AgentInstance Resource

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

    Constructor syntax

    new AgentInstance(name: string, args: AgentInstanceArgs, opts?: CustomResourceOptions);
    @overload
    def AgentInstance(resource_name: str,
                      args: AgentInstanceArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def AgentInstance(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      agent_id: Optional[str] = None,
                      instance_id: Optional[str] = None,
                      agent_instance_id: Optional[str] = None)
    func NewAgentInstance(ctx *Context, name string, args AgentInstanceArgs, opts ...ResourceOption) (*AgentInstance, error)
    public AgentInstance(string name, AgentInstanceArgs args, CustomResourceOptions? opts = null)
    public AgentInstance(String name, AgentInstanceArgs args)
    public AgentInstance(String name, AgentInstanceArgs args, CustomResourceOptions options)
    
    type: coder:AgentInstance
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args AgentInstanceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args AgentInstanceArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args AgentInstanceArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AgentInstanceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AgentInstanceArgs
    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 agentInstanceResource = new Coder.AgentInstance("agentInstanceResource", new()
    {
        AgentId = "string",
        InstanceId = "string",
        AgentInstanceId = "string",
    });
    
    example, err := coder.NewAgentInstance(ctx, "agentInstanceResource", &coder.AgentInstanceArgs{
    	AgentId:         pulumi.String("string"),
    	InstanceId:      pulumi.String("string"),
    	AgentInstanceId: pulumi.String("string"),
    })
    
    var agentInstanceResource = new AgentInstance("agentInstanceResource", AgentInstanceArgs.builder()
        .agentId("string")
        .instanceId("string")
        .agentInstanceId("string")
        .build());
    
    agent_instance_resource = coder.AgentInstance("agentInstanceResource",
        agent_id="string",
        instance_id="string",
        agent_instance_id="string")
    
    const agentInstanceResource = new coder.AgentInstance("agentInstanceResource", {
        agentId: "string",
        instanceId: "string",
        agentInstanceId: "string",
    });
    
    type: coder:AgentInstance
    properties:
        agentId: string
        agentInstanceId: string
        instanceId: string
    

    AgentInstance 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 AgentInstance resource accepts the following input properties:

    AgentId string
    The id property of a coder.Agent resource to associate with.
    InstanceId string
    The instance identifier of a provisioned resource.
    AgentInstanceId string
    The ID of this resource.
    AgentId string
    The id property of a coder.Agent resource to associate with.
    InstanceId string
    The instance identifier of a provisioned resource.
    AgentInstanceId string
    The ID of this resource.
    agentId String
    The id property of a coder.Agent resource to associate with.
    instanceId String
    The instance identifier of a provisioned resource.
    agentInstanceId String
    The ID of this resource.
    agentId string
    The id property of a coder.Agent resource to associate with.
    instanceId string
    The instance identifier of a provisioned resource.
    agentInstanceId string
    The ID of this resource.
    agent_id str
    The id property of a coder.Agent resource to associate with.
    instance_id str
    The instance identifier of a provisioned resource.
    agent_instance_id str
    The ID of this resource.
    agentId String
    The id property of a coder.Agent resource to associate with.
    instanceId String
    The instance identifier of a provisioned resource.
    agentInstanceId String
    The ID of this resource.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing AgentInstance Resource

    Get an existing AgentInstance 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?: AgentInstanceState, opts?: CustomResourceOptions): AgentInstance
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            agent_id: Optional[str] = None,
            agent_instance_id: Optional[str] = None,
            instance_id: Optional[str] = None) -> AgentInstance
    func GetAgentInstance(ctx *Context, name string, id IDInput, state *AgentInstanceState, opts ...ResourceOption) (*AgentInstance, error)
    public static AgentInstance Get(string name, Input<string> id, AgentInstanceState? state, CustomResourceOptions? opts = null)
    public static AgentInstance get(String name, Output<String> id, AgentInstanceState state, CustomResourceOptions options)
    resources:  _:    type: coder:AgentInstance    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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:
    AgentId string
    The id property of a coder.Agent resource to associate with.
    AgentInstanceId string
    The ID of this resource.
    InstanceId string
    The instance identifier of a provisioned resource.
    AgentId string
    The id property of a coder.Agent resource to associate with.
    AgentInstanceId string
    The ID of this resource.
    InstanceId string
    The instance identifier of a provisioned resource.
    agentId String
    The id property of a coder.Agent resource to associate with.
    agentInstanceId String
    The ID of this resource.
    instanceId String
    The instance identifier of a provisioned resource.
    agentId string
    The id property of a coder.Agent resource to associate with.
    agentInstanceId string
    The ID of this resource.
    instanceId string
    The instance identifier of a provisioned resource.
    agent_id str
    The id property of a coder.Agent resource to associate with.
    agent_instance_id str
    The ID of this resource.
    instance_id str
    The instance identifier of a provisioned resource.
    agentId String
    The id property of a coder.Agent resource to associate with.
    agentInstanceId String
    The ID of this resource.
    instanceId String
    The instance identifier of a provisioned resource.

    Package Details

    Repository
    coder coder/terraform-provider-coder
    License
    Notes
    This Pulumi package is based on the coder Terraform Provider.
    coder logo
    coder 2.4.0-pre1 published on Tuesday, Apr 15, 2025 by coder