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 resource_policy resource to compute #1850

Merged
merged 4 commits into from
Jun 5, 2019
Merged

Add resource_policy resource to compute #1850

merged 4 commits into from
Jun 5, 2019

Conversation

tysen
Copy link

@tysen tysen commented May 29, 2019

Fixes hashicorp/terraform-provider-google#3062


[all]

[terraform]

[terraform-beta]

[ansible]

[inspec]

@tysen tysen requested a review from emilymye May 29, 2019 21:28
@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician, I work on Magic Modules.
This PR seems not to have generated downstream PRs before, as of 3e7a15e99f64db235bbafc16a50a73bcddcb468b.

Pull request statuses

No diff detected in terraform-google-conversion.
No diff detected in terraform-provider-google.
No diff detected in Ansible.
No diff detected in Inspec.

New Pull Requests

I built this PR into one or more new PRs on other repositories, and when those are closed, this PR will also be merged and closed.
depends: hashicorp/terraform-provider-google-beta#784

@123BLiN
Copy link

123BLiN commented May 30, 2019

@tysen
Not sure if this is right place to comment, sorry if not.

I think I have an issue with this build, it forces new resource every time due to the start_time
Here is terraform apply:

      snapshot_schedule_policy.#:                                              "1" => "1"
      snapshot_schedule_policy.0.retention_policy.#:                           "1" => "1"
      snapshot_schedule_policy.0.retention_policy.0.max_retention_days:        "7" => "7"
      snapshot_schedule_policy.0.retention_policy.0.on_source_disk_delete:     "KEEP_AUTO_SNAPSHOTS" => "KEEP_AUTO_SNAPSHOTS"
      snapshot_schedule_policy.0.schedule.#:                                   "1" => "1"
      snapshot_schedule_policy.0.schedule.0.daily_schedule.#:                  "1" => "1"
      snapshot_schedule_policy.0.schedule.0.daily_schedule.0.days_in_cycle:    "1" => "1"
      snapshot_schedule_policy.0.schedule.0.daily_schedule.0.start_time:       "05:00" => "5:00" (forces new resource)
      snapshot_schedule_policy.0.snapshot_properties.#:                        "1" => "1"
      snapshot_schedule_policy.0.snapshot_properties.0.labels.%:               "2" => "2"
      snapshot_schedule_policy.0.snapshot_properties.0.labels.retention:       "7_days" => "7_days"
      snapshot_schedule_policy.0.snapshot_properties.0.labels.snapshot_policy: "default-policy" => "default-policy"

main.tf:

provider "google-beta-resource-policy" {
  version = "~> 0.0.1"
  region  = "us-central1"
  project = "my-project"
}

resource "google_compute_resource_policy" "default" {
  provider = "google-beta-resource-policy"
  name     = "default-policy"
  region   = "us-central1"

  snapshot_schedule_policy {
    schedule {
      daily_schedule {
        start_time    = "5:00"
        days_in_cycle = 1
      }
    }

    retention_policy {
      max_retention_days    = 7
      on_source_disk_delete = "KEEP_AUTO_SNAPSHOTS"
    }

    snapshot_properties {
      labels = {
        snapshot_policy = "default-policy"
        retention       = "7_days"
      }
    }
  }
}

also it want to update region:

  ~ update in-place

Terraform will perform the following actions:

  ~ google_compute_resource_policy.default
      region:                                                                  "https://www.googleapis.com/compute/v1/projects/my-project/regions/us-central1" => "us-central1"

terraform version

Terraform v0.11.14
+ provider.google-beta-resource-policy v0.0.1

Your version of Terraform is out of date! The latest version
is 0.12.0. You can update by downloading from www.terraform.io/downloads.html

@tysen
Copy link
Author

tysen commented May 30, 2019

@123BLiN Thanks for the feedback. For the issue with start_time, the docs state that they must be specified in HH:MM format. That should resolve your issue but I'll see if it makes sense to add some validation for that field.

Thanks for the call out on the region field - I'll fix that.

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician, I work on Magic Modules.
I see that this PR has already had some downstream PRs generated. Any open downstreams are already updated to your most recent commit, 57a0f7a.

Pull request statuses

terraform-provider-google-beta already has an open PR.
No diff detected in terraform-google-conversion.
No diff detected in terraform-provider-google.
No diff detected in Ansible.
No diff detected in Inspec.

New Pull Requests

I didn't open any new pull requests because of this PR.

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician, I work on Magic Modules.
I see that this PR has already had some downstream PRs generated. Any open downstreams are already updated to your most recent commit, 54e9fad.

Pull request statuses

terraform-provider-google-beta already has an open PR.
No diff detected in terraform-google-conversion.
No diff detected in terraform-provider-google.
No diff detected in Ansible.
No diff detected in Inspec.

New Pull Requests

I didn't open any new pull requests because of this PR.

Copy link
Contributor

@emilymye emilymye left a comment

Choose a reason for hiding this comment

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

Also just noticed, the website listing needs to be updated manually (see third_party/terraform/website-compiled/google.erb under Compute Resources).

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician, I work on Magic Modules.
I see that this PR has already had some downstream PRs generated. Any open downstreams are already updated to your most recent commit, 2a1ddeb.

Pull request statuses

terraform-provider-google-beta already has an open PR.
No diff detected in terraform-google-conversion.
No diff detected in Ansible.
No diff detected in Inspec.

New Pull Requests

I built this PR into one or more new PRs on other repositories, and when those are closed, this PR will also be merged and closed.
depends: hashicorp/terraform-provider-google#3768

Copy link
Contributor

@emilymye emilymye left a comment

Choose a reason for hiding this comment

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

Almost done! One last comment, but otherwise LGTM. Thanks for dealing with incremental reviews

products/compute/api.yaml Show resolved Hide resolved
@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician, I work on Magic Modules.
I see that this PR has already had some downstream PRs generated. Any open downstreams are already updated to your most recent commit, 857a434.

Pull request statuses

terraform-provider-google-beta already has an open PR.
No diff detected in terraform-google-conversion.
No diff detected in terraform-provider-google.
No diff detected in Ansible.
No diff detected in Inspec.

New Pull Requests

I didn't open any new pull requests because of this PR.

1 similar comment
@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician, I work on Magic Modules.
I see that this PR has already had some downstream PRs generated. Any open downstreams are already updated to your most recent commit, 857a434.

Pull request statuses

terraform-provider-google-beta already has an open PR.
No diff detected in terraform-google-conversion.
No diff detected in terraform-provider-google.
No diff detected in Ansible.
No diff detected in Inspec.

New Pull Requests

I didn't open any new pull requests because of this PR.

Ty Larrabee and others added 4 commits June 5, 2019 16:48
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.

Add support for scheduled snapshots for persistent disk
5 participants