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

Can't create Cloud Functions Actions that are larger than 4mb #1795

Closed
forgems opened this issue Aug 12, 2020 · 5 comments
Closed

Can't create Cloud Functions Actions that are larger than 4mb #1795

forgems opened this issue Aug 12, 2020 · 5 comments
Assignees

Comments

@forgems
Copy link

forgems commented Aug 12, 2020

When trying to create a nodejs action from zipfile terraform apply fails with following error

Error: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (8316886 vs. 4194304)

After briefly searching on the internet this could be an issue with the terraform not accepting variables larger then 4mb in it's state.

Terraform Version

Terraform v0.12.24
+ provider.ibm v1.10.0

Affected Resource(s)

Please list the resources as a list, for example:

  • ibm_function_action

Terraform Configuration Files

terraform {
    required_providers {
        ibm = "~> 1.10"
    }
}

provider ibm {
  ibmcloud_api_key      = var.ibmcloud_api_key
  region                = var.region
}

data "ibm_resource_group" "resource_group" {
  is_default = true
}

resource "ibm_function_namespace" "namespace" {
    name = var.namespace
    resource_group_id = data.ibm_resource_group.resource_group.id
}

resource "ibm_function_action" "test_action" {
  name = "test_action"
  namespace = ibm_function_namespace.namespace.name
  exec {
    kind = "nodejs:10"
    code = filebase64("../test_action.zip")
  }
  publish = true
  user_defined_annotations = jsonencode([
    {
        "key": "web-export",
        "value": true,
    },
    {
        "key": "hash",
        "value": filesha256("../test_action.zip")
    }
  ])

}

Debug Output

https://gist.github.com/forgems/1070043f840cd3ca602ea4d2d126e27e

Expected Behavior

Action is deployed

Actual Behavior

Error shows up and action is not created

Steps to Reproduce

  1. terraform apply
@anilkumarnagaraj anilkumarnagaraj self-assigned this Aug 13, 2020
@anilkumarnagaraj
Copy link
Collaborator

anilkumarnagaraj commented Aug 18, 2020

This is a known limitation with terraform. There is already an issue opened in terraform for the same.
hashicorp/terraform-provider-local#28
We will look for a possible workaround and get back to you.

@anilkumarnagaraj
Copy link
Collaborator

Fix is available in the latest release https://github.com/IBM-Cloud/terraform-provider-ibm/releases/tag/v1.21.1

We have added a new argument 'code_path' in ibm_function_action, which will take the file path as an input.
Please refer to below link for more info:
https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/function_action

ex:
resource "ibm_function_action" "my_action" {
name = "my-action"
namespace = var.cloud_functions_namespace

exec {
	kind = var.python_kind
	code_path = "bundle.zip"
}

}

@hkantare
Copy link
Collaborator

closing the issue based on above comments

@gipfelen
Copy link

The fix works great, but when executing terraform destroy I get the same error message as before:

The plugin returned an unexpected error from plugin.(*GRPCProvider).PlanResourceChange: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (6361432 vs. 4194304)

@3dteemu
Copy link

3dteemu commented Feb 3, 2022

This is still an issue. It worked at some point but is broken at least with the latest version of the provider.
I cannot do anything at the moment, not even terraform refresh because of this bug.

I am using

exec {
    kind = var.node_kind
    code_path = "path/to/bundle.zip"
  }

and the error I get

The plugin returned an unexpected error from plugin.(*GRPCProvider).PlanResourceChange: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (7828501 vs. 4194304)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants