asset/cluster: Invoke terraform in a temp dir.#319
asset/cluster: Invoke terraform in a temp dir.#319openshift-merge-robot merged 1 commit intoopenshift:masterfrom
Conversation
|
Does this mean we won't have the Terraform state around for cluster deletion? |
pkg/asset/cluster/cluster.go
Outdated
There was a problem hiding this comment.
Do we really want to unconditionally remove the terraform state? We could gate this with an option to keep tempfiles if someone wishes to, so we can use it for destruction later
There was a problem hiding this comment.
@steveej We still have the tfstate file in the assets dir, it will be persisted by the store
https://github.com/openshift/installer/blob/master/cmd/openshift-install/main.go#L47
https://github.com/openshift/installer/blob/master/cmd/openshift-install/main.go#L66
pkg/asset/cluster/cluster.go
Outdated
There was a problem hiding this comment.
this comment is not true anymore with this PR
There was a problem hiding this comment.
Updated the comment also mention that the tfstate file will be persisted on the disk.
|
@wking No, the terraform.state will be persisted into the cluster dir too, but it's done by the asset store when it's resolving the dependency. |
In order to be able to use openshift-install to launch multiple clusters we need to create a working dir for each invocation. Here we create a tmp dir that has the terraform.tfvars file and invoke the cluster within the dir. The dir will be removed after the invocation is done.
7f3ae0a to
408c066
Compare
|
/approve (assuming the tests are a flake but haven't checked) |
|
/retest |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: abhinavdahiya, steveeJ, yifan-gu The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
From [1]: If dir is the empty string, TempDir uses the default directory for temporary files (see os.TempDir). so there's no point in us calling TempDir() directly. The explicit call is from 408c066 (asset/cluster: Invoke terraform in a temp dir, 2018-09-24, openshift#319). [1]: https://golang.org/pkg/io/ioutil/#TempDir
In order to be able to use openshift-install to launch multiple
clusters we need to create a working dir for each invocation.
Here we create a tmp dir that has the terraform.tfvars file and
invoke the cluster within the dir.
The dir will be removed after the invocation is done.