Skip to content

Commit

Permalink
Merge with main
Browse files Browse the repository at this point in the history
  • Loading branch information
ihnarayanan committed Jan 6, 2025
1 parent 5ee445e commit 66100cd
Show file tree
Hide file tree
Showing 6 changed files with 573 additions and 0 deletions.
140 changes: 140 additions & 0 deletions mmv1/products/developerconnect/Connection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,20 @@ examples:
connection_name: 'tf-test-connection'
- name: 'developer_connect_connection_gitlab_enterprise_doc'
exclude_test: true
- name: 'developer_connect_connection_bbc'
primary_resource_id: 'my-connection'
primary_resource_name: 'fmt.Sprintf("tf-test-connection%s", context["random_suffix"])'
vars:
connection_name: 'tf-test-connection'
- name: 'developer_connect_connection_bbc_doc'
exclude_test: true
- name: 'developer_connect_connection_bbdc'
primary_resource_id: 'my-connection'
primary_resource_name: 'fmt.Sprintf("tf-test-connection%s", context["random_suffix"])'
vars:
connection_name: 'tf-test-connection'
- name: 'developer_connect_connection_bbdc_doc'
exclude_test: true
autogen_async: true
async:
operation:
Expand Down Expand Up @@ -299,6 +313,132 @@ properties:
type: String
description: Output only. The username associated with this token.
output: true
- name: bitbucketCloudConfig
type: NestedObject
description: Configuration for connections to an instance of Bitbucket Cloud.
properties:
- name: workspace
type: String
description: Required. The Bitbucket Cloud Workspace ID to be connected to Google Cloud Platform.
required: true
- name: webhookSecretSecretVersion
type: String
description: |-
Required. Immutable. SecretManager resource containing the webhook secret used to verify webhook
events, formatted as `projects/*/secrets/*/versions/*`. This is used to
validate and create webhooks.
immutable: true
required: true
- name: readAuthorizerCredential
type: NestedObject
description: |-
Represents a personal access token that authorized the Connection,
and associated metadata.
required: true
properties:
- name: userTokenSecretVersion
type: String
description: |-
Required. A SecretManager resource containing the user token that authorizes
the Developer Connect connection. Format:
`projects/*/secrets/*/versions/*`.
required: true
- name: username
type: String
description: Output only. The username associated with this token.
output: true
- name: authorizerCredential
type: NestedObject
description: |-
Represents a personal access token that authorized the Connection,
and associated metadata.
required: true
properties:
- name: userTokenSecretVersion
type: String
description: |-
Required. A SecretManager resource containing the user token that authorizes
the Developer Connect connection. Format:
`projects/*/secrets/*/versions/*`.
required: true
- name: username
type: String
description: Output only. The username associated with this token.
output: true
- name: bitbucketDataCenterConfig
type: NestedObject
description: Configuration for connections to an instance of Bitbucket Data Center.
properties:
- name: webhookSecretSecretVersion
type: String
description: |-
Required. Immutable. SecretManager resource containing the webhook secret used to verify webhook
events, formatted as `projects/*/secrets/*/versions/*`. This is used to
validate webhooks.
immutable: true
required: true
- name: readAuthorizerCredential
type: NestedObject
description: |-
Represents a personal access token that authorized the Connection,
and associated metadata.
required: true
properties:
- name: userTokenSecretVersion
type: String
description: |-
Required. A SecretManager resource containing the user token that authorizes
the Developer Connect connection. Format:
`projects/*/secrets/*/versions/*`.
required: true
- name: username
type: String
description: Output only. The username associated with this token.
output: true
- name: authorizerCredential
type: NestedObject
description: |-
Represents a personal access token that authorized the Connection,
and associated metadata.
required: true
properties:
- name: username
type: String
description: Output only. The username associated with this token.
output: true
- name: userTokenSecretVersion
type: String
description: |-
Required. A SecretManager resource containing the user token that authorizes
the Developer Connect connection. Format:
`projects/*/secrets/*/versions/*`.
required: true
- name: serviceDirectoryConfig
type: NestedObject
description: |-
ServiceDirectoryConfig represents Service Directory configuration for a
connection.
properties:
- name: service
type: String
description: |-
Required. The Service Directory service name.
Format:
projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}.
required: true
- name: sslCaCertificate
type: String
description: |-
Optional. SSL certificate authority to trust when making requests to Bitbucket Data
Center.
- name: serverVersion
type: String
description: Output only. Version of the Bitbucket Data Center server running on the `host_uri`.
output: true
- name: hostUri
type: String
description: Required. The URI of the Bitbucket Data Center host this connection is for.
required: true
- name: updateTime
type: String
description: Output only. [Output only] Update timestamp
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
resource "google_developer_connect_connection" "{{$.PrimaryResourceId}}" {
location = "us-central1"
connection_id = "{{index $.Vars "connection_name"}}"

bitbucket_cloud_config {
workspace = "proctor-test-dc"
webhook_secret_secret_version = "projects/devconnect-terraform-creds/secrets/bbc-webhook/versions/latest"

read_authorizer_credential {
user_token_secret_version = "projects/devconnect-terraform-creds/secrets/bbc-read-token/versions/latest"
}

authorizer_credential {
user_token_secret_version = "projects/devconnect-terraform-creds/secrets/bbc-auth-token/versions/latest"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
resource "google_secret_manager_secret" "bbc-read-cred-secret" {
secret_id = "bbc-read-cred"
replication {
auto {}
}
}

resource "google_secret_manager_secret_version" "bbc-read-cred-secret-version" {
secret = google_secret_manager_secret.bbc-read-cred-secret.id
secret_data = file("my-bbc-read-cred.txt")
}

resource "google_secret_manager_secret" "bbc-auth-cred-secret" {
secret_id = "bbc-auth-cred"
replication {
auto {}
}
}

resource "google_secret_manager_secret_version" "bbc-auth-cred-secret-version" {
secret = google_secret_manager_secret.bbc-auth-cred-secret.id
secret_data = file("my-bbc-auth-cred.txt")
}

resource "google_secret_manager_secret" "bbc-webhook-secret-secret" {
secret_id = "bbc-webhook-secret"
replication {
auto {}
}
}

resource "google_secret_manager_secret_version" "bbc-webhook-secret-secret-version" {
secret = google_secret_manager_secret.bbc-webhook-secret-secret.id
secret_data = file("my-bbc-webhook-secret.txt")

data "google_iam_policy" "p4sa-secretAccessor" {
binding {
role = "roles/secretmanager.secretAccessor"
// Here, 123456789 is the Google Cloud project number for the project that contains the connection.
members = ["serviceAccount:[email protected]"]
}
}

resource "google_secret_manager_secret_iam_policy" "policy-rc" {
secret_id = google_secret_manager_secret.bbc-read-cred-secret.secret_id
policy_data = data.google_iam_policy.p4sa-secretAccessor.policy_data
}

resource "google_secret_manager_secret_iam_policy" "policy-ac" {
secret_id = google_secret_manager_secret.bbc-auth-cred-secret.secret_id
policy_data = data.google_iam_policy.p4sa-secretAccessor.policy_data
}

resource "google_secret_manager_secret_iam_policy" "policy-wh" {
secret_id = google_secret_manager_secret.bbc-webhook-secret-secret.secret_id
policy_data = data.google_iam_policy.p4sa-secretAccessor.policy_data
}

resource "google_developer_connect_connection" "my-connection" {

location = "us-central1"
connection_id = "my-connection"

bitbucket_cloud_config {
workspace = "test-workspace"

webhook_secret_secret_version = google_secret_manager_secret_version.bbc-webhook-secret-secret-version.id

read_authorizer_credential {
user_token_secret_version = google_secret_manager_secret_version.bbc-read-cred-secret-version.id
}

authorizer_credential {
user_token_secret_version = google_secret_manager_secret_version.bbc-auth-cred-secret-version.id
}
}

depends_on = [
google_secret_manager_secret_iam_policy.policy-rc,
google_secret_manager_secret_iam_policy.policy-ac,
google_secret_manager_secret_iam_policy.policy-wh
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
resource "google_developer_connect_connection" "{{$.PrimaryResourceId}}" {
location = "us-central1"
connection_id = "{{index $.Vars "connection_name"}}"

bitbucket_data_center_config {
host_uri = "https://bitbucket-us-central.gcb-test.com"

webhook_secret_secret_version = "projects/devconnect-terraform-creds/secrets/bbdc-webhook/versions/latest"

read_authorizer_credential {
user_token_secret_version = "projects/devconnect-terraform-creds/secrets/bbdc-read-token/versions/latest"
}

authorizer_credential {
user_token_secret_version = "projects/devconnect-terraform-creds/secrets/bbdc-auth-token/versions/latest"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
resource "google_secret_manager_secret" "bbdc-read-cred-secret" {
secret_id = "bbdc-read-cred"
replication {
auto {}
}
}

resource "google_secret_manager_secret_version" "bbdc-read-cred-secret-version" {
secret = google_secret_manager_secret.bbdc-read-cred-secret.id
secret_data = file("my-bbdc-read-cred.txt")
}

resource "google_secret_manager_secret" "bbdc-auth-cred-secret" {
secret_id = "bbdc-auth-cred"
replication {
auto {}
}
}

resource "google_secret_manager_secret_version" "bbdc-auth-cred-secret-version" {
secret = google_secret_manager_secret.bbdc-auth-cred-secret.id
secret_data = file("my-bbdc-auth-cred.txt")
}

resource "google_secret_manager_secret" "bbdc-webhook-secret-secret" {
secret_id = "bbdc-webhook-secret"
replication {
auto {}
}
}

resource "google_secret_manager_secret_version" "bbdc-webhook-secret-secret-version" {
secret = google_secret_manager_secret.bbdc-webhook-secret-secret.id
secret_data = file("my-bbdc-webhook-secret.txt")

data "google_iam_policy" "p4sa-secretAccessor" {
binding {
role = "roles/secretmanager.secretAccessor"
// Here, 123456789 is the Google Cloud project number for the project that contains the connection.
members = ["serviceAccount:[email protected]"]
}
}

resource "google_secret_manager_secret_iam_policy" "policy-rc" {
secret_id = google_secret_manager_secret.bbdc-read-cred-secret.secret_id
policy_data = data.google_iam_policy.p4sa-secretAccessor.policy_data
}

resource "google_secret_manager_secret_iam_policy" "policy-ac" {
secret_id = google_secret_manager_secret.bbdc-auth-cred-secret.secret_id
policy_data = data.google_iam_policy.p4sa-secretAccessor.policy_data
}

resource "google_secret_manager_secret_iam_policy" "policy-wh" {
secret_id = google_secret_manager_secret.bbdc-webhook-secret-secret.secret_id
policy_data = data.google_iam_policy.p4sa-secretAccessor.policy_data
}

resource "google_developer_connect_connection" "my-connection" {

location = "us-central1"
connection_id = "my-connection"

bitbucket_data_center_config {
host_uri = "https://bitbucket-test-server.com"

webhook_secret_secret_version = google_secret_manager_secret_version.bbdc-webhook-secret-secret-version.id

read_authorizer_credential {
user_token_secret_version = google_secret_manager_secret_version.bbdc-read-cred-secret-version.id
}

authorizer_credential {
user_token_secret_version = google_secret_manager_secret_version.bbdc-auth-cred-secret-version.id
}
}

depends_on = [
google_secret_manager_secret_iam_policy.policy-rc,
google_secret_manager_secret_iam_policy.policy-ac,
google_secret_manager_secret_iam_policy.policy-wh
]
}
Loading

0 comments on commit 66100cd

Please sign in to comment.