Skip to content

403 Error while applying a netlify_site_build_settings resource on Netlify's free tier #74

@RogWilco

Description

@RogWilco

I have a fairly straightforward netlify_site_build_settings resource defined, and after importing I am unable to run apply with no changes. Viewing the plan it appears to want to change the read only property functions_region from us-east-1 to us-east-2.

Here's the resource block:

resource "netlify_site_build_settings" "production" {
  site_id = data.netlify_site.production.id
  build_command = "yarn dist"
  production_branch = "main"
  publish_directory = "dist"

  branch_deploy_branches = [
    "main"
  ]
}

The plan output:

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # netlify_site_build_settings.production will be updated in-place
  ~ resource "netlify_site_build_settings" "production" {
      ~ branch_deploy_branches     = [
          ~ "master" -> "main",
        ]
      ~ functions_region           = "us-east-1" -> "us-east-2"
      + last_updated               = (known after apply)
        # (12 unchanged attributes hidden)
    }

  # netlify_site_domain_settings.production will be updated in-place
  ~ resource "netlify_site_domain_settings" "production" {
      ~ last_updated                 = "Saturday, 09-Nov-24 14:26:22 PST" -> (known after apply)
        # (5 unchanged attributes hidden)
    }

Plan: 0 to add, 2 to change, 0 to destroy.

And the 403 response:

│ Error: Error updating site build settings
│
│   with netlify_site_build_settings.production,
│   on terraform.tf line 27, in resource "netlify_site_build_settings" "production":
│   27: resource "netlify_site_build_settings" "production" {
│
│ Could not update site build settings for site "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx": "422 Unprocessable Entity: {\"code\":422,\"message\":\"You cannot edit functions
│ regions\"}"

I think the 403 error is correct and it should not be trying to change a read only property. If I try to set it to the preexisting value anyway, the plan output will omit the change. But if I then apply, I'll still get the same 403 error about the same field.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions