-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding shareSetting to create SherdReservations. * Add ShareSetting to create sharedReservation. * fixing the update test * fixing sharedReservation test * adding shareType local to instance test. * fixing shareType issue. * fixing shareType issue. * fix ShareType issue. * fix shareType issue. * unde recent changes. * provide digit validation for project_number. * set ignore_read=true for shareSettings to enable project_id.
- Loading branch information
Showing
5 changed files
with
104 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
mmv1/templates/terraform/examples/shared_reservation_basic.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
resource "google_project" "owner_project" { | ||
project_id = "tf-test%{random_suffix}" | ||
name = "tf-test%{random_suffix}" | ||
org_id = "<%= ctx[:test_env_vars]['org_id'] %>" | ||
billing_account = "<%= ctx[:test_env_vars]['billing_account'] %>" | ||
} | ||
|
||
|
||
resource "google_project_service" "compute" { | ||
project = google_project.owner_project.project_id | ||
service = "compute.googleapis.com" | ||
disable_on_destroy = false | ||
} | ||
|
||
resource "google_project" "guest_project" { | ||
project_id = "tf-test-2%{random_suffix}" | ||
name = "tf-test-2%{random_suffix}" | ||
org_id = "<%= ctx[:test_env_vars]['org_id'] %>" | ||
} | ||
|
||
resource "google_organization_policy" "shared_reservation_org_policy" { | ||
org_id = "<%= ctx[:test_env_vars]['org_id'] %>" | ||
constraint = "constraints/compute.sharedReservationsOwnerProjects" | ||
list_policy { | ||
allow { | ||
values = ["projects/${google_project.owner_project.number}"] | ||
} | ||
} | ||
} | ||
|
||
resource "google_compute_reservation" "<%= ctx[:primary_resource_id] %>" { | ||
project = google_project.owner_project.project_id | ||
name = "<%= ctx[:vars]['reservation_name'] %>" | ||
zone = "us-central1-a" | ||
|
||
specific_reservation { | ||
count = 1 | ||
instance_properties { | ||
min_cpu_platform = "Intel Cascade Lake" | ||
machine_type = "n2-standard-2" | ||
} | ||
} | ||
share_settings { | ||
share_type = "SPECIFIC_PROJECTS" | ||
project_map { | ||
id = google_project.guest_project.project_id | ||
project_id = google_project.guest_project.project_id | ||
} | ||
} | ||
depends_on = [google_organization_policy.shared_reservation_org_policy,google_project_service.compute] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters