Skip to content
This repository has been archived by the owner on Feb 5, 2020. It is now read-only.

Always invoke terraform get #591

Merged
merged 1 commit into from
May 12, 2017
Merged

Conversation

aknuds1
Copy link
Contributor

@aknuds1 aknuds1 commented May 8, 2017

Always invoke terraform get in order to ensure that necessary modules are installed, to avoid build errors, rather than relying on whether the .terraform directory exists, since it might be stale.

See #571 for reference.

@coreosbot
Copy link

Can one of the admins verify this patch?

1 similar comment
@coreosbot
Copy link

Can one of the admins verify this patch?

cd $(BUILD_DIR) && $(TF_CMD) apply $(TOP_DIR)/platforms/$(PLATFORM)

destroy: installer-env ${BUILD_DIR}/.terraform
destroy: installer-env terraform-get
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are destroy, apply, & plan supposed to be phony? In other words: do you want them to run if a file named destroy is in the current dir?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will my change make destroy, apply and plan phony? I'm not a Make expert, but I figured that only the terraform-get target would become phony?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tested creating such files FWIW (destroy/apply/plan), it seems the targets are executed no matter what, even if they exist. I would expect Make to skip them since corresponding files exist. This behaviour is the same without my patch.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's always building because its dependencies also have missing outputs. I think your PR is better than what's currently in master, so I don't think it should be blocked on this.

I just didn't realize the Makefile was so hacky.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha thanks for clarifying this @ggreer :) I guess these targets should be phony.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aknuds1

Can you please give a bit of background on why this change is needed?
What is your use-case where you need to run get before every apply?

The current behaviour is to invoke get only when module cache is missing.

Copy link
Contributor Author

@aknuds1 aknuds1 May 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexsomesan The case is when the cache is missing one or more modules. I don't know how it came about, but I imagine it's because modules were added in the source, so that the cache became stale. It's only logical however that the cache can become out of sync with the source, we can't expect that it will stay relevant over time.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right that a new module being added would not trigger a get. In that sense, your change is brings more convenience. There is also a downside because this is invisible to the user and could "bite" unsuspecting users into applying changes that they weren't expecting.

However, since the cache is nothing more than a bunch of symlinks to the actual module files, changes to those could also bite in the same way with the current state of things.

Things being the way they are, I think your change is useful and won't surprise with unexpected side-effects.

Please rebase and it should be good to merge.

@aknuds1
Copy link
Contributor Author

aknuds1 commented May 9, 2017

Thanks @alexsomesan, I've rebased.

Makefile Outdated
@@ -21,16 +21,17 @@ installer-env: $(INSTALLER_BIN) terraformrc.example
localconfig:
mkdir -p $(BUILD_DIR)

$(BUILD_DIR)/.terraform:
.PHONY: terraform-get
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more thing: there already is a .PHONY section (at the end of the file).
Could you please move this over there?
It makes spotting target blocks easier when reading the Makefile.

@alexsomesan
Copy link
Contributor

Thanks! I forgot one thing: see comment about the .PHONY location.

@aknuds1
Copy link
Contributor Author

aknuds1 commented May 9, 2017

@alexsomesan Moved the phony declaration!

Copy link
Contributor

@alexsomesan alexsomesan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@alexsomesan
Copy link
Contributor

ok to test

@s-urbaniak s-urbaniak merged commit 2ec10e8 into coreos:master May 12, 2017
alekssaul added a commit to alekssaul/tectonic-installer that referenced this pull request May 15, 2017
s-urbaniak pushed a commit that referenced this pull request Jun 1, 2017
* Initial VMware Support

* Always invoke terraform get to ensure we have the necessary modules (#591)

* Makefile: add vmware docs-examples

* Run make docs for VMware updates

To address; #639 (comment)

* Run terraform fmt on VMware content

run `terraform fmt ./platforms/vmware/` , `terraform fmt ./modules/vmware/etcd` , `terraform fmt ./platforms/vmware/nodes` to address #639 (comment)

* Variables cleanup and change ssh variable

- cleanup variables.tf and run `make examples` to address; #639 (comment)
- run `make docs` 
- update `tectonic_ssh_authorized_key` to `tectonic_vmware_ssh_authorized_key ` to address #639 (comment)

* Fix Makefile conflict with vmware branch

* vmware: remove redundant bootkube content_hash variable

Related to #575

* vmware: remove username secrets from variables.tf

Removes VMware Username and Password variables from variables.tf.

User will be prompted to enter credentials at terraform execution time, such as. 
```
provider.vsphere.password
  The user password for vSphere API operations.

  Enter a value: 

provider.vsphere.user
  The user name for vSphere API operations.

  Enter a value: 
```

* VMware: fix Master CPU/memory vars issue

Master Node provisioning was utilizing worker CPU and memory variables.

* vmware examples - re-run make docs examples

* vmware: compute service k8s IPs

Add changes in #767 for VMware

* vmware: Replace all occurences of path.cwd

Applies d3e0a6a into vmware platform

* vmware: Bump bootkube v0.4.4 & hyperkube v1.6.4_coreos.0 

Applies requirements for 5941fda on VMware Platform

* vmware: run terraform fmt
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants