-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Compute serviceattachment dcl #5444
Closed
trodge
wants to merge
8
commits into
GoogleCloudPlatform:main
from
trodge:compute-serviceattachment-dcl
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0986c14
Revert "Revert "Reimplemented compute service attachment using the DC…
trodge 6487202
Reverted changes to diff suppress function.
trodge 1336e6a
Removed now redundant override from compute firewall policy rule.
trodge 22b7fbc
Fixed name of excluded field.
trodge dc16847
Fixed issue causing how-to guides to not appear in docs.
trodge 8c700cc
Moved mmv1 handwritten test into tpgtools.
trodge 5e9d1f0
Renamed variables to match previous values.
trodge 4db6dbc
Added diff suppress function to region field via override.
trodge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
214 changes: 0 additions & 214 deletions
214
mmv1/third_party/terraform/tests/resource_compute_service_attachment_test.go
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,4 +0,0 @@ | ||
- type: DIFF_SUPPRESS_FUNC | ||
field: target_resources | ||
details: | ||
diffsuppressfunc: compareSelfLinkOrResourceName | ||
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,12 @@ | ||
- type: EXCLUDE | ||
field: region | ||
- type: EXCLUDE | ||
field: service_attachment_id | ||
- type: CUSTOM_NAME | ||
details: | ||
name: region | ||
field: location | ||
- type: DIFF_SUPPRESS_FUNC | ||
field: location | ||
details: | ||
diffsuppressfunc: compareSelfLinkOrResourceName |
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 |
---|---|---|
@@ -1,4 +0,0 @@ | ||
- type: DIFF_SUPPRESS_FUNC | ||
field: target_resources | ||
details: | ||
diffsuppressfunc: compareSelfLinkOrResourceName | ||
78 changes: 78 additions & 0 deletions
78
tpgtools/overrides/compute/samples/serviceattachment/basic.tf.tmpl
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,78 @@ | ||
resource "google_compute_service_attachment" "primary" { | ||
name = "{{my-psc-ilb}}" | ||
region = "{{region}}" | ||
description = "A service attachment configured with Terraform" | ||
|
||
enable_proxy_protocol = true | ||
connection_preference = "ACCEPT_AUTOMATIC" | ||
nat_subnets = [google_compute_subnetwork.psc_ilb_nat.id] | ||
target_service = google_compute_forwarding_rule.psc_ilb_target_service.id | ||
} | ||
|
||
resource "google_compute_address" "psc_ilb_consumer_address" { | ||
name = "{{psc-ilb-consumer-address}}" | ||
region = "{{region}}" | ||
|
||
subnetwork = "default" | ||
address_type = "INTERNAL" | ||
} | ||
|
||
resource "google_compute_forwarding_rule" "psc_ilb_consumer" { | ||
name = "{{psc-ilb-consumer-forwarding-rule}}" | ||
region = "{{region}}" | ||
|
||
target = google_compute_service_attachment.primary.id | ||
load_balancing_scheme = "" # need to override EXTERNAL default when target is a service attachment | ||
network = "default" | ||
ip_address = google_compute_address.psc_ilb_consumer_address.id | ||
} | ||
|
||
resource "google_compute_forwarding_rule" "psc_ilb_target_service" { | ||
name = "{{producer-forwarding-rule}}" | ||
region = "{{region}}" | ||
|
||
load_balancing_scheme = "INTERNAL" | ||
backend_service = google_compute_region_backend_service.producer_service_backend.id | ||
all_ports = true | ||
network = google_compute_network.psc_ilb_network.name | ||
subnetwork = google_compute_subnetwork.psc_ilb_producer_subnetwork.name | ||
} | ||
|
||
resource "google_compute_region_backend_service" "producer_service_backend" { | ||
name = "{{producer-service}}" | ||
region = "{{region}}" | ||
|
||
health_checks = [google_compute_health_check.producer_service_health_check.id] | ||
} | ||
|
||
resource "google_compute_health_check" "producer_service_health_check" { | ||
name = "{{producer-service-health-check}}" | ||
|
||
check_interval_sec = 1 | ||
timeout_sec = 1 | ||
tcp_health_check { | ||
port = "80" | ||
} | ||
} | ||
|
||
resource "google_compute_network" "psc_ilb_network" { | ||
name = "{{psc-ilb-network}}" | ||
auto_create_subnetworks = false | ||
} | ||
|
||
resource "google_compute_subnetwork" "psc_ilb_producer_subnetwork" { | ||
name = "{{psc-ilb-producer-subnetwork}}" | ||
region = "{{region}}" | ||
|
||
network = google_compute_network.psc_ilb_network.id | ||
ip_cidr_range = "10.0.0.0/16" | ||
} | ||
|
||
resource "google_compute_subnetwork" "psc_ilb_nat" { | ||
name = "{{psc-ilb-nat}}" | ||
region = "{{region}}" | ||
|
||
network = google_compute_network.psc_ilb_network.id | ||
purpose = "PRIVATE_SERVICE_CONNECT" | ||
ip_cidr_range = "10.1.0.0/16" | ||
} |
24 changes: 24 additions & 0 deletions
24
tpgtools/overrides/compute/samples/serviceattachment/basic.yaml
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,24 @@ | ||
# optional test level config -- needed for updates consumer_lists.tf.tmpl def | ||
updates: | ||
- resource: ./basic_update.tf.tmpl | ||
variables: | ||
- name: "region" | ||
type: "region" | ||
- name: "my-psc-ilb" | ||
type: "resource_name" | ||
- name: "psc-ilb-consumer-address" | ||
type: "resource_name" | ||
- name: "psc-ilb-consumer-forwarding-rule" | ||
type: "resource_name" | ||
- name: "producer-forwarding-rule" | ||
type: "resource_name" | ||
- name: "producer-service" | ||
type: "resource_name" | ||
- name: "producer-service-health-check" | ||
type: "resource_name" | ||
- name: "psc-ilb-network" | ||
type: "resource_name" | ||
- name: "psc-ilb-producer-subnetwork" | ||
type: "resource_name" | ||
- name: "psc-ilb-nat" | ||
type: "resource_name" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, weird- the base DCL resource includes a (presumably output-only)
region
field but also alocation
field which maps to theregion
field in the API?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is the way KCC requested we name the fields.
location
corresponds to the URL parameter.