1. Packages
  2. Harness Provider
  3. API Docs
  4. service
  5. Ami
Harness v0.7.2 published on Tuesday, Apr 15, 2025 by Pulumi

harness.service.Ami

Explore with Pulumi AI

Resource for creating an AMI service. This resource uses the config-as-code API’s. When updating the name or path of this resource you should typically also set the create_before_destroy = true lifecycle setting.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as harness from "@pulumi/harness";

const example = new harness.Application("example", {name: "example"});
const exampleAmi = new harness.service.Ami("example", {
    appId: example.id,
    name: "ami-example",
    description: "Service for deploying AMI's",
});
Copy
import pulumi
import pulumi_harness as harness

example = harness.Application("example", name="example")
example_ami = harness.service.Ami("example",
    app_id=example.id,
    name="ami-example",
    description="Service for deploying AMI's")
Copy
package main

import (
	"github.com/pulumi/pulumi-harness/sdk/go/harness"
	"github.com/pulumi/pulumi-harness/sdk/go/harness/service"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := harness.NewApplication(ctx, "example", &harness.ApplicationArgs{
			Name: pulumi.String("example"),
		})
		if err != nil {
			return err
		}
		_, err = service.NewAmi(ctx, "example", &service.AmiArgs{
			AppId:       example.ID(),
			Name:        pulumi.String("ami-example"),
			Description: pulumi.String("Service for deploying AMI's"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Harness = Pulumi.Harness;

return await Deployment.RunAsync(() => 
{
    var example = new Harness.Application("example", new()
    {
        Name = "example",
    });

    var exampleAmi = new Harness.Service.Ami("example", new()
    {
        AppId = example.Id,
        Name = "ami-example",
        Description = "Service for deploying AMI's",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.harness.Application;
import com.pulumi.harness.ApplicationArgs;
import com.pulumi.harness.service.Ami;
import com.pulumi.harness.service.AmiArgs;
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 example = new Application("example", ApplicationArgs.builder()
            .name("example")
            .build());

        var exampleAmi = new Ami("exampleAmi", AmiArgs.builder()
            .appId(example.id())
            .name("ami-example")
            .description("Service for deploying AMI's")
            .build());

    }
}
Copy
resources:
  example:
    type: harness:Application
    properties:
      name: example
  exampleAmi:
    type: harness:service:Ami
    name: example
    properties:
      appId: ${example.id}
      name: ami-example
      description: Service for deploying AMI's
Copy

Create Ami Resource

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

Constructor syntax

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

@overload
def Ami(resource_name: str,
        opts: Optional[ResourceOptions] = None,
        app_id: Optional[str] = None,
        description: Optional[str] = None,
        name: Optional[str] = None,
        variables: Optional[Sequence[AmiVariableArgs]] = None)
func NewAmi(ctx *Context, name string, args AmiArgs, opts ...ResourceOption) (*Ami, error)
public Ami(string name, AmiArgs args, CustomResourceOptions? opts = null)
public Ami(String name, AmiArgs args)
public Ami(String name, AmiArgs args, CustomResourceOptions options)
type: harness:service:Ami
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. AmiArgs
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. AmiArgs
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. AmiArgs
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. AmiArgs
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. AmiArgs
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 amiResource = new Harness.Service.Ami("amiResource", new()
{
    AppId = "string",
    Description = "string",
    Name = "string",
    Variables = new[]
    {
        new Harness.Service.Inputs.AmiVariableArgs
        {
            Name = "string",
            Type = "string",
            Value = "string",
        },
    },
});
Copy
example, err := service.NewAmi(ctx, "amiResource", &service.AmiArgs{
	AppId:       pulumi.String("string"),
	Description: pulumi.String("string"),
	Name:        pulumi.String("string"),
	Variables: service.AmiVariableArray{
		&service.AmiVariableArgs{
			Name:  pulumi.String("string"),
			Type:  pulumi.String("string"),
			Value: pulumi.String("string"),
		},
	},
})
Copy
var amiResource = new Ami("amiResource", AmiArgs.builder()
    .appId("string")
    .description("string")
    .name("string")
    .variables(AmiVariableArgs.builder()
        .name("string")
        .type("string")
        .value("string")
        .build())
    .build());
Copy
ami_resource = harness.service.Ami("amiResource",
    app_id="string",
    description="string",
    name="string",
    variables=[{
        "name": "string",
        "type": "string",
        "value": "string",
    }])
Copy
const amiResource = new harness.service.Ami("amiResource", {
    appId: "string",
    description: "string",
    name: "string",
    variables: [{
        name: "string",
        type: "string",
        value: "string",
    }],
});
Copy
type: harness:service:Ami
properties:
    appId: string
    description: string
    name: string
    variables:
        - name: string
          type: string
          value: string
Copy

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

AppId
This property is required.
Changes to this property will trigger replacement.
string
The id of the application the service belongs to
Description string
Description of th service
Name string
Name of the service
Variables List<AmiVariable>
Variables to be used in the service
AppId
This property is required.
Changes to this property will trigger replacement.
string
The id of the application the service belongs to
Description string
Description of th service
Name string
Name of the service
Variables []AmiVariableArgs
Variables to be used in the service
appId
This property is required.
Changes to this property will trigger replacement.
String
The id of the application the service belongs to
description String
Description of th service
name String
Name of the service
variables List<AmiVariable>
Variables to be used in the service
appId
This property is required.
Changes to this property will trigger replacement.
string
The id of the application the service belongs to
description string
Description of th service
name string
Name of the service
variables AmiVariable[]
Variables to be used in the service
app_id
This property is required.
Changes to this property will trigger replacement.
str
The id of the application the service belongs to
description str
Description of th service
name str
Name of the service
variables Sequence[AmiVariableArgs]
Variables to be used in the service
appId
This property is required.
Changes to this property will trigger replacement.
String
The id of the application the service belongs to
description String
Description of th service
name String
Name of the service
variables List<Property Map>
Variables to be used in the service

Outputs

All input properties are implicitly available as output properties. Additionally, the Ami 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 Ami Resource

Get an existing Ami 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?: AmiState, opts?: CustomResourceOptions): Ami
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        app_id: Optional[str] = None,
        description: Optional[str] = None,
        name: Optional[str] = None,
        variables: Optional[Sequence[AmiVariableArgs]] = None) -> Ami
func GetAmi(ctx *Context, name string, id IDInput, state *AmiState, opts ...ResourceOption) (*Ami, error)
public static Ami Get(string name, Input<string> id, AmiState? state, CustomResourceOptions? opts = null)
public static Ami get(String name, Output<String> id, AmiState state, CustomResourceOptions options)
resources:  _:    type: harness:service:Ami    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:
AppId Changes to this property will trigger replacement. string
The id of the application the service belongs to
Description string
Description of th service
Name string
Name of the service
Variables List<AmiVariable>
Variables to be used in the service
AppId Changes to this property will trigger replacement. string
The id of the application the service belongs to
Description string
Description of th service
Name string
Name of the service
Variables []AmiVariableArgs
Variables to be used in the service
appId Changes to this property will trigger replacement. String
The id of the application the service belongs to
description String
Description of th service
name String
Name of the service
variables List<AmiVariable>
Variables to be used in the service
appId Changes to this property will trigger replacement. string
The id of the application the service belongs to
description string
Description of th service
name string
Name of the service
variables AmiVariable[]
Variables to be used in the service
app_id Changes to this property will trigger replacement. str
The id of the application the service belongs to
description str
Description of th service
name str
Name of the service
variables Sequence[AmiVariableArgs]
Variables to be used in the service
appId Changes to this property will trigger replacement. String
The id of the application the service belongs to
description String
Description of th service
name String
Name of the service
variables List<Property Map>
Variables to be used in the service

Supporting Types

AmiVariable
, AmiVariableArgs

Name This property is required. string
Name of the variable
Type This property is required. string
Type of the variable. Options are 'TEXT' and 'ENCRYPTED_TEXT'
Value This property is required. string
Value of the variable
Name This property is required. string
Name of the variable
Type This property is required. string
Type of the variable. Options are 'TEXT' and 'ENCRYPTED_TEXT'
Value This property is required. string
Value of the variable
name This property is required. String
Name of the variable
type This property is required. String
Type of the variable. Options are 'TEXT' and 'ENCRYPTED_TEXT'
value This property is required. String
Value of the variable
name This property is required. string
Name of the variable
type This property is required. string
Type of the variable. Options are 'TEXT' and 'ENCRYPTED_TEXT'
value This property is required. string
Value of the variable
name This property is required. str
Name of the variable
type This property is required. str
Type of the variable. Options are 'TEXT' and 'ENCRYPTED_TEXT'
value This property is required. str
Value of the variable
name This property is required. String
Name of the variable
type This property is required. String
Type of the variable. Options are 'TEXT' and 'ENCRYPTED_TEXT'
value This property is required. String
Value of the variable

Import

Import using the Harness application id and service id

$ pulumi import harness:service/ami:Ami example <app_id>/<svc_id>
Copy

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

Package Details

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