1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. composer
  5. getImageVersions
Google Cloud Classic v7.18.0 published on Wednesday, Apr 10, 2024 by Pulumi

gcp.composer.getImageVersions

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.18.0 published on Wednesday, Apr 10, 2024 by Pulumi

    Provides access to available Cloud Composer versions in a region for a given project.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const all = gcp.composer.getImageVersions({});
    const test = new gcp.composer.Environment("test", {
        name: "test-env",
        region: "us-central1",
        config: {
            softwareConfig: {
                imageVersion: all.then(all => all.imageVersions?.[0]?.imageVersionId),
            },
        },
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    all = gcp.composer.get_image_versions()
    test = gcp.composer.Environment("test",
        name="test-env",
        region="us-central1",
        config=gcp.composer.EnvironmentConfigArgs(
            software_config=gcp.composer.EnvironmentConfigSoftwareConfigArgs(
                image_version=all.image_versions[0].image_version_id,
            ),
        ))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/composer"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		all, err := composer.GetImageVersions(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		_, err = composer.NewEnvironment(ctx, "test", &composer.EnvironmentArgs{
    			Name:   pulumi.String("test-env"),
    			Region: pulumi.String("us-central1"),
    			Config: &composer.EnvironmentConfigArgs{
    				SoftwareConfig: &composer.EnvironmentConfigSoftwareConfigArgs{
    					ImageVersion: pulumi.String(all.ImageVersions[0].ImageVersionId),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var all = Gcp.Composer.GetImageVersions.Invoke();
    
        var test = new Gcp.Composer.Environment("test", new()
        {
            Name = "test-env",
            Region = "us-central1",
            Config = new Gcp.Composer.Inputs.EnvironmentConfigArgs
            {
                SoftwareConfig = new Gcp.Composer.Inputs.EnvironmentConfigSoftwareConfigArgs
                {
                    ImageVersion = all.Apply(getImageVersionsResult => getImageVersionsResult.ImageVersions[0]?.ImageVersionId),
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.composer.ComposerFunctions;
    import com.pulumi.gcp.composer.inputs.GetImageVersionsArgs;
    import com.pulumi.gcp.composer.Environment;
    import com.pulumi.gcp.composer.EnvironmentArgs;
    import com.pulumi.gcp.composer.inputs.EnvironmentConfigArgs;
    import com.pulumi.gcp.composer.inputs.EnvironmentConfigSoftwareConfigArgs;
    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 all = ComposerFunctions.getImageVersions();
    
            var test = new Environment("test", EnvironmentArgs.builder()        
                .name("test-env")
                .region("us-central1")
                .config(EnvironmentConfigArgs.builder()
                    .softwareConfig(EnvironmentConfigSoftwareConfigArgs.builder()
                        .imageVersion(all.applyValue(getImageVersionsResult -> getImageVersionsResult.imageVersions()[0].imageVersionId()))
                        .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      test:
        type: gcp:composer:Environment
        properties:
          name: test-env
          region: us-central1
          config:
            softwareConfig:
              imageVersion: ${all.imageVersions[0].imageVersionId}
    variables:
      all:
        fn::invoke:
          Function: gcp:composer:getImageVersions
          Arguments: {}
    

    Using getImageVersions

    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 getImageVersions(args: GetImageVersionsArgs, opts?: InvokeOptions): Promise<GetImageVersionsResult>
    function getImageVersionsOutput(args: GetImageVersionsOutputArgs, opts?: InvokeOptions): Output<GetImageVersionsResult>
    def get_image_versions(project: Optional[str] = None,
                           region: Optional[str] = None,
                           opts: Optional[InvokeOptions] = None) -> GetImageVersionsResult
    def get_image_versions_output(project: Optional[pulumi.Input[str]] = None,
                           region: Optional[pulumi.Input[str]] = None,
                           opts: Optional[InvokeOptions] = None) -> Output[GetImageVersionsResult]
    func GetImageVersions(ctx *Context, args *GetImageVersionsArgs, opts ...InvokeOption) (*GetImageVersionsResult, error)
    func GetImageVersionsOutput(ctx *Context, args *GetImageVersionsOutputArgs, opts ...InvokeOption) GetImageVersionsResultOutput

    > Note: This function is named GetImageVersions in the Go SDK.

    public static class GetImageVersions 
    {
        public static Task<GetImageVersionsResult> InvokeAsync(GetImageVersionsArgs args, InvokeOptions? opts = null)
        public static Output<GetImageVersionsResult> Invoke(GetImageVersionsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetImageVersionsResult> getImageVersions(GetImageVersionsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: gcp:composer/getImageVersions:getImageVersions
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Project string
    The ID of the project to list versions in. If it is not provided, the provider project is used.
    Region string
    The location to list versions in. If it is not provider, the provider region is used.
    Project string
    The ID of the project to list versions in. If it is not provided, the provider project is used.
    Region string
    The location to list versions in. If it is not provider, the provider region is used.
    project String
    The ID of the project to list versions in. If it is not provided, the provider project is used.
    region String
    The location to list versions in. If it is not provider, the provider region is used.
    project string
    The ID of the project to list versions in. If it is not provided, the provider project is used.
    region string
    The location to list versions in. If it is not provider, the provider region is used.
    project str
    The ID of the project to list versions in. If it is not provided, the provider project is used.
    region str
    The location to list versions in. If it is not provider, the provider region is used.
    project String
    The ID of the project to list versions in. If it is not provided, the provider project is used.
    region String
    The location to list versions in. If it is not provider, the provider region is used.

    getImageVersions Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    ImageVersions List<GetImageVersionsImageVersion>
    A list of composer image versions available in the given project and location. Each image_version contains:
    Project string
    Region string
    Id string
    The provider-assigned unique ID for this managed resource.
    ImageVersions []GetImageVersionsImageVersion
    A list of composer image versions available in the given project and location. Each image_version contains:
    Project string
    Region string
    id String
    The provider-assigned unique ID for this managed resource.
    imageVersions List<GetImageVersionsImageVersion>
    A list of composer image versions available in the given project and location. Each image_version contains:
    project String
    region String
    id string
    The provider-assigned unique ID for this managed resource.
    imageVersions GetImageVersionsImageVersion[]
    A list of composer image versions available in the given project and location. Each image_version contains:
    project string
    region string
    id str
    The provider-assigned unique ID for this managed resource.
    image_versions Sequence[GetImageVersionsImageVersion]
    A list of composer image versions available in the given project and location. Each image_version contains:
    project str
    region str
    id String
    The provider-assigned unique ID for this managed resource.
    imageVersions List<Property Map>
    A list of composer image versions available in the given project and location. Each image_version contains:
    project String
    region String

    Supporting Types

    GetImageVersionsImageVersion

    ImageVersionId string
    The string identifier of the image version, in the form: "composer-x.y.z-airflow-a.b.c"
    SupportedPythonVersions List<string>
    Supported python versions for this image version
    ImageVersionId string
    The string identifier of the image version, in the form: "composer-x.y.z-airflow-a.b.c"
    SupportedPythonVersions []string
    Supported python versions for this image version
    imageVersionId String
    The string identifier of the image version, in the form: "composer-x.y.z-airflow-a.b.c"
    supportedPythonVersions List<String>
    Supported python versions for this image version
    imageVersionId string
    The string identifier of the image version, in the form: "composer-x.y.z-airflow-a.b.c"
    supportedPythonVersions string[]
    Supported python versions for this image version
    image_version_id str
    The string identifier of the image version, in the form: "composer-x.y.z-airflow-a.b.c"
    supported_python_versions Sequence[str]
    Supported python versions for this image version
    imageVersionId String
    The string identifier of the image version, in the form: "composer-x.y.z-airflow-a.b.c"
    supportedPythonVersions List<String>
    Supported python versions for this image version

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v7.18.0 published on Wednesday, Apr 10, 2024 by Pulumi