hashicorp / terraform-provider-docker

As part of our introduction to self-service publishing in the Terraform Registry, this copy of the provider has been archived, and ownership has been transferred to active maintainers in the community. Please see the new location on the Terraform Registry: https://registry.terraform.io/providers/kreuzwerker/docker/latest
https://registry.terraform.io/providers/kreuzwerker/docker/latest
Mozilla Public License 2.0
132 stars 92 forks source link

grpc: received message larger than max when "upload" references large files #239

Closed stephenliberty closed 4 years ago

stephenliberty commented 4 years ago

Terraform Version

0.12.19

Affected Resource(s)

Terraform Configuration Files

resource "docker_container" "app-core" {
  image = var.tomcat_base_image
  name = "${var.slot}-app-core"

  upload {
    file = "/opt/tomcat/webapps/b.war"
    content_base64 = filebase64(var.first_war_path)
  }
  upload {
    file = "/opt/tomcat/webapps/g.war"
    content_base64 = filebase64(var.second_war_path)
  }
  upload {
    file = "/opt/tomcat/conf/Catalina/localhost/b.xml"
    content_base64 = filebase64(var.tomcat_context_path)
  }
  upload {
    file = "/opt/tomcat/conf/Catalina/localhost/g.xml"
    content_base64 = filebase64(var.tomcat_context_path)
  }

  networks_advanced {
    name = "frontend"
  }
  networks_advanced {
    name = var.slot
    aliases = [
      "<snip>"
    ]
  }

  env = [for k,ec in merge(
    local.app-core-env-config,
    local.shared-env-config
  ): "${k}=${ec}"]
}

Debug Output

There's a lot of info that I'm not keen on sharing, but this is likely the only thing relevant:

2020/01/13 18:51:33 [DEBUG] Resource instance state not found for node "docker_container.app-core", instance docker_container.app-core
2020/01/13 18:51:33 [DEBUG] ReferenceTransformer: "docker_container.app-core" references: []
2020/01/13 18:53:39 [ERROR] <root>: eval: *terraform.EvalDiff, err: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (1023714897 vs. 4194304)
2020/01/13 18:53:39 [ERROR] <root>: eval: *terraform.EvalSequence, err: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (1023714897 vs. 4194304)

Panic Output

Expected Behavior

I assume the war files should have been copied.

Actual Behavior

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

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply with a docker_container that has a large file uploaded to it

Important Factoids

Nope

References

As an aside, I would argue that if possible we shouldn't be keeping the entire content_base64 as a state item if possible. A sha512 or some other hash should be more than enough to know whether or not it's changed, and regardless of the content if there is a change, the entire thing is recreated anyway. Just wish I actually know Go enough to be of some help here.

stephenliberty commented 4 years ago

Aaand I guess there's not much more to do on a night when one is snowed in than to try to fix the problem and submit a pull request. So.. there it is.