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 host_error_timeout_seconds field to compute_instance on beta provider #11652

Merged

Conversation

karolgorc
Copy link
Contributor

@karolgorc karolgorc commented Sep 6, 2024

-Added field to google_compute_instance and google_compute_instance_template
-Added tests
-Added doc changes
-Added data_source support

Do you want me to introduce plan-time validation of this field or should the API handle errors on this field?

Release Note Template for Downstream PRs (will be copied)

compute: added `host_error_timeout_seconds` to `google_compute_instance` (beta)

@github-actions github-actions bot requested a review from NickElliot September 6, 2024 09:15
Copy link

github-actions bot commented Sep 6, 2024

Hello! I am a robot. Tests will require approval from a repository maintainer to run.

@NickElliot, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look.

You can help make sure that review is quick by doing a self-review and by running impacted tests locally.

@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Sep 6, 2024
@modular-magician modular-magician added service/compute-instances and removed awaiting-approval Pull requests that need reviewer's approval to run presubmit tests labels Sep 9, 2024
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 6 files changed, 13 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 12 files changed, 192 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 11 insertions(+))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_compute_instance (310 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_instance" "primary" {
  scheduling {
    maintenance_interval = # value needed
  }
}

Resource: google_compute_instance_from_machine_image (12 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_instance_from_machine_image" "primary" {
  scheduling {
    host_error_timeout_seconds = # value needed
    maintenance_interval       = # value needed
    min_node_cpus              = # value needed
    preemptible                = # value needed
  }
}

Resource: google_compute_instance_from_template (20 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_instance_from_template" "primary" {
  scheduling {
    host_error_timeout_seconds = # value needed
    maintenance_interval       = # value needed
    min_node_cpus              = # value needed
    on_host_maintenance        = # value needed
    preemptible                = # value needed
  }
}

Resource: google_compute_region_instance_template (60 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_region_instance_template" "primary" {
  scheduling {
    host_error_timeout_seconds = # value needed
  }
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 1000
Passed tests: 922
Skipped tests: 76
Affected tests: 2

Click here to see the affected service packages
  • compute

Action taken

Found 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccComputeInstanceTemplate_hostErrorTimeoutSeconds
  • TestAccComputeInstance_hostErrorTimeoutSecconds

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccComputeInstanceTemplate_hostErrorTimeoutSeconds[Debug log]
TestAccComputeInstance_hostErrorTimeoutSecconds[Debug log]

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{green}{\textsf{All tests passed!}}$

View the build log or the debug log for each test

Copy link
Contributor

@NickElliot NickElliot left a comment

Choose a reason for hiding this comment

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

if the API receiving an improper value aborts the entire operation, then it should be fine to allow the API to handle it. The concern with Terraform validation would be adding a maintenance cost should the values involved change. The reason to have it handled in Terraform is if the error could result in a potential permadiff or mismatch in state between local and remote.

Copy link
Contributor

@NickElliot NickElliot left a comment

Choose a reason for hiding this comment

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

misclick

karolgorc and others added 3 commits September 16, 2024 09:17
…l.markdown

Co-authored-by: Nick Elliot <nickelliot@google.com>
…plate.html.markdown

Co-authored-by: Nick Elliot <nickelliot@google.com>
…nce_template.html.markdown

Co-authored-by: Nick Elliot <nickelliot@google.com>
@github-actions github-actions bot requested a review from NickElliot September 16, 2024 07:18
@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Sep 16, 2024
@karolgorc
Copy link
Contributor Author

Just to clarify. Yes the error-handling is fully supported on the API side. Any incorrect input will fail the apply so there is no risk of having a permadiff.

@modular-magician modular-magician removed the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Sep 17, 2024
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 6 files changed, 13 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 12 files changed, 192 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 11 insertions(+))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_compute_instance (308 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_instance" "primary" {
  scheduling {
    maintenance_interval = # value needed
  }
}

Resource: google_compute_instance_from_machine_image (12 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_instance_from_machine_image" "primary" {
  scheduling {
    host_error_timeout_seconds = # value needed
    maintenance_interval       = # value needed
    min_node_cpus              = # value needed
    preemptible                = # value needed
  }
}

Resource: google_compute_instance_from_template (20 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_instance_from_template" "primary" {
  scheduling {
    host_error_timeout_seconds = # value needed
    maintenance_interval       = # value needed
    min_node_cpus              = # value needed
    on_host_maintenance        = # value needed
    preemptible                = # value needed
  }
}

Resource: google_compute_region_instance_template (60 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_region_instance_template" "primary" {
  scheduling {
    host_error_timeout_seconds = # value needed
  }
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 1007
Passed tests: 933
Skipped tests: 74
Affected tests: 0

Click here to see the affected service packages
  • compute

$\textcolor{green}{\textsf{All tests passed!}}$

View the build log

Copy link

@NickElliot This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

Copy link
Contributor

@NickElliot NickElliot left a comment

Choose a reason for hiding this comment

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

Need to ask one last question: for the "default behavior" is host_error_timeout_seconds still being returned in GET requests, or is the field not returned at all?

@karolgorc
Copy link
Contributor Author

If host_error_timeout_seconds is not set in terraform it's not a part of the final instance JSON payload and won't be set automatically by the API.

image

@github-actions github-actions bot requested a review from NickElliot September 23, 2024 06:59
@karolgorc
Copy link
Contributor Author

karolgorc commented Sep 23, 2024

While testing your question i found a bug that probably has something to do with the additional function for Diff on scheduling block. When removing the host_error_timeout_seconds field in an already applied configuration, terraform doesn't see a change in the config. Will work on a fix for this and write additional test

@karolgorc
Copy link
Contributor Author

karolgorc commented Sep 23, 2024

When removing the host_error_timeout_seconds field in an already applied configuration, terraform doesn't see a change in the config

Ok, this isn't specific to this field. Every field that isn't a ForceNew in the Scheduling block will be impacted by this.

Use automatic_restart as an example. The default is true but when:

  1. Apply with automatic_restart = false
  2. Remove the scheduling block
  3. Try to apply again
  4. Terraform doesn't see any change when it should go back to defaults

Do you want me to fix it in this PR? Or create a separate one. Because this field is fully functional and only held back by a block-wide bug

Most likely this will require a CustomizeDiff

Copy link
Contributor

@NickElliot NickElliot left a comment

Choose a reason for hiding this comment

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

Given it's part of behavior for the full block I think it's fine to approve as is, and introduce a new PR for fixing the wider bug. Thanks for the contribution!

@NickElliot NickElliot merged commit 973809a into GoogleCloudPlatform:main Sep 23, 2024
11 checks passed
abd-goog pushed a commit to abd-goog/magic-modules that referenced this pull request Sep 26, 2024
…provider (GoogleCloudPlatform#11652)

Co-authored-by: Nick Elliot <nickelliot@google.com>
niharika-98 pushed a commit to niharika-98/magic-modules that referenced this pull request Oct 7, 2024
…provider (GoogleCloudPlatform#11652)

Co-authored-by: Nick Elliot <nickelliot@google.com>
Philip-Jonany pushed a commit to Philip-Jonany/magic-modules that referenced this pull request Nov 4, 2024
…provider (GoogleCloudPlatform#11652)

Co-authored-by: Nick Elliot <nickelliot@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants