mesosphere-backup / terraform-dcos

DC/OS Terraform Installation and Upgrading Scripts
Apache License 2.0
62 stars 64 forks source link

Why won't terrafom get -update, update to the latest module ? #64

Closed dotemacs closed 6 years ago

dotemacs commented 6 years ago

I've been using the modules from https://github.com/dcos/terraform-dcos from DC/OS 1.9 days, upgrading the as things went on.

Then went to get the latest terraform modules, did:

terraform get -update

it would spit, as expected:

- module.dcos-bootstrap
  Updating source "github.com/bernadinm/tf_dcos_core"
- module.aws-tested-oses
  Updating source "./modules/dcos-tested-aws-oses"
- module.dcos-mesos-master
  Updating source "github.com/bernadinm/tf_dcos_core"
- module.dcos-mesos-agent
  Updating source "github.com/bernadinm/tf_dcos_core"
- module.dcos-mesos-agent-public
  Updating source "github.com/bernadinm/tf_dcos_core"

But when I went to upgrade the cluster to version 1.11.3, it complained that this version didn't exist. So I went into .terraform/modules/a696280d316c2d4460c704982364ea98 to look at what version is there and doing git log in it:

28d323d (HEAD -> master, origin/master, origin/HEAD) removing DC/OS 1.7 from version list
ee3486e adding DC/OS 1.11.2
2643e62 adding DC/OS 1.10.6
4154a66 adding DC/OS 1.11.1
577afef adding DC/OS 1.9.7 and 1.9.8
...

.terraform/modules/a696280d316c2d4460c704982364ea98 corresponds to:

https://github.com/dcos/tf_dcos_core

Looking at the commits in that repo, I can find a commit that the SHA 28d323d points to.

But I can find another commit, with the same subject, but different SHA:

https://github.com/dcos/tf_dcos_core/commit/e37a8be9d4d62e9f2fae0ed8867e62a24e06e6ed

But looking at the commit before: ee3486e, I can find where it's at: https://github.com/dcos/tf_dcos_core/commit/ee3486e9c7af1b52f6f0b481f73ee1b25da1436d

Is there a breaking change that prevents the upgrade of the modules, so that 1.11.3 can be obtained?

dotemacs commented 6 years ago

Looking at this issue: https://github.com/hashicorp/terraform/issues/15701 by @bernadinm

I've tried also: terraform get -update=true

But I don't see the update.

So I tried the crude:

ls -1 **/dcos-versions/ | grep "1.11.3"

in .terraform/modules which doesn't find a mention of 1.11.3.

bernadinm commented 6 years ago

Thanks @dotemacs. This was because the github.com/bernadinm/tf_dcos_core module has been moved to dcos/tf_dcos_core is been updated more recently. They are now in sync with the latest changes but feel free to move the repo over to github.com/dcos/tf_dcos_core and you'll always get the latest DC/OS updates.

You can perform this command to update your current module rm -fr .terraform && terraform init

dotemacs commented 6 years ago

Posting this for anybody that might stumble upon it.

Solution

Just do:

rm -fr .terraform && terraform init

Which should fetch the modules correctly.

The cause

The module tf_dcos_core was moved from https://github.com/bernadinm/tf_dcos_core to https://github.com/dcos/tf_dcos_core