GithubHelp home page GithubHelp logo

Comments (14)

mavogel avatar mavogel commented on July 26, 2024 2

from terraform-provider-docker.

suzuki-shunsuke avatar suzuki-shunsuke commented on July 26, 2024 1

#14 (comment)

Oh, sorry. I confirmed that this is fixed at the master.
I'll close #15 .

from terraform-provider-docker.

suzuki-shunsuke avatar suzuki-shunsuke commented on July 26, 2024

Hmm..
I fixed the bug by hashicorp/terraform-provider-docker#272 ...

from terraform-provider-docker.

suzuki-shunsuke avatar suzuki-shunsuke commented on July 26, 2024

Oh, Computed: true was removed??

"working_dir": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
DiffSuppressFunc: func(k, oldV, newV string, d *schema.ResourceData) bool {
// treat "" as a no-op, which is Docker's default behavior
if newV == "" {
newV = oldV
}
return oldV == newV
},
},

from terraform-provider-docker.

suzuki-shunsuke avatar suzuki-shunsuke commented on July 26, 2024

Computed: true was removed by this commit.
hashicorp/terraform-provider-docker@cdc0d91

from terraform-provider-docker.

suzuki-shunsuke avatar suzuki-shunsuke commented on July 26, 2024

Will be fixed by #15

from terraform-provider-docker.

dubo-dubon-duponey avatar dubo-dubon-duponey commented on July 26, 2024

@suzuki-shunsuke that might be fixed already:

hashicorp/terraform-provider-docker#319

hashicorp/terraform-provider-docker#320

@quentinadam do you mind trying with master?

from terraform-provider-docker.

quentinadam avatar quentinadam commented on July 26, 2024

Happy to try that of course. I guess I should change something in the "versions.tf" file to use the latest master version instead of version 2.8.0 ? Would you mind pointing out what I should change in that file ? Here is the current version of the versions.tf file :

terraform {
  required_providers {
    digitalocean = {
      source = "digitalocean/digitalocean"
    }
    docker = {
      source = "kreuzwerker/docker"
    }
  }
  required_version = ">= 0.13"
}

from terraform-provider-docker.

dubo-dubon-duponey avatar dubo-dubon-duponey commented on July 26, 2024

@quentinadam

https://github.com/kreuzwerker/terraform-provider-docker/#developing-the-provider

These instructions suggest that you can just build it and use it by removing the version.

I don't remember if this ^ works or not though.

Here is what I've been doing (possibly because the above ^ is outdated?)

  1. clone and build (make build) - you should now have a built plugin in your GOPATH/bin folder.

In my case:

dmp@macArena:~/Projects/Deploy/home$ which terraform-provider-docker
/Users/dmp/Applications/bin/gvm/pkgsets/go1.15/global/bin/terraform-provider-docker
  1. Create ~/.terraformrc with the following:
provider_installation {
  filesystem_mirror {
    path    = "/Users/dmp/Projects/Deploy/home/built-plugins/"
    include = ["terraform-providers/docker"]
  }
}

^ adapt this path to whatever suits you.

  1. Copy the plugin
dest=/Users/dmp/Projects/Deploy/home/built-plugins/registry.terraform.io/terraform-providers/docker/2.7.2/darwin_amd64
mkdir -p "$dest"

cp $(which terraform-provider-docker) "$dest"

Be sure to adapt the version and platform in the path to match your mileage.

Curious if there is a simpler / more straightforward way to achieve that.

from terraform-provider-docker.

mavogel avatar mavogel commented on July 26, 2024

Then we'd trigger a release as soon as #12 is fixed

from terraform-provider-docker.

dubo-dubon-duponey avatar dubo-dubon-duponey commented on July 26, 2024

@mavogel @suzuki-shunsuke I've been thinking more about this patch.

It makes the situation better, for sure, but I now think it's wrong / incomplete.

Here is what should happen:

  • if working_dir is explicitly set to value A:
    • if the existing container has value B (!= A) for working_dir, rebuild
    • if the existing container has value A, do not rebuild
  • if working_dir is not set, or set to "":
    • if working_dir was previously NOT set (or set to to ""), do NOT rebuild (regardless of the value of working_dir in the running container)
    • if working_dir was previously set to value B (!= ""), and if the container "in dockerfile" working_dir was C (!= B), then rebuild

I have no idea how to do that... since this involve looking up both the past value of working_dir, and the value of working_dir if the container was started without explicitly overriding working_dir...

With what we have right now, this will be wrong in the following scenario:

  • container was previously started with working_dir = A (where A is different from whatever the container had internally)
  • we now ask for a reapply with working_dir = ""
  • -> the container will not be rebuilt (while it should)

Again, I think what we have now is much better than before, but it will still be wrong in corner cases like that...

from terraform-provider-docker.

suzuki-shunsuke avatar suzuki-shunsuke commented on July 26, 2024

#14 (comment)
@mavogel How about releasing the new version? #26 was merged.

from terraform-provider-docker.

quentinadam avatar quentinadam commented on July 26, 2024

Great ! I am confirming that it now works as expected (not defining "working_dir" does not trigger a container replacement on every run).

from terraform-provider-docker.

mavogel avatar mavogel commented on July 26, 2024

Happy to hear that! Will close it.

from terraform-provider-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.