pulumi / pulumi-gcp

A Google Cloud Platform (GCP) Pulumi resource package, providing multi-language access to GCP
Apache License 2.0
183 stars 53 forks source link

Cannot enable private environment for Composer v2 after v7.14.0 #2387

Open sstiglitz opened 2 months ago

sstiglitz commented 2 months ago

Describe what happened

When setting enable_private_environment=True on a Composer v2 environment, it throws an error stating it can only be used on a Composer v3 environment.

When using pulumi-gcp>=7.7.0,<=7.11.2, this setting can be used on a Composer v2 environment. And it works as intended, I have created multiple Composer v2 environments with this setting enabled.

Only after I upgrade to pulumi-gcp>=7.14.0,<=8.1.0 does this throw an error. I checked the most recent version 8.1.0 and still throws this error.

Sample program

import pulumi_gcp as gcp
from iac.infra.gcp.providers import my_gcp_provider
from pulumi import ResourceOptions

gcp.composer.Environment(
    "test-composer",
    config=gcp.composer.EnvironmentConfigArgs(
        enable_private_environment=True,
        private_environment_config=gcp.composer.EnvironmentConfigPrivateEnvironmentConfigArgs(
            enable_private_endpoint=True,
        ),
        environment_size="ENVIRONMENT_SIZE_SMALL",
        software_config=gcp.composer.EnvironmentConfigSoftwareConfigArgs(
            image_version="composer-2.8.1-airflow-2.7.3",

        ),
    ),
    opts=ResourceOptions(provider=my_gcp_provider),
)

Log output

$ pulumi up
Previewing update (removed)

     Type                         Name                    Plan       Info
     pulumi:pulumi:Stack          my-project-my-stack             1 error; 3 warnings
 +   └─ gcp:composer:Environment  test-composer           create     1 error

Diagnostics:
  gcp:composer:Environment (test-composer):
    error: Preview failed: diffing urn:pulumi:my-stack::my-project::gcp:composer/environment:Environment::test-composer: error in configuration, config.0.enable_private_environment should only be used in Composer 3

Affected Resource(s)

No response

Output of pulumi about

$ pulumi about

CLI          
Version      3.132.0
Go Version   go1.23.1
Go Compiler  gc

Plugins
KIND      NAME        VERSION
resource  aws         6.52.0
resource  aws-native  0.123.0
resource  gcp         7.14.0
language  python      unknown

Host     
OS       arch
Version  "rolling"
Arch     x86_64

This project is written in python: executable='~/dev/iac/.venv/bin/python' version='3.12.5'

Current Stack: removed

TYPE                                                          URN
removed

Found no pending operations associated with removed

Backend        
Name           pulumi.com
URL            removed
User           removed
Organizations  removed
Token type     personal

Dependencies:
NAME               VERSION
ansible            10.4.0
boto3              1.35.20
botocore-stubs     1.35.20
mypy               1.11.2
pip                24.2
pre-commit         3.8.0
pulumi_aws         6.52.0
pulumi_aws_native  0.123.0
pulumi_gcp         7.14.0
pytest-mock        3.14.0
responses          0.25.3
setuptools         75.1.0

Pulumi locates its logs in /tmp by default

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

iwahbe commented 2 months ago

Hi @sstiglitz. I'm sorry to hear that.

I think that this change was introduced in https://github.com/GoogleCloudPlatform/magic-modules/pull/9917 and is by design. My understanding is that enable_private_environment=True wasn't ever valid for Composer v2, but I'm not super familiar with composer so I could be wrong here.