hey, i can't seem to get a cloud function to redep...
# python
s
hey, i can't seem to get a cloud function to redeploy when the code has been updated, a new zip is created and uploaded to a bucket that has versioning enabled, a new build isn't triggered. Any pointers appreciated, thanks
Copy code
artifact_bucket = gcp.storage.Bucket("artifact-bucket",
    name="REDACTED",
    location="europe-west2",
    versioning=gcp.storage.BucketVersioningArgs(
        enabled=True,
    ))

api_auth_archive = gcp.storage.BucketObject(
        "api-auth-archive",
        name="api_auth_archive.zip",
        bucket=artifact_bucket.name,
        source=pulumi.AssetArchive({".": pulumi.FileArchive("source/api/auth")}),
    )

    api_auth = gcp.cloudfunctions.Function(
        "api-auth",
        name="api-auth",
        region="europe-west2",
        runtime="python310",
        entry_point="get_jwt",
        source_archive_bucket=artifact_bucket.name,
        source_archive_object=api_auth_archive.name,
        trigger_http=True,
        https_trigger_security_level="SECURE_ALWAYS",
        available_memory_mb=256,
        environment_variables={"ENV": env},
    )
a
Have you verified that the zip is actually updated? Possible workarounds: • Append a hash of the zip to the name so that it is replaced when the contents of the code changes • Use `replace_on_changes` resource option on the bucket object • Have you tried using the
content
parameter instead of the
source
parameter? This issue for the native provider might also provide some more insights
s
hey @adventurous-butcher-54166 yes I have, the hash is different and the contents when i download and check it I've litrally just mgot the replaceoent working, having mved it over to 2nd gen using
cloudfunctionsv2
was just coming to remove this post! Thanks for taking the time to reply