diff --git a/awsx/ecr/image.ts b/awsx/ecr/image.ts index 1eb4a1260..382f6e9c3 100644 --- a/awsx/ecr/image.ts +++ b/awsx/ecr/image.ts @@ -37,8 +37,11 @@ export function computeImageFromAsset( pulumi.log.debug(`Building container image at '${JSON.stringify(dockerInputs)}'`, parent); - const imageName = args.imageName ? args.imageName : - (imageTag ? imageTag : createUniqueImageName(dockerInputs)); + const imageName = args.imageName + ? args.imageName + : imageTag + ? imageTag + : createUniqueImageName(dockerInputs); // Note: the tag, if provided, is included in the image name. const canonicalImageName = `${repositoryUrl}:${imageName}`; diff --git a/awsx/schema-types.ts b/awsx/schema-types.ts index 579acb4ab..b318cc618 100644 --- a/awsx/schema-types.ts +++ b/awsx/schema-types.ts @@ -641,6 +641,7 @@ export interface DockerBuildInputs { readonly cacheFrom?: pulumi.Input[]>; readonly context?: pulumi.Input; readonly dockerfile?: pulumi.Input; + readonly imageName?: pulumi.Input; readonly imageTag?: pulumi.Input; readonly platform?: pulumi.Input; readonly target?: pulumi.Input; @@ -651,6 +652,7 @@ export interface DockerBuildOutputs { readonly cacheFrom?: pulumi.Output; readonly context?: pulumi.Output; readonly dockerfile?: pulumi.Output; + readonly imageName?: pulumi.Output; readonly imageTag?: pulumi.Output; readonly platform?: pulumi.Output; readonly target?: pulumi.Output; diff --git a/schema.json b/schema.json index 323ac1a02..afe732d66 100644 --- a/schema.json +++ b/schema.json @@ -802,6 +802,10 @@ "type": "string", "description": "dockerfile may be used to override the default Dockerfile name and/or location. By default, it is assumed to be a file named Dockerfile in the root of the build context." }, + "imageName": { + "type": "string", + "description": "Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used" + }, "imageTag": { "type": "string", "description": "Custom image tag for the resulting docker image. If omitted a random string will be used" diff --git a/sdk/dotnet/Ecr/Image.cs b/sdk/dotnet/Ecr/Image.cs index 76cd6b913..5a29f958e 100644 --- a/sdk/dotnet/Ecr/Image.cs +++ b/sdk/dotnet/Ecr/Image.cs @@ -91,6 +91,12 @@ public InputList CacheFrom [Input("dockerfile")] public Input? Dockerfile { get; set; } + /// + /// Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used + /// + [Input("imageName")] + public Input? ImageName { get; set; } + /// /// Custom image tag for the resulting docker image. If omitted a random string will be used /// diff --git a/sdk/go/awsx/ecr/image.go b/sdk/go/awsx/ecr/image.go index f7f7626d4..1ed58f5f9 100644 --- a/sdk/go/awsx/ecr/image.go +++ b/sdk/go/awsx/ecr/image.go @@ -51,6 +51,8 @@ type imageArgs struct { Context *string `pulumi:"context"` // dockerfile may be used to override the default Dockerfile name and/or location. By default, it is assumed to be a file named Dockerfile in the root of the build context. Dockerfile *string `pulumi:"dockerfile"` + // Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used + ImageName *string `pulumi:"imageName"` // Custom image tag for the resulting docker image. If omitted a random string will be used ImageTag *string `pulumi:"imageTag"` // The architecture of the platform you want to build this image for, e.g. `linux/arm64`. @@ -75,6 +77,8 @@ type ImageArgs struct { Context pulumi.StringPtrInput // dockerfile may be used to override the default Dockerfile name and/or location. By default, it is assumed to be a file named Dockerfile in the root of the build context. Dockerfile pulumi.StringPtrInput + // Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used + ImageName pulumi.StringPtrInput // Custom image tag for the resulting docker image. If omitted a random string will be used ImageTag pulumi.StringPtrInput // The architecture of the platform you want to build this image for, e.g. `linux/arm64`. diff --git a/sdk/go/awsx/ecr/pulumiTypes.go b/sdk/go/awsx/ecr/pulumiTypes.go index 237a68b59..3c6301523 100644 --- a/sdk/go/awsx/ecr/pulumiTypes.go +++ b/sdk/go/awsx/ecr/pulumiTypes.go @@ -26,6 +26,8 @@ type DockerBuild struct { Context *string `pulumi:"context"` // dockerfile may be used to override the default Dockerfile name and/or location. By default, it is assumed to be a file named Dockerfile in the root of the build context. Dockerfile *string `pulumi:"dockerfile"` + // Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used + ImageName *string `pulumi:"imageName"` // Custom image tag for the resulting docker image. If omitted a random string will be used ImageTag *string `pulumi:"imageTag"` // The architecture of the platform you want to build this image for, e.g. `linux/arm64`. diff --git a/sdk/java/src/main/java/com/pulumi/awsx/ecr/ImageArgs.java b/sdk/java/src/main/java/com/pulumi/awsx/ecr/ImageArgs.java index b369f9d87..a318107cc 100644 --- a/sdk/java/src/main/java/com/pulumi/awsx/ecr/ImageArgs.java +++ b/sdk/java/src/main/java/com/pulumi/awsx/ecr/ImageArgs.java @@ -93,6 +93,21 @@ public Optional> dockerfile() { return Optional.ofNullable(this.dockerfile); } + /** + * Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used + * + */ + @Import(name="imageName") + private @Nullable Output imageName; + + /** + * @return Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used + * + */ + public Optional> imageName() { + return Optional.ofNullable(this.imageName); + } + /** * Custom image tag for the resulting docker image. If omitted a random string will be used * @@ -176,6 +191,7 @@ private ImageArgs(ImageArgs $) { this.cacheFrom = $.cacheFrom; this.context = $.context; this.dockerfile = $.dockerfile; + this.imageName = $.imageName; this.imageTag = $.imageTag; this.platform = $.platform; this.registryId = $.registryId; @@ -306,6 +322,27 @@ public Builder dockerfile(String dockerfile) { return dockerfile(Output.of(dockerfile)); } + /** + * @param imageName Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used + * + * @return builder + * + */ + public Builder imageName(@Nullable Output imageName) { + $.imageName = imageName; + return this; + } + + /** + * @param imageName Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used + * + * @return builder + * + */ + public Builder imageName(String imageName) { + return imageName(Output.of(imageName)); + } + /** * @param imageTag Custom image tag for the resulting docker image. If omitted a random string will be used * diff --git a/sdk/python/pulumi_awsx/ecr/image.py b/sdk/python/pulumi_awsx/ecr/image.py index a85505432..1192cdd72 100644 --- a/sdk/python/pulumi_awsx/ecr/image.py +++ b/sdk/python/pulumi_awsx/ecr/image.py @@ -21,6 +21,7 @@ def __init__(__self__, *, cache_from: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, context: Optional[pulumi.Input[str]] = None, dockerfile: Optional[pulumi.Input[str]] = None, + image_name: Optional[pulumi.Input[str]] = None, image_tag: Optional[pulumi.Input[str]] = None, platform: Optional[pulumi.Input[str]] = None, registry_id: Optional[pulumi.Input[str]] = None, @@ -33,6 +34,7 @@ def __init__(__self__, *, :param pulumi.Input[Sequence[pulumi.Input[str]]] cache_from: Images to consider as cache sources :param pulumi.Input[str] context: Path to a directory to use for the Docker build context, usually the directory in which the Dockerfile resides (although dockerfile may be used to choose a custom location independent of this choice). If not specified, the context defaults to the current working directory; if a relative path is used, it is relative to the current working directory that Pulumi is evaluating. :param pulumi.Input[str] dockerfile: dockerfile may be used to override the default Dockerfile name and/or location. By default, it is assumed to be a file named Dockerfile in the root of the build context. + :param pulumi.Input[str] image_name: Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used :param pulumi.Input[str] image_tag: Custom image tag for the resulting docker image. If omitted a random string will be used :param pulumi.Input[str] platform: The architecture of the platform you want to build this image for, e.g. `linux/arm64`. :param pulumi.Input[str] registry_id: ID of the ECR registry in which to store the image. If not provided, this will be inferred from the repository URL) @@ -49,6 +51,8 @@ def __init__(__self__, *, pulumi.set(__self__, "context", context) if dockerfile is not None: pulumi.set(__self__, "dockerfile", dockerfile) + if image_name is not None: + pulumi.set(__self__, "image_name", image_name) if image_tag is not None: pulumi.set(__self__, "image_tag", image_tag) if platform is not None: @@ -130,6 +134,18 @@ def dockerfile(self) -> Optional[pulumi.Input[str]]: def dockerfile(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "dockerfile", value) + @property + @pulumi.getter(name="imageName") + def image_name(self) -> Optional[pulumi.Input[str]]: + """ + Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used + """ + return pulumi.get(self, "image_name") + + @image_name.setter + def image_name(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "image_name", value) + @property @pulumi.getter(name="imageTag") def image_tag(self) -> Optional[pulumi.Input[str]]: @@ -189,6 +205,7 @@ def __init__(__self__, cache_from: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, context: Optional[pulumi.Input[str]] = None, dockerfile: Optional[pulumi.Input[str]] = None, + image_name: Optional[pulumi.Input[str]] = None, image_tag: Optional[pulumi.Input[str]] = None, platform: Optional[pulumi.Input[str]] = None, registry_id: Optional[pulumi.Input[str]] = None, @@ -205,6 +222,7 @@ def __init__(__self__, :param pulumi.Input[Sequence[pulumi.Input[str]]] cache_from: Images to consider as cache sources :param pulumi.Input[str] context: Path to a directory to use for the Docker build context, usually the directory in which the Dockerfile resides (although dockerfile may be used to choose a custom location independent of this choice). If not specified, the context defaults to the current working directory; if a relative path is used, it is relative to the current working directory that Pulumi is evaluating. :param pulumi.Input[str] dockerfile: dockerfile may be used to override the default Dockerfile name and/or location. By default, it is assumed to be a file named Dockerfile in the root of the build context. + :param pulumi.Input[str] image_name: Custom name for the underlying Docker image resource. If omitted, the image tag assigned by the provider will be used :param pulumi.Input[str] image_tag: Custom image tag for the resulting docker image. If omitted a random string will be used :param pulumi.Input[str] platform: The architecture of the platform you want to build this image for, e.g. `linux/arm64`. :param pulumi.Input[str] registry_id: ID of the ECR registry in which to store the image. If not provided, this will be inferred from the repository URL) @@ -240,6 +258,7 @@ def _internal_init(__self__, cache_from: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, context: Optional[pulumi.Input[str]] = None, dockerfile: Optional[pulumi.Input[str]] = None, + image_name: Optional[pulumi.Input[str]] = None, image_tag: Optional[pulumi.Input[str]] = None, platform: Optional[pulumi.Input[str]] = None, registry_id: Optional[pulumi.Input[str]] = None, @@ -261,6 +280,7 @@ def _internal_init(__self__, __props__.__dict__["cache_from"] = cache_from __props__.__dict__["context"] = context __props__.__dict__["dockerfile"] = dockerfile + __props__.__dict__["image_name"] = image_name __props__.__dict__["image_tag"] = image_tag __props__.__dict__["platform"] = platform __props__.__dict__["registry_id"] = registry_id