Skip to content

Commit

Permalink
Revert "Placement policy support for Compute Instance (hashicorp#3217)…
Browse files Browse the repository at this point in the history
…" (hashicorp#3250)

This reverts commit d7d347f.
  • Loading branch information
slevenick authored Mar 13, 2020
1 parent 65fc126 commit 18d6446
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 203 deletions.
31 changes: 0 additions & 31 deletions products/compute/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10481,8 +10481,6 @@ objects:
which cannot be a dash.
- !ruby/object:Api::Type::NestedObject
name: 'snapshotSchedulePolicy'
conflicts:
- 'groupPlacementPolicy'
description: |
Policy for creating snapshots of persistent disks.
properties:
Expand Down Expand Up @@ -10624,35 +10622,6 @@ objects:
- snapshot_schedule_policy.0.snapshot_properties.0.guest_flush
description: |
Whether to perform a 'guest aware' snapshot.
- !ruby/object:Api::Type::NestedObject
name: 'groupPlacementPolicy'
conflicts:
- 'snapshotSchedulePolicy'
description: |
Policy for creating snapshots of persistent disks.
properties:
- !ruby/object:Api::Type::Integer
name: 'vmCount'
at_least_one_of:
- group_placement_policy.0.vm_count
- group_placement_policy.0.availability_domain_count
description: |
Number of vms in this placement group
- !ruby/object:Api::Type::Integer
name: 'availabilityDomainCount'
at_least_one_of:
- group_placement_policy.0.vm_count
- group_placement_policy.0.availability_domain_count
description: |
The number of availability domains instances will be spread across. If two instances are in different
availability domain, they will not be put in the same low latency network
- !ruby/object:Api::Type::Enum
name: 'collocation'
description: |
Collocation specifies whether to place VMs inside the same availability domain on the same low-latency network.
Specify `COLLOCATED` to enable collocation. Can only be specified with `vm_count`.
values:
- :COLLOCATED
- !ruby/object:Api::Resource
name: 'Route'
kind: 'compute#route'
Expand Down
5 changes: 0 additions & 5 deletions products/compute/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1452,11 +1452,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides
primary_resource_id: "bar"
vars:
name: "policy"
- !ruby/object:Provider::Terraform::Examples
name: "resource_policy_placement_policy"
primary_resource_id: "baz"
vars:
name: "policy"
properties:
region: !ruby/object:Overrides::Terraform::PropertyOverride
required: false
Expand Down

This file was deleted.

13 changes: 0 additions & 13 deletions third_party/terraform/resources/resource_compute_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,15 +593,6 @@ func resourceComputeInstance() *schema.Resource {
Optional: true,
ForceNew: true,
},

"resource_policies": {
Type: schema.TypeList,
Elem: &schema.Schema{Type: schema.TypeString},
DiffSuppressFunc: compareSelfLinkRelativePaths,
Optional: true,
ForceNew: true,
MaxItems: 1,
},
},
CustomizeDiff: customdiff.All(
customdiff.If(
Expand Down Expand Up @@ -729,7 +720,6 @@ func expandComputeInstance(project string, d *schema.ResourceData, config *Confi
ForceSendFields: []string{"CanIpForward", "DeletionProtection"},
ShieldedVmConfig: expandShieldedVmConfigs(d),
DisplayDevice: expandDisplayDevice(d),
ResourcePolicies: convertStringArr(d.Get("resource_policies").([]interface{})),
}, nil
}

Expand Down Expand Up @@ -993,9 +983,6 @@ func resourceComputeInstanceRead(d *schema.ResourceData, meta interface{}) error
}
}
}

d.Set("resource_policies", instance.ResourcePolicies)

// Remove nils from map in case there were disks in the config that were not present on read;
// i.e. a disk was detached out of band
ads := []map[string]interface{}{}
Expand Down
64 changes: 0 additions & 64 deletions third_party/terraform/tests/resource_compute_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1784,24 +1784,6 @@ func TestAccComputeInstance_updateTerminated_desiredStatusRunning_notAllowStoppi
})
}

func TestAccComputeInstance_resourcePolicyCollocate(t *testing.T) {
t.Parallel()

instanceName := fmt.Sprintf("terraform-test-%s", acctest.RandString(10))

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeInstanceDestroy,
Steps: []resource.TestStep{
{
Config: testAccComputeInstance_resourcePolicyCollocate(instanceName),
},
computeInstanceImportStep("us-central1-a", instanceName, []string{"allow_stopping_for_update"}),
},
})
}

func testAccCheckComputeInstanceUpdateMachineType(n string) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[n]
Expand Down Expand Up @@ -4536,49 +4518,3 @@ resource "google_compute_instance" "foobar" {
}
`, instance)
}

func testAccComputeInstance_resourcePolicyCollocate(instance string) string {
return fmt.Sprintf(`
data "google_compute_image" "my_image" {
family = "debian-9"
project = "debian-cloud"
}
resource "google_compute_instance" "foobar" {
name = "%s"
machine_type = "c2-standard-4"
zone = "us-central1-f"
can_ip_forward = false
tags = ["foo", "bar"]
//deletion_protection = false is implicit in this config due to default value
boot_disk {
initialize_params {
image = data.google_compute_image.my_image.self_link
}
}
network_interface {
network = "default"
}
scheduling {
# Instances with resource policies do not support live migration.
on_host_maintenance = "TERMINATE"
}
resource_policies = [google_compute_resource_policy.foo.self_link]
}
resource "google_compute_resource_policy" "foo" {
name = "tf-test-policy-%s"
region = "us-central1"
group_placement_policy {
vm_count = 2
collocation = "COLLOCATED"
}
}
`, instance, acctest.RandString(10))
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ The following arguments are supported:
* `enable_display` - (Optional) Enable [Virtual Displays](https://cloud.google.com/compute/docs/instances/enable-instance-virtual-display#verify_display_driver) on this instance.
**Note**: [`allow_stopping_for_update`](#allow_stopping_for_update) must be set to true or your instance must have a `desired_status` of `TERMINATED` in order to update this field.

* `resource_policies` (Optional) -- A list of short names or self_links of resource policies to attach to the instance. Modifying this list will cause the instance to recreate. Currently a max of 1 resource policy is supported.


---

Expand Down

0 comments on commit 18d6446

Please sign in to comment.