pulumi / pulumi-google-native

Apache License 2.0
71 stars 18 forks source link

redis.v1.Instance location parameter is required and doesn't accept valid regions/zones #292

Open jimmy-marmalade opened 2 years ago

jimmy-marmalade commented 2 years ago

Hello!

Issue details

I'm trying to spin up a Redis instance with private service access. Providing region us-central1 as a location throws:

error: error sending request: googleapi: Error 400: Zone is not within instance Region.
    com.google.apps.framework.request.StatusException: <eye3 title='INVALID_ARGUMENT'/> generic::INVALID_ARGUMENT: Zone is not within instance Region.

and providing any zone us-central1-f throws:

error: error sending request: googleapi: Error 403: Location us-central1-f is not found or access is unauthorized.

Though documentation suggests location is optional, omitting the argument throws:

Diagnostics:
  google-native:redis/v1:Instance (test-maintenance):
    error: google-native:redis/v1:Instance resource 'test-maintenance' has a problem: missing required property 'location'. Either set it explicitly or configure it with 'pulumi config set google-native:region <value>'.

Steps to reproduce

Here is the declaration of the cache in Pulumi __main__.py.

cache = gcp_native.redis.v1.Instance(
    "test_instance",
    instance_id="test-instance",
    memory_size_gb=1,
    tier="BASIC",
    location="us-central1",
    authorized_network=stack.get_output("NETWORK_ID"),
    connect_mode="PRIVATE_SERVICE_ACCESS",
    redis_version="REDIS_6_X",
    reserved_ip_range=stack.get_output("CACHE_SERVICE_RANGE_NAME"),
    project=gcp_project,
    maintenance_policy=gcp_native.redis.v1.MaintenancePolicyArgs(
        weekly_maintenance_window= [gcp_native.redis.v1.WeeklyMaintenanceWindowArgs(
            day="MONDAY",
            start_time= gcp_native.redis.v1.TimeOfDayArgs(
                hours=17,
                minutes=0,
                seconds=0
            )
        )]
    ),
    opts=pulumi.ResourceOptions(
        ignore_changes=["reserved_ip_range"]
    ),
)

Expected: I expected a new redis instance to be spun up. Actual: Error complaining that my location value is invalid.

viveklak commented 2 years ago

Thanks for opening the issue. It looks like we are munging the location path parameter (region) with the locationId (zone) in the instance payload

KaoruDev commented 2 years ago

would love to see this get fixed! The classic provider doesn't support backup configurations 😞

chrisbbe commented 1 year ago

Any workaround for this?