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 connection resource of Integration Connectors. (GoogleCloudPlatfo…
- Loading branch information
1 parent
32aaea0
commit ba01628
Showing
14 changed files
with
2,196 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright 2020 Google Inc. | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
--- !ruby/object:Api::Product | ||
name: IntegrationConnectors | ||
display_name: Integration Connectors | ||
versions: | ||
- !ruby/object:Api::Product::Version | ||
name: ga | ||
base_url: https://connectors.googleapis.com/v1/ | ||
# IntegrationConnectors has no beta API, but running the full Terraform | ||
# acceptance tests depends on a beta-only resource and a bug in MM | ||
# will generate beta tests against the GA provider in this case, so | ||
# we fake a beta API with the same endpoint as the GA API. | ||
- !ruby/object:Api::Product::Version | ||
name: beta | ||
base_url: https://connectors.googleapis.com/v1/ | ||
scopes: | ||
- https://www.googleapis.com/auth/cloud-platform | ||
apis_required: | ||
- !ruby/object:Api::Product::ApiReference | ||
name: Connectors API | ||
url: https://console.cloud.google.com/apis/api/connectors.googleapis.com/ |
20 changes: 20 additions & 0 deletions
20
mmv1/templates/terraform/constants/integration_connectors_connection.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,20 @@ | ||
<% unless compiler == "terraformgoogleconversion-codegen" -%> | ||
// waitforConnectionReady waits for an connecion to leave the | ||
// "CREATING" state, to indicate that it's ready. | ||
func waitforConnectionReady(d *schema.ResourceData, config *transport_tpg.Config, timeout time.Duration) error { | ||
return resource.Retry(timeout, func() *resource.RetryError { | ||
if err := resourceIntegrationConnectorsConnectionRead(d, config); err != nil { | ||
return resource.NonRetryableError(err) | ||
} | ||
name := d.Get("name").(string) | ||
status := d.Get("status").([]interface{}) | ||
state := status[0].(map[string]interface{})["state"] | ||
log.Printf("[DEBUG] Connection %q has state %v.", name, state) | ||
if state == "CREATING" || state == "UPDATING" { | ||
return resource.RetryableError(fmt.Errorf("Connection %q has state %q.", name, state)) | ||
} | ||
log.Printf("[DEBUG] Connection %q has state %q.", name, state) | ||
return nil | ||
}) | ||
} | ||
<% end -%> |
232 changes: 232 additions & 0 deletions
232
mmv1/templates/terraform/examples/integration_connectors_connection_advanced.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,232 @@ | ||
data "google_project" "test_project" { | ||
} | ||
|
||
resource "google_secret_manager_secret" "secret-basic" { | ||
secret_id = "<%= ctx[:vars]['secret_id'] %>" | ||
replication { | ||
user_managed { | ||
replicas { | ||
location = "us-central1" | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
resource "google_secret_manager_secret_version" "secret-version-basic" { | ||
secret = google_secret_manager_secret.secret-basic.id | ||
secret_data = "dummypassword" | ||
} | ||
|
||
resource "google_secret_manager_secret_iam_member" "secret_iam" { | ||
secret_id = google_secret_manager_secret.secret-basic.id | ||
role = "roles/secretmanager.admin" | ||
member = "serviceAccount:${data.google_project.test_project.number}[email protected]" | ||
depends_on = [google_secret_manager_secret_version.secret-version-basic] | ||
} | ||
|
||
resource "google_integration_connectors_connection" "<%= ctx[:primary_resource_id] %>" { | ||
name = "<%= ctx[:vars]['connection_name'] %>" | ||
description = "tf updated description" | ||
location = "us-central1" | ||
service_account = "${data.google_project.test_project.number}[email protected]" | ||
connector_version = "projects/${data.google_project.test_project.project_id}/locations/global/providers/zendesk/connectors/zendesk/versions/1" | ||
config_variable { | ||
key = "proxy_enabled" | ||
boolean_value = false | ||
} | ||
config_variable { | ||
key = "sample_integer_value" | ||
integer_value = 1 | ||
} | ||
|
||
config_variable { | ||
key = "sample_encryption_key_value" | ||
encryption_key_value { | ||
type = "GOOGLE_MANAGED" | ||
kms_key_name = "sampleKMSKkey" | ||
} | ||
} | ||
|
||
config_variable { | ||
key = "sample_secret_value" | ||
secret_value { | ||
secret_version = google_secret_manager_secret_version.secret-version-basic.name | ||
} | ||
} | ||
|
||
suspended = false | ||
auth_config { | ||
additional_variable { | ||
key = "sample_string" | ||
string_value = "sampleString" | ||
} | ||
additional_variable { | ||
key = "sample_boolean" | ||
boolean_value = false | ||
} | ||
additional_variable { | ||
key = "sample_integer" | ||
integer_value = 1 | ||
} | ||
additional_variable { | ||
key = "sample_secret_value" | ||
secret_value { | ||
secret_version = google_secret_manager_secret_version.secret-version-basic.name | ||
} | ||
} | ||
additional_variable { | ||
key = "sample_encryption_key_value" | ||
encryption_key_value { | ||
type = "GOOGLE_MANAGED" | ||
kms_key_name = "sampleKMSKkey" | ||
} | ||
} | ||
auth_type = "USER_PASSWORD" | ||
auth_key = "sampleAuthKey" | ||
user_password { | ||
username = "[email protected]" | ||
password { | ||
secret_version = google_secret_manager_secret_version.secret-version-basic.name | ||
} | ||
} | ||
} | ||
|
||
destination_config { | ||
key = "url" | ||
destination { | ||
host = "https://test.zendesk.com" | ||
port = 80 | ||
} | ||
} | ||
lock_config { | ||
locked = false | ||
reason = "Its not locked" | ||
} | ||
log_config { | ||
enabled = true | ||
} | ||
node_config { | ||
min_node_count = 2 | ||
max_node_count = 50 | ||
} | ||
labels = { | ||
foo = "bar" | ||
} | ||
ssl_config { | ||
additional_variable { | ||
key = "sample_string" | ||
string_value = "sampleString" | ||
} | ||
additional_variable { | ||
key = "sample_boolean" | ||
boolean_value = false | ||
} | ||
additional_variable { | ||
key = "sample_integer" | ||
integer_value = 1 | ||
} | ||
additional_variable { | ||
key = "sample_secret_value" | ||
secret_value { | ||
secret_version = google_secret_manager_secret_version.secret-version-basic.name | ||
} | ||
} | ||
additional_variable { | ||
key = "sample_encryption_key_value" | ||
encryption_key_value { | ||
type = "GOOGLE_MANAGED" | ||
kms_key_name = "sampleKMSKkey" | ||
} | ||
} | ||
client_cert_type = "PEM" | ||
client_certificate { | ||
secret_version = google_secret_manager_secret_version.secret-version-basic.name | ||
} | ||
client_private_key { | ||
secret_version = google_secret_manager_secret_version.secret-version-basic.name | ||
} | ||
client_private_key_pass { | ||
secret_version = google_secret_manager_secret_version.secret-version-basic.name | ||
} | ||
private_server_certificate { | ||
secret_version = google_secret_manager_secret_version.secret-version-basic.name | ||
} | ||
server_cert_type = "PEM" | ||
trust_model = "PRIVATE" | ||
type = "TLS" | ||
use_ssl = true | ||
} | ||
|
||
eventing_enablement_type = "EVENTING_AND_CONNECTION" | ||
eventing_config { | ||
additional_variable { | ||
key = "sample_string" | ||
string_value = "sampleString" | ||
} | ||
additional_variable { | ||
key = "sample_boolean" | ||
boolean_value = false | ||
} | ||
additional_variable { | ||
key = "sample_integer" | ||
integer_value = 1 | ||
} | ||
additional_variable { | ||
key = "sample_secret_value" | ||
secret_value { | ||
secret_version = google_secret_manager_secret_version.secret-version-basic.name | ||
} | ||
} | ||
additional_variable { | ||
key = "sample_encryption_key_value" | ||
encryption_key_value { | ||
type = "GOOGLE_MANAGED" | ||
kms_key_name = "sampleKMSKkey" | ||
} | ||
} | ||
registration_destination_config { | ||
key = "registration_destination_config" | ||
destination { | ||
host = "https://test.zendesk.com" | ||
port = 80 | ||
} | ||
} | ||
auth_config { | ||
auth_type = "USER_PASSWORD" | ||
auth_key = "sampleAuthKey" | ||
user_password { | ||
username = "[email protected]" | ||
password { | ||
secret_version = google_secret_manager_secret_version.secret-version-basic.name | ||
} | ||
} | ||
additional_variable { | ||
key = "sample_string" | ||
string_value = "sampleString" | ||
} | ||
additional_variable { | ||
key = "sample_boolean" | ||
boolean_value = false | ||
} | ||
additional_variable { | ||
key = "sample_integer" | ||
integer_value = 1 | ||
} | ||
additional_variable { | ||
key = "sample_secret_value" | ||
secret_value { | ||
secret_version = google_secret_manager_secret_version.secret-version-basic.name | ||
} | ||
} | ||
additional_variable { | ||
key = "sample_encryption_key_value" | ||
encryption_key_value { | ||
type = "GOOGLE_MANAGED" | ||
kms_key_name = "sampleKMSKkey" | ||
} | ||
} | ||
} | ||
enrichment_enabled = true | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
mmv1/templates/terraform/examples/integration_connectors_connection_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,17 @@ | ||
data "google_project" "test_project" { | ||
} | ||
|
||
resource "google_integration_connectors_connection" "<%= ctx[:primary_resource_id] %>" { | ||
name = "<%= ctx[:vars]['connection_name'] %>" | ||
location = "us-central1" | ||
connector_version = "projects/${data.google_project.test_project.project_id}/locations/global/providers/gcp/connectors/pubsub/versions/1" | ||
description = "tf created description" | ||
config_variable { | ||
key = "project_id" | ||
string_value = "connectors-example" | ||
} | ||
config_variable { | ||
key = "topic_id" | ||
string_value = "test" | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
mmv1/templates/terraform/examples/integration_connectors_connection_oauth.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,57 @@ | ||
data "google_project" "test_project" { | ||
} | ||
|
||
resource "google_secret_manager_secret" "secret-basic" { | ||
secret_id = "<%= ctx[:vars]['secret_id'] %>" | ||
replication { | ||
user_managed { | ||
replicas { | ||
location = "us-central1" | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
resource "google_secret_manager_secret_version" "secret-version-basic" { | ||
secret = google_secret_manager_secret.secret-basic.id | ||
secret_data = "dummypassword" | ||
} | ||
|
||
resource "google_secret_manager_secret_iam_member" "secret_iam" { | ||
secret_id = google_secret_manager_secret.secret-basic.id | ||
role = "roles/secretmanager.admin" | ||
member = "serviceAccount:${data.google_project.test_project.number}[email protected]" | ||
depends_on = [google_secret_manager_secret_version.secret-version-basic] | ||
} | ||
|
||
resource "google_integration_connectors_connection" "<%= ctx[:primary_resource_id] %>" { | ||
name = "<%= ctx[:vars]['connection_name'] %>" | ||
location = "us-central1" | ||
connector_version = "projects/${data.google_project.test_project.project_id}/locations/global/providers/box/connectors/box/versions/1" | ||
description = "tf created description" | ||
config_variable { | ||
key = "impersonate_user_mode" | ||
string_value = "User" | ||
} | ||
config_variable { | ||
key = "proxy_enabled" | ||
boolean_value = false | ||
} | ||
auth_config{ | ||
auth_type = "OAUTH2_AUTH_CODE_FLOW" | ||
oauth2_auth_code_flow { | ||
auth_uri = "sampleauthuri" | ||
client_id = "sampleclientid" | ||
client_secret { | ||
secret_version = google_secret_manager_secret_version.secret-version-basic.name | ||
} | ||
enable_pkce = true | ||
scopes = [ | ||
"sample_scope_1", | ||
"sample_scope_2" | ||
] | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.