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

Add preemptible as an option to node config #341

Merged

Conversation

selmanj
Copy link
Contributor

@selmanj selmanj commented Aug 18, 2017

Closes #334

@@ -669,6 +669,7 @@ func flattenClusterNodeConfig(c *container.NodeConfig) []map[string]interface{}
"image_type": c.ImageType,
"labels": c.Labels,
"tags": c.Tags,
"preemptible": c.Preemptible,
Copy link
Contributor

Choose a reason for hiding this comment

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

while you're here- it probably makes sense to have this in node_config.go too, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, I moved it

@@ -712,6 +712,7 @@ resource "google_container_cluster" "with_node_config" {
foo = "bar"
}
tags = ["foo", "bar"]
preemptible = true
Copy link
Contributor

Choose a reason for hiding this comment

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

can you also add a check for this in testAccCheckContainerCluster?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added!

Interestingly the tests were failing without having to add any changes to check for preemptible (likely because the default is false, and the requested value is true, which creates a perpetual diff unless it's hooked up properly).

BTW, I assumed this method was just checking to see if the resource existed; I didn't realize it did all the checking inside this method. Some other resources look up the remote resource and store the api object in a variable, and then assert on that. Which is preferred for new resources?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not really sure- I did this one sort of as an experiment, and it definitely doesn't catch everything since it just checks that state matches remote, but not that those are actually the values we want (I actually had a bug slip through once because of this). Right now I've been using TestCheckResourceAttrSet to check that the correct values are in state for what I care about but I don't know if that actually checks that I did it with a .Set.

@@ -356,6 +356,7 @@ resource "google_container_node_pool" "np_with_node_config" {
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring"
]
preemptible = true
Copy link
Contributor

Choose a reason for hiding this comment

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

likewise for testAccCheckContainerNodePoolMatches

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

@CGavrila
Copy link

@selmanj @danawillow Any idea when this will make it into a release?

@danawillow danawillow self-assigned this Sep 1, 2017
@danawillow
Copy link
Contributor

👍 , merge at will.

@CGavrila this will be in our next release. I don't have a hard date for it yet but probably within the next week or so.

@CGavrila
Copy link

CGavrila commented Sep 1, 2017

Thanks, @danawillow! Quite excited about this one.

@selmanj selmanj merged commit 0605638 into hashicorp:master Sep 1, 2017
@selmanj selmanj deleted the add_preemptible_to_nodepool_config branch September 1, 2017 20:02
@selmanj selmanj restored the add_preemptible_to_nodepool_config branch September 17, 2017 19:49
negz pushed a commit to negz/terraform-provider-google that referenced this pull request Oct 17, 2017
* Add preemptible as an option to node config

* Check for preemptible in test matching functions

* Move flattenClusterNodeConfig to node_config

* Handle bools properly when comparing in cluster and node pool tests

* Use a supported image_type in cluster tests
chrisst pushed a commit to chrisst/terraform-provider-google that referenced this pull request Nov 9, 2018
* Add preemptible as an option to node config

* Check for preemptible in test matching functions

* Move flattenClusterNodeConfig to node_config

* Handle bools properly when comparing in cluster and node pool tests

* Use a supported image_type in cluster tests
luis-silva pushed a commit to luis-silva/terraform-provider-google that referenced this pull request May 21, 2019
<!-- This change is generated by MagicModules. -->
/cc @rileykarson
@ghost
Copy link

ghost commented Mar 31, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 31, 2020
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.

Feature Request: Allow to use preemptible flag for google container cluster
3 participants