Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop instances #697

Closed
magg opened this issue Jan 24, 2019 · 4 comments
Closed

Stop instances #697

magg opened this issue Jan 24, 2019 · 4 comments
Assignees

Comments

@magg
Copy link

magg commented Jan 24, 2019

How can I specify the state of my instances to be stopped once they are created?

terraform -v
Terraform v0.11.11
+ provider.oci v3.1.1

Something like this is should be useful for everyone

 terraform oci_core_instance.TFInstance -state="STOPPED"
@alexng-canuck
Copy link
Member

alexng-canuck commented Jan 25, 2019

Hi @magg ,

AFAIK, terraform <Resource Name> -state="<State>" is not a syntactically valid Terraform command. Are you suggesting that the Terraform command should be able to directly modify the attributes of arbitrary resources? If so, this is feedback that would get more traction in the https://github.com/hashicorp/terraform/issues project.

That being said, a possible improvement to the OCI provider would be to allow specifying the state in your TF configuration like this.

resource oci_core_instance TFInstance {
  ...
  power_state = "STOPPED"
}

and then running terraform apply

@magg
Copy link
Author

magg commented Jan 25, 2019

Yes that would be nice for terraform to allow that syntax to manage the vm's state but i think that won't happen any time soon.

According to these: they think providers should implement such feature

hashicorp/terraform#1579
hashicorp/terraform-provider-azurerm#555

In any case that improvement you mentioned sounds good

but how would i turn it back on?

resource oci_core_instance TFInstance {
  ...
  power_state = "RUNNING"
}

and then terraform apply?

@alexng-canuck
Copy link
Member

This would need more design input, because there are certain actions like "RESET" or "SOFT_RESET" for which it's hard to say what the final state should be and would cause issues if Terraform were to store those values in the state file.

But the general idea in my last comment is that this should be achieved through modifying the configuration file rather than as cmdline input.

@kilokahn
Copy link
Member

The feature is now available in the v3.18.0 of the provider.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants