get Image
Get information about a Google Compute Image. Check that your service account has the compute.imageUser
role if you want to share custom images from another project. If you want to use pubimg, do not forget to specify the dedicated project. For more information see the official documentation and its API.
Example Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.ComputeFunctions;
import com.pulumi.gcp.compute.inputs.GetImageArgs;
import com.pulumi.gcp.compute.Instance;
import com.pulumi.gcp.compute.InstanceArgs;
import com.pulumi.gcp.compute.inputs.InstanceBootDiskArgs;
import com.pulumi.gcp.compute.inputs.InstanceBootDiskInitializeParamsArgs;
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 myImage = ComputeFunctions.getImage(GetImageArgs.builder()
.family("debian-11")
.project("debian-cloud")
.build());
var default_ = new Instance("default", InstanceArgs.builder()
.bootDisk(InstanceBootDiskArgs.builder()
.initializeParams(InstanceBootDiskInitializeParamsArgs.builder()
.image(myImage.applyValue(getImageResult -> getImageResult.selfLink()))
.build())
.build())
.build());
}
}
Return
A collection of values returned by getImage.
Parameters
A collection of arguments for invoking getImage.
Return
A collection of values returned by getImage.
Parameters
The family name of the image.
A boolean to indicate either to take to most recent image if your filter returns more than one image.
, family
or filter
- (Required) The name of a specific image or a family. Exactly one of name
, family
or filter
must be specified. If name
is specified, it will fetch the corresponding image. If family
is specified, it will return the latest image that is part of an image family and is not deprecated. If you specify filter
, your filter must return exactly one image unless you use most_recent
. Filter syntax can be found here in the filter section.
The project in which the resource belongs. If it is not provided, the provider project is used. If you are using a pubimg, be sure to specify the correct Image Project.
See also
Return
A collection of values returned by getImage.
Parameters
Builder for com.pulumi.gcp.compute.kotlin.inputs.GetImagePlainArgs.