HashiCorp Cloud Platform (HCP) v0.1.14 published on Friday, Dec 2, 2022 by Grapl Security
hcp.getPackerImage
Explore with Pulumi AI
HashiCorp Cloud Platform (HCP) v0.1.14 published on Friday, Dec 2, 2022 by Grapl Security
The Packer Image data source iteration gets the most recent iteration (or build) of an image, given an iteration id or a channel.
Example Usage
Single image sourcing
using System.Collections.Generic;
using Pulumi;
using Hcp = Pulumi.Hcp;
return await Deployment.RunAsync(() =>
{
var baz = Hcp.GetPackerImage.Invoke(new()
{
BucketName = "hardened-ubuntu-16-04",
CloudProvider = "aws",
Channel = "production",
Region = "us-east-1",
});
return new Dictionary<string, object?>
{
["packer-registry-ubuntu-east-1"] = baz.Apply(getPackerImageResult => getPackerImageResult.CloudImageId),
};
});
package main
import (
"github.com/grapl-security/pulumi-hcp/sdk/go/hcp"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
baz, err := hcp.GetPackerImage(ctx, &GetPackerImageArgs{
BucketName: "hardened-ubuntu-16-04",
CloudProvider: "aws",
Channel: pulumi.StringRef("production"),
Region: "us-east-1",
}, nil)
if err != nil {
return err
}
ctx.Export("packer-registry-ubuntu-east-1", baz.CloudImageId)
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.hcp.HcpFunctions;
import com.pulumi.hcp.inputs.GetPackerImageArgs;
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) {
final var baz = HcpFunctions.getPackerImage(GetPackerImageArgs.builder()
.bucketName("hardened-ubuntu-16-04")
.cloudProvider("aws")
.channel("production")
.region("us-east-1")
.build());
ctx.export("packer-registry-ubuntu-east-1", baz.applyValue(getPackerImageResult -> getPackerImageResult.cloudImageId()));
}
}
import pulumi
import pulumi_hcp as hcp
baz = hcp.get_packer_image(bucket_name="hardened-ubuntu-16-04",
cloud_provider="aws",
channel="production",
region="us-east-1")
pulumi.export("packer-registry-ubuntu-east-1", baz.cloud_image_id)
import * as pulumi from "@pulumi/pulumi";
import * as hcp from "@pulumi/hcp";
export = async () => {
const baz = await hcp.getPackerImage({
bucketName: "hardened-ubuntu-16-04",
cloudProvider: "aws",
channel: "production",
region: "us-east-1",
});
const packer_registry_ubuntu_east_1 = baz.cloudImageId;
return {
"packer-registry-ubuntu-east-1": packer_registry_ubuntu_east_1,
};
}
variables:
baz:
Fn::Invoke:
Function: hcp:getPackerImage
Arguments:
bucketName: hardened-ubuntu-16-04
cloudProvider: aws
channel: production
region: us-east-1
outputs:
packer-registry-ubuntu-east-1: ${baz.cloudImageId}
Multiple image sourcing from a single iteration
using System.Collections.Generic;
using Pulumi;
using Hcp = Pulumi.Hcp;
return await Deployment.RunAsync(() =>
{
var hardened_source = Hcp.GetPackerIteration.Invoke(new()
{
BucketName = "hardened-ubuntu-16-04",
Channel = "production",
});
var foo = Hcp.GetPackerImage.Invoke(new()
{
BucketName = "hardened-ubuntu-16-04",
CloudProvider = "aws",
IterationId = hardened_source.Apply(getPackerIterationResult => getPackerIterationResult.Ulid),
Region = "us-east-1",
});
var bar = Hcp.GetPackerImage.Invoke(new()
{
BucketName = "hardened-ubuntu-16-04",
CloudProvider = "aws",
IterationId = hardened_source.Apply(getPackerIterationResult => getPackerIterationResult.Ulid),
Region = "us-west-1",
});
return new Dictionary<string, object?>
{
["packer-registry-ubuntu-east-1"] = foo.Apply(getPackerImageResult => getPackerImageResult.CloudImageId),
["packer-registry-ubuntu-west-1"] = bar.Apply(getPackerImageResult => getPackerImageResult.CloudImageId),
};
});
package main
import (
"github.com/grapl-security/pulumi-hcp/sdk/go/hcp"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
hardened_source, err := hcp.GetPackerIteration(ctx, &GetPackerIterationArgs{
BucketName: "hardened-ubuntu-16-04",
Channel: "production",
}, nil)
if err != nil {
return err
}
foo, err := hcp.GetPackerImage(ctx, &GetPackerImageArgs{
BucketName: "hardened-ubuntu-16-04",
CloudProvider: "aws",
IterationId: pulumi.StringRef(hardened_source.Ulid),
Region: "us-east-1",
}, nil)
if err != nil {
return err
}
bar, err := hcp.GetPackerImage(ctx, &GetPackerImageArgs{
BucketName: "hardened-ubuntu-16-04",
CloudProvider: "aws",
IterationId: pulumi.StringRef(hardened_source.Ulid),
Region: "us-west-1",
}, nil)
if err != nil {
return err
}
ctx.Export("packer-registry-ubuntu-east-1", foo.CloudImageId)
ctx.Export("packer-registry-ubuntu-west-1", bar.CloudImageId)
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.hcp.HcpFunctions;
import com.pulumi.hcp.inputs.GetPackerIterationArgs;
import com.pulumi.hcp.inputs.GetPackerImageArgs;
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) {
final var hardened-source = HcpFunctions.getPackerIteration(GetPackerIterationArgs.builder()
.bucketName("hardened-ubuntu-16-04")
.channel("production")
.build());
final var foo = HcpFunctions.getPackerImage(GetPackerImageArgs.builder()
.bucketName("hardened-ubuntu-16-04")
.cloudProvider("aws")
.iterationId(hardened_source.ulid())
.region("us-east-1")
.build());
final var bar = HcpFunctions.getPackerImage(GetPackerImageArgs.builder()
.bucketName("hardened-ubuntu-16-04")
.cloudProvider("aws")
.iterationId(hardened_source.ulid())
.region("us-west-1")
.build());
ctx.export("packer-registry-ubuntu-east-1", foo.applyValue(getPackerImageResult -> getPackerImageResult.cloudImageId()));
ctx.export("packer-registry-ubuntu-west-1", bar.applyValue(getPackerImageResult -> getPackerImageResult.cloudImageId()));
}
}
import pulumi
import pulumi_hcp as hcp
hardened_source = hcp.get_packer_iteration(bucket_name="hardened-ubuntu-16-04",
channel="production")
foo = hcp.get_packer_image(bucket_name="hardened-ubuntu-16-04",
cloud_provider="aws",
iteration_id=hardened_source.ulid,
region="us-east-1")
bar = hcp.get_packer_image(bucket_name="hardened-ubuntu-16-04",
cloud_provider="aws",
iteration_id=hardened_source.ulid,
region="us-west-1")
pulumi.export("packer-registry-ubuntu-east-1", foo.cloud_image_id)
pulumi.export("packer-registry-ubuntu-west-1", bar.cloud_image_id)
import * as pulumi from "@pulumi/pulumi";
import * as hcp from "@pulumi/hcp";
export = async () => {
const hardened-source = await hcp.getPackerIteration({
bucketName: "hardened-ubuntu-16-04",
channel: "production",
});
const foo = await hcp.getPackerImage({
bucketName: "hardened-ubuntu-16-04",
cloudProvider: "aws",
iterationId: hardened_source.ulid,
region: "us-east-1",
});
const bar = await hcp.getPackerImage({
bucketName: "hardened-ubuntu-16-04",
cloudProvider: "aws",
iterationId: hardened_source.ulid,
region: "us-west-1",
});
const packer_registry_ubuntu_east_1 = foo.cloudImageId;
const packer_registry_ubuntu_west_1 = bar.cloudImageId;
return {
"packer-registry-ubuntu-east-1": packer_registry_ubuntu_east_1,
"packer-registry-ubuntu-west-1": packer_registry_ubuntu_west_1,
};
}
variables:
hardened-source:
Fn::Invoke:
Function: hcp:getPackerIteration
Arguments:
bucketName: hardened-ubuntu-16-04
channel: production
foo:
Fn::Invoke:
Function: hcp:getPackerImage
Arguments:
bucketName: hardened-ubuntu-16-04
cloudProvider: aws
iterationId: ${["hardened-source"].ulid}
region: us-east-1
bar:
Fn::Invoke:
Function: hcp:getPackerImage
Arguments:
bucketName: hardened-ubuntu-16-04
cloudProvider: aws
iterationId: ${["hardened-source"].ulid}
region: us-west-1
outputs:
packer-registry-ubuntu-east-1: ${foo.cloudImageId}
packer-registry-ubuntu-west-1: ${bar.cloudImageId}
Using getPackerImage
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getPackerImage(args: GetPackerImageArgs, opts?: InvokeOptions): Promise<GetPackerImageResult>
function getPackerImageOutput(args: GetPackerImageOutputArgs, opts?: InvokeOptions): Output<GetPackerImageResult>
def get_packer_image(bucket_name: Optional[str] = None,
channel: Optional[str] = None,
cloud_provider: Optional[str] = None,
component_type: Optional[str] = None,
iteration_id: Optional[str] = None,
region: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetPackerImageResult
def get_packer_image_output(bucket_name: Optional[pulumi.Input[str]] = None,
channel: Optional[pulumi.Input[str]] = None,
cloud_provider: Optional[pulumi.Input[str]] = None,
component_type: Optional[pulumi.Input[str]] = None,
iteration_id: Optional[pulumi.Input[str]] = None,
region: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetPackerImageResult]
func GetPackerImage(ctx *Context, args *GetPackerImageArgs, opts ...InvokeOption) (*GetPackerImageResult, error)
func GetPackerImageOutput(ctx *Context, args *GetPackerImageOutputArgs, opts ...InvokeOption) GetPackerImageResultOutput
> Note: This function is named GetPackerImage
in the Go SDK.
public static class GetPackerImage
{
public static Task<GetPackerImageResult> InvokeAsync(GetPackerImageArgs args, InvokeOptions? opts = null)
public static Output<GetPackerImageResult> Invoke(GetPackerImageInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetPackerImageResult> getPackerImage(GetPackerImageArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: hcp:index/getPackerImage:getPackerImage
arguments:
# arguments dictionary
The following arguments are supported:
- Bucket
Name string - The slug of the HCP Packer Registry image bucket to pull from.
- Cloud
Provider string - Name of the cloud provider this image is stored-in.
- Region string
- Region this image is stored in, if any.
- Channel string
- The channel that points to the version of the image being retrieved. Either this or
iteration_id
must be specified. Note: will incur a billable request - Component
Type string - Name of the builder that built this image. Ex:
amazon-ebs.example
. - Iteration
Id string - The iteration from which to get the image. Either this or
channel
must be specified.
- Bucket
Name string - The slug of the HCP Packer Registry image bucket to pull from.
- Cloud
Provider string - Name of the cloud provider this image is stored-in.
- Region string
- Region this image is stored in, if any.
- Channel string
- The channel that points to the version of the image being retrieved. Either this or
iteration_id
must be specified. Note: will incur a billable request - Component
Type string - Name of the builder that built this image. Ex:
amazon-ebs.example
. - Iteration
Id string - The iteration from which to get the image. Either this or
channel
must be specified.
- bucket
Name String - The slug of the HCP Packer Registry image bucket to pull from.
- cloud
Provider String - Name of the cloud provider this image is stored-in.
- region String
- Region this image is stored in, if any.
- channel String
- The channel that points to the version of the image being retrieved. Either this or
iteration_id
must be specified. Note: will incur a billable request - component
Type String - Name of the builder that built this image. Ex:
amazon-ebs.example
. - iteration
Id String - The iteration from which to get the image. Either this or
channel
must be specified.
- bucket
Name string - The slug of the HCP Packer Registry image bucket to pull from.
- cloud
Provider string - Name of the cloud provider this image is stored-in.
- region string
- Region this image is stored in, if any.
- channel string
- The channel that points to the version of the image being retrieved. Either this or
iteration_id
must be specified. Note: will incur a billable request - component
Type string - Name of the builder that built this image. Ex:
amazon-ebs.example
. - iteration
Id string - The iteration from which to get the image. Either this or
channel
must be specified.
- bucket_
name str - The slug of the HCP Packer Registry image bucket to pull from.
- cloud_
provider str - Name of the cloud provider this image is stored-in.
- region str
- Region this image is stored in, if any.
- channel str
- The channel that points to the version of the image being retrieved. Either this or
iteration_id
must be specified. Note: will incur a billable request - component_
type str - Name of the builder that built this image. Ex:
amazon-ebs.example
. - iteration_
id str - The iteration from which to get the image. Either this or
channel
must be specified.
- bucket
Name String - The slug of the HCP Packer Registry image bucket to pull from.
- cloud
Provider String - Name of the cloud provider this image is stored-in.
- region String
- Region this image is stored in, if any.
- channel String
- The channel that points to the version of the image being retrieved. Either this or
iteration_id
must be specified. Note: will incur a billable request - component
Type String - Name of the builder that built this image. Ex:
amazon-ebs.example
. - iteration
Id String - The iteration from which to get the image. Either this or
channel
must be specified.
getPackerImage Result
The following output properties are available:
- Bucket
Name string - The slug of the HCP Packer Registry image bucket to pull from.
- Build
Id string - HCP ID of this build.
- Cloud
Image stringId - Cloud Image ID or URL string identifying this image for the builder that built it.
- Cloud
Provider string - Name of the cloud provider this image is stored-in.
- Component
Type string - Name of the builder that built this image. Ex:
amazon-ebs.example
. - Created
At string - Creation time of this build.
- Id string
- The provider-assigned unique ID for this managed resource.
- Iteration
Id string - The iteration from which to get the image. Either this or
channel
must be specified. - Labels Dictionary<string, object>
- Labels associated with this build.
- Organization
Id string - The ID of the organization this HCP Packer registry is located in.
- Packer
Run stringUuid - UUID of this build.
- Project
Id string - The ID of the project this HCP Packer registry is located in.
- Region string
- Region this image is stored in, if any.
- Revoke
At string - The revocation time of this build. This field will be null for any build that has not been revoked or scheduled for revocation.
- Channel string
- The channel that points to the version of the image being retrieved. Either this or
iteration_id
must be specified. Note: will incur a billable request
- Bucket
Name string - The slug of the HCP Packer Registry image bucket to pull from.
- Build
Id string - HCP ID of this build.
- Cloud
Image stringId - Cloud Image ID or URL string identifying this image for the builder that built it.
- Cloud
Provider string - Name of the cloud provider this image is stored-in.
- Component
Type string - Name of the builder that built this image. Ex:
amazon-ebs.example
. - Created
At string - Creation time of this build.
- Id string
- The provider-assigned unique ID for this managed resource.
- Iteration
Id string - The iteration from which to get the image. Either this or
channel
must be specified. - Labels map[string]interface{}
- Labels associated with this build.
- Organization
Id string - The ID of the organization this HCP Packer registry is located in.
- Packer
Run stringUuid - UUID of this build.
- Project
Id string - The ID of the project this HCP Packer registry is located in.
- Region string
- Region this image is stored in, if any.
- Revoke
At string - The revocation time of this build. This field will be null for any build that has not been revoked or scheduled for revocation.
- Channel string
- The channel that points to the version of the image being retrieved. Either this or
iteration_id
must be specified. Note: will incur a billable request
- bucket
Name String - The slug of the HCP Packer Registry image bucket to pull from.
- build
Id String - HCP ID of this build.
- cloud
Image StringId - Cloud Image ID or URL string identifying this image for the builder that built it.
- cloud
Provider String - Name of the cloud provider this image is stored-in.
- component
Type String - Name of the builder that built this image. Ex:
amazon-ebs.example
. - created
At String - Creation time of this build.
- id String
- The provider-assigned unique ID for this managed resource.
- iteration
Id String - The iteration from which to get the image. Either this or
channel
must be specified. - labels Map<String,Object>
- Labels associated with this build.
- organization
Id String - The ID of the organization this HCP Packer registry is located in.
- packer
Run StringUuid - UUID of this build.
- project
Id String - The ID of the project this HCP Packer registry is located in.
- region String
- Region this image is stored in, if any.
- revoke
At String - The revocation time of this build. This field will be null for any build that has not been revoked or scheduled for revocation.
- channel String
- The channel that points to the version of the image being retrieved. Either this or
iteration_id
must be specified. Note: will incur a billable request
- bucket
Name string - The slug of the HCP Packer Registry image bucket to pull from.
- build
Id string - HCP ID of this build.
- cloud
Image stringId - Cloud Image ID or URL string identifying this image for the builder that built it.
- cloud
Provider string - Name of the cloud provider this image is stored-in.
- component
Type string - Name of the builder that built this image. Ex:
amazon-ebs.example
. - created
At string - Creation time of this build.
- id string
- The provider-assigned unique ID for this managed resource.
- iteration
Id string - The iteration from which to get the image. Either this or
channel
must be specified. - labels {[key: string]: any}
- Labels associated with this build.
- organization
Id string - The ID of the organization this HCP Packer registry is located in.
- packer
Run stringUuid - UUID of this build.
- project
Id string - The ID of the project this HCP Packer registry is located in.
- region string
- Region this image is stored in, if any.
- revoke
At string - The revocation time of this build. This field will be null for any build that has not been revoked or scheduled for revocation.
- channel string
- The channel that points to the version of the image being retrieved. Either this or
iteration_id
must be specified. Note: will incur a billable request
- bucket_
name str - The slug of the HCP Packer Registry image bucket to pull from.
- build_
id str - HCP ID of this build.
- cloud_
image_ strid - Cloud Image ID or URL string identifying this image for the builder that built it.
- cloud_
provider str - Name of the cloud provider this image is stored-in.
- component_
type str - Name of the builder that built this image. Ex:
amazon-ebs.example
. - created_
at str - Creation time of this build.
- id str
- The provider-assigned unique ID for this managed resource.
- iteration_
id str - The iteration from which to get the image. Either this or
channel
must be specified. - labels Mapping[str, Any]
- Labels associated with this build.
- organization_
id str - The ID of the organization this HCP Packer registry is located in.
- packer_
run_ struuid - UUID of this build.
- project_
id str - The ID of the project this HCP Packer registry is located in.
- region str
- Region this image is stored in, if any.
- revoke_
at str - The revocation time of this build. This field will be null for any build that has not been revoked or scheduled for revocation.
- channel str
- The channel that points to the version of the image being retrieved. Either this or
iteration_id
must be specified. Note: will incur a billable request
- bucket
Name String - The slug of the HCP Packer Registry image bucket to pull from.
- build
Id String - HCP ID of this build.
- cloud
Image StringId - Cloud Image ID or URL string identifying this image for the builder that built it.
- cloud
Provider String - Name of the cloud provider this image is stored-in.
- component
Type String - Name of the builder that built this image. Ex:
amazon-ebs.example
. - created
At String - Creation time of this build.
- id String
- The provider-assigned unique ID for this managed resource.
- iteration
Id String - The iteration from which to get the image. Either this or
channel
must be specified. - labels Map<Any>
- Labels associated with this build.
- organization
Id String - The ID of the organization this HCP Packer registry is located in.
- packer
Run StringUuid - UUID of this build.
- project
Id String - The ID of the project this HCP Packer registry is located in.
- region String
- Region this image is stored in, if any.
- revoke
At String - The revocation time of this build. This field will be null for any build that has not been revoked or scheduled for revocation.
- channel String
- The channel that points to the version of the image being retrieved. Either this or
iteration_id
must be specified. Note: will incur a billable request
Package Details
- Repository
- hcp grapl-security/pulumi-hcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
hcp
Terraform Provider.
HashiCorp Cloud Platform (HCP) v0.1.14 published on Friday, Dec 2, 2022 by Grapl Security