Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB Instance: can't ignore changes to 'diskSize' - blocks all updates to DB instance with diskAutoresize: true #549

Closed
c2h5oh opened this issue Mar 26, 2021 · 7 comments
Labels
kind/bug Some behavior is incorrect or out of spec resolution/by-design This issue won't be fixed because the functionality is working as designed

Comments

@c2h5oh
Copy link

c2h5oh commented Mar 26, 2021

Cloud SQL (PostgreSQL) instance created with diskAutoresize: true and empty diskSize will fail to update if autoresize has increased storage size beyond the default 10 GB, even if ignoreChanges: [ "diskSize" ] :

Error, failed to update instance settings for : googleapi: Error 400: Invalid request: The disk size cannot decrease. Current size: 37 GB, requested: 10 GB.., invalid

pulumi v2.23.1
pulumi-gcp 4.15.0

Expected behavior

ignoreChanges allows to ignore a change to diskSize that got increased by GCP because of diskAutoresize: true

Current behavior

ignoreChanges: [ "diskSize" ] doesn't cause diskSize changes to be ignored

Steps to reproduce

  1. Create db instance with empty diskSize (will default to 10), diskAutoresize: true and ignoreChanges: [ "diskSize" ]
  2. Insert enough data into db to cause autoresize to increase db disk size over the default 10 GB
  3. Change any configuration value for that db instance and try to apply it
@c2h5oh c2h5oh added the kind/bug Some behavior is incorrect or out of spec label Mar 26, 2021
@komalali komalali added kind/bug Some behavior is incorrect or out of spec and removed kind/bug Some behavior is incorrect or out of spec labels Mar 30, 2021
@komalali
Copy link
Member

Can you provide some code to reproduce the issue?

@c2h5oh
Copy link
Author

c2h5oh commented Mar 30, 2021

Sure. Create postgresql instance, db and user with:

const instance = new gcp.sql.DatabaseInstance(
    `postgres-instance`,
    {
        databaseVersion: "POSTGRES_13",
        settings: {
            tier: "db-custom-1-4096",
            availabilityType: "ZONAL",
            activationPolicy: "ALWAYS",
            diskAutoresize: true,
            diskType: "PD_SSD",
            ipConfiguration: {
                ipv4Enabled: true,
            }
        }
    },
    {
        ignoreChanges: [
            "diskSize"
        ],
    }
);

const user = new gcp.sql.User(
    `my-user`,
    {
        instance: instance.name,
        name: "my-user",
        password: "my-password",
    }
);

const database = new gcp.sql.Database(
    `my-database`,
    {
        instance: instance.name,
        name: `my-database`,
        charset: "UTF8",
        collation: "en_US.UTF8",
    }
);

Connect to that database with your favorite SQL client and generate 15 GB of data in that database:

CREATE TABLE test_data(
    col1 bigint
);

INSERT INTO test_data (col1) SELECT generate_series(1, 503316480);

This is going to run for a while - writing 15 GB in 32 byte rows takes some time.

Run pulumi up again. It will fail unless you increase diskSize to a value larger than the one it was resized to because of diskAutoresize: true.

@bmyers427
Copy link

Any updates or workarounds for this? I'm facing the same exact issue

@stack72 stack72 added kind/bug Some behavior is incorrect or out of spec and removed kind/bug Some behavior is incorrect or out of spec labels Jul 4, 2022
@ghost
Copy link

ghost commented Aug 12, 2022

Seeing this aswell, Error, failed to update instance settings for : googleapi: Error 400: Invalid request: The disk size cannot decrease. Current size: 3803 GB, requested: 628 GB.., invalid

Using typescript with autoresize = true and disk_size not set.

It appears running the refresh step unblocks updates to the database instance.

@gunar
Copy link

gunar commented Oct 20, 2022

Same problem here. As @thomas-gallop mentioned, using --refresh fixes this.

@sbjorn
Copy link

sbjorn commented Oct 31, 2022

Passing ignore_changes=['settings.diskSize'] works well on my end. (Definitions written in python)

@mikhailshilkov mikhailshilkov added the resolution/by-design This issue won't be fixed because the functionality is working as designed label Oct 27, 2023
@mikhailshilkov
Copy link
Member

I think this is by design. The ignoreChanges option makes Pulumi use the previous value, which, when sent to the API, is rejected by Google Cloud. Since the drift is created on the Google side, the use of refresh is required in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/by-design This issue won't be fixed because the functionality is working as designed
Projects
None yet
Development

No branches or pull requests

7 participants