forked from GoogleCloudPlatform/magic-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new resource WorkforcePoolProvider (GoogleCloudPlatform#6810)
* test * Empty entity bug fixed * First attempt * First attempt * completed adding workforce pool provider * fix bugs
- Loading branch information
Showing
11 changed files
with
685 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2.6.0 |
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
18 changes: 18 additions & 0 deletions
18
mmv1/templates/terraform/constants/iam_workforce_pool_provider.go.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,18 @@ | ||
const workforcePoolProviderIdRegexp = `^[a-z0-9-]{4,32}$` | ||
|
||
func validateWorkforcePoolProviderId(v interface{}, k string) (ws []string, errors []error) { | ||
value := v.(string) | ||
|
||
if strings.HasPrefix(value, "gcp-") { | ||
errors = append(errors, fmt.Errorf( | ||
"%q \"%q\" can not start with \"gcp-\". " + | ||
"The prefix `gcp-` is reserved for use by Google, and may not be specified.", k, value)) | ||
} | ||
|
||
if !regexp.MustCompile(workforcePoolProviderIdRegexp).MatchString(value) { | ||
errors = append(errors, fmt.Errorf( | ||
"Workforce Pool Provider Id \"%q\" must be 4-32 characters, and may contain the characters [a-z0-9-].", value)) | ||
} | ||
|
||
return | ||
} |
2 changes: 1 addition & 1 deletion
2
mmv1/templates/terraform/custom_check_destroy/iam_workforce_pool.go.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
22 changes: 22 additions & 0 deletions
22
mmv1/templates/terraform/examples/iam_workforce_pool_provider_oidc_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,22 @@ | ||
resource "google_iam_workforce_pool" "pool" { | ||
provider = google-beta | ||
|
||
workforce_pool_id = "<%= ctx[:vars]["workforce_pool_id"] %>" | ||
parent = "organizations/<%= ctx[:test_env_vars]["org_id"] %>" | ||
location = "global" | ||
} | ||
|
||
resource "google_iam_workforce_pool_provider" "<%= ctx[:primary_resource_id] %>" { | ||
provider = google-beta | ||
|
||
workforce_pool_id = google_iam_workforce_pool.pool.workforce_pool_id | ||
location = google_iam_workforce_pool.pool.location | ||
provider_id = "<%= ctx[:vars]["provider_id"] %>" | ||
attribute_mapping = { | ||
"google.subject" = "assertion.sub" | ||
} | ||
oidc { | ||
issuer_uri = "https://accounts.google.com" | ||
client_id = "client-id" | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
mmv1/templates/terraform/examples/iam_workforce_pool_provider_oidc_full.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,26 @@ | ||
resource "google_iam_workforce_pool" "pool" { | ||
provider = google-beta | ||
|
||
workforce_pool_id = "<%= ctx[:vars]["workforce_pool_id"] %>" | ||
parent = "organizations/<%= ctx[:test_env_vars]["org_id"] %>" | ||
location = "global" | ||
} | ||
|
||
resource "google_iam_workforce_pool_provider" "<%= ctx[:primary_resource_id] %>" { | ||
provider = google-beta | ||
|
||
workforce_pool_id = google_iam_workforce_pool.pool.workforce_pool_id | ||
location = google_iam_workforce_pool.pool.location | ||
provider_id = "<%= ctx[:vars]["provider_id"] %>" | ||
attribute_mapping = { | ||
"google.subject" = "assertion.sub" | ||
} | ||
oidc { | ||
issuer_uri = "https://accounts.google.com" | ||
client_id = "client-id" | ||
} | ||
display_name = "Display name" | ||
description = "A sample OIDC workforce pool provider." | ||
disabled = false | ||
attribute_condition = "true" | ||
} |
21 changes: 21 additions & 0 deletions
21
mmv1/templates/terraform/examples/iam_workforce_pool_provider_saml_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,21 @@ | ||
resource "google_iam_workforce_pool" "pool" { | ||
provider = google-beta | ||
|
||
workforce_pool_id = "<%= ctx[:vars]["workforce_pool_id"] %>" | ||
parent = "organizations/<%= ctx[:test_env_vars]["org_id"] %>" | ||
location = "global" | ||
} | ||
|
||
resource "google_iam_workforce_pool_provider" "<%= ctx[:primary_resource_id] %>" { | ||
provider = google-beta | ||
|
||
workforce_pool_id = google_iam_workforce_pool.pool.workforce_pool_id | ||
location = google_iam_workforce_pool.pool.location | ||
provider_id = "<%= ctx[:vars]["provider_id"] %>" | ||
attribute_mapping = { | ||
"google.subject" = "assertion.sub" | ||
} | ||
saml { | ||
idp_metadata_xml = "<?xml version=\"1.0\"?><md:EntityDescriptor xmlns:md=\"urn:oasis:names:tc:SAML:2.0:metadata\" entityID=\"https://test.com\"><md:IDPSSODescriptor protocolSupportEnumeration=\"urn:oasis:names:tc:SAML:2.0:protocol\"> <md:KeyDescriptor use=\"signing\"><ds:KeyInfo xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\"><ds:X509Data><ds:X509Certificate>MIIDpDCCAoygAwIBAgIGAX7/5qPhMA0GCSqGSIb3DQEBCwUAMIGSMQswCQYDVQQGE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P6vEiFImKFHpDSv3M/5de1ytQzPFrZBYt9WlzlYwE1aD9FHCxdd+rWgYMVVoRaRmndpV/Rq3QUuDuFJtaoX11bC7ExkOpg9KstZzA63i3VcfYv</ds:X509Certificate></ds:X509Data></ds:KeyInfo></md:KeyDescriptor><md:SingleSignOnService Binding=\"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect\" Location=\"https://test.com/sso\"/></md:IDPSSODescriptor></md:EntityDescriptor>" | ||
} | ||
} |
Oops, something went wrong.