diff --git a/mmv1/products/developerconnect/Connection.yaml b/mmv1/products/developerconnect/Connection.yaml index 7fd9d60c8f18..1b7ab4ddbea8 100644 --- a/mmv1/products/developerconnect/Connection.yaml +++ b/mmv1/products/developerconnect/Connection.yaml @@ -12,205 +12,521 @@ # limitations under the License. --- -name: 'Connection' -description: | - A connection to a GitHub App installation. -min_version: 'beta' -docs: -id_format: 'projects/{{project}}/locations/{{location}}/connections/{{connection_id}}' -base_url: 'projects/{{project}}/locations/{{location}}/connections' -self_link: 'projects/{{project}}/locations/{{location}}/connections/{{connection_id}}' -create_url: 'projects/{{project}}/locations/{{location}}/connections?connectionId={{connection_id}}' -update_verb: 'PATCH' +name: Connection +description: A connection for GitHub, GitHub Enterprise, GitLab, and GitLab Enterprise. +base_url: projects/{{project}}/locations/{{location}}/connections update_mask: true +self_link: projects/{{project}}/locations/{{location}}/connections/{{connection_id}} +create_url: projects/{{project}}/locations/{{location}}/connections?connectionId={{connection_id}} +update_verb: PATCH +id_format: projects/{{project}}/locations/{{location}}/connections/{{connection_id}} import_format: - - 'projects/{{project}}/locations/{{location}}/connections/{{connection_id}}' -timeouts: - insert_minutes: 20 - update_minutes: 20 - delete_minutes: 20 -autogen_async: true -async: - actions: ['create', 'delete', 'update'] - type: 'OpAsync' - operation: - base_url: '{{op_id}}' - result: - resource_inside_response: true -custom_code: + - projects/{{project}}/locations/{{location}}/connections/{{connection_id}} examples: - - name: 'developer_connect_connection_basic' + - name: 'developer_connect_connection_github' primary_resource_id: 'my-connection' primary_resource_name: 'fmt.Sprintf("tf-test-connection%s", context["random_suffix"])' - min_version: 'beta' vars: connection_name: 'tf-test-connection' - name: 'developer_connect_connection_github_doc' - min_version: 'beta' exclude_test: true + - name: 'developer_connect_connection_github_enterprise' + 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_github_enterprise_doc' + exclude_test: true + - name: 'developer_connect_connection_gitlab' + 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_gitlab_doc' + exclude_test: true + - name: 'developer_connect_connection_gitlab_enterprise' + 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_gitlab_enterprise_doc' + exclude_test: true + - name: 'developer_connect_connection_bitbucket_cloud' + 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_bitbucket_cloud_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: + timeouts: + insert_minutes: 20 + update_minutes: 20 + delete_minutes: 20 + base_url: '{{op_id}}' + actions: + - create + - delete + - update + type: OpAsync + result: + resource_inside_response: true + error: {} + include_project: false +autogen_status: Q29ubmVjdGlvbg== parameters: - - name: 'location' + - name: location type: String - description: | - Resource ID segment making up resource `name`. It identifies the resource - within its parent collection as described in https://google.aip.dev/122. See documentation - for resource type `developerconnect.googleapis.com/GitRepositoryLink`. - min_version: 'beta' + description: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. + immutable: true url_param_only: true required: true - immutable: true - - name: 'connectionId' + - name: connectionId type: String - description: | - Required. Id of the requesting object. If auto-generating Id server-side, - remove this field and connection_id from the method_signature of Create RPC. - min_version: 'beta' + description: |- + Required. Id of the requesting object + If auto-generating Id server-side, remove this field and + connection_id from the method_signature of Create RPC + immutable: true url_param_only: true required: true - immutable: true properties: - - name: 'githubConfig' + - name: githubConfig type: NestedObject - description: | - Configuration for connections to github.com. - min_version: 'beta' + description: Configuration for connections to github.com. properties: - - name: 'githubApp' + - name: installationUri type: String - description: | - Required. Immutable. The GitHub Application that was installed to - the GitHub user or organization. + description: |- + Output only. The URI to navigate to in order to manage the installation associated + with this GitHubConfig. + output: true + - name: githubApp + type: String + description: |- + Required. Immutable. The GitHub Application that was installed to the GitHub user or + organization. Possible values: - GIT_HUB_APP_UNSPECIFIED - DEVELOPER_CONNECT - FIREBASE" - min_version: 'beta' - required: true + GIT_HUB_APP_UNSPECIFIED + DEVELOPER_CONNECT + FIREBASE immutable: true - - name: 'authorizerCredential' + required: true + - name: authorizerCredential type: NestedObject - description: | - Represents an OAuth token of the account that authorized the Connection,and - associated metadata. - min_version: 'beta' + description: |- + Represents an OAuth token of the account that authorized the Connection, + and associated metadata. properties: - - name: 'oauthTokenSecretVersion' + - name: oauthTokenSecretVersion type: String - description: | - Required. A SecretManager resource containing the OAuth token - that authorizes the connection. - Format: `projects/*/secrets/*/versions/*`. - min_version: 'beta' + description: |- + Required. A SecretManager resource containing the OAuth token that authorizes + the connection. Format: `projects/*/secrets/*/versions/*`. required: true - - name: 'username' + - name: username type: String - description: | - Output only. The username associated with this token. - min_version: 'beta' + description: Output only. The username associated with this token. output: true - - name: 'appInstallationId' + - name: appInstallationId + type: String + description: Optional. GitHub App installation id. + - name: githubEnterpriseConfig + type: NestedObject + description: Configuration for connections to an instance of GitHub Enterprise. + properties: + - name: appSlug + type: String + description: Output only. The URL-friendly name of the GitHub App. + output: true + - name: privateKeySecretVersion type: String - description: | - Optional. GitHub App installation id. - min_version: 'beta' - - name: 'installationUri' + description: |- + Optional. SecretManager resource containing the private key of the GitHub App, + formatted as `projects/*/secrets/*/versions/*`. + - name: installationUri + type: String + description: |- + Output only. The URI to navigate to in order to manage the installation associated + with this GitHubEnterpriseConfig. + output: 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: serverVersion type: String - description: | - Output only. The URI to navigate to in order to manage the installation - associated with this GitHubConfig. - min_version: 'beta' + description: Output only. GitHub Enterprise version installed at the host_uri. output: true - - name: 'name' + - name: sslCaCertificate + type: String + description: Optional. SSL certificate to use for requests to GitHub Enterprise. + - name: hostUri + type: String + description: Required. The URI of the GitHub Enterprise host this connection is for. + required: true + - name: appId + type: String + description: Optional. ID of the GitHub App created from the manifest. + - name: webhookSecretSecretVersion + type: String + description: |- + Optional. SecretManager resource containing the webhook secret of the GitHub App, + formatted as `projects/*/secrets/*/versions/*`. + - name: appInstallationId + type: String + description: Optional. ID of the installation of the GitHub App. + - name: labels + type: KeyValueLabels + description: Optional. Labels as key value pairs + - name: etag + type: String + description: |- + Optional. This checksum is computed by the server based on the value of other + fields, and may be sent on update and delete requests to ensure the + client has an up-to-date value before proceeding. + - name: uid + type: String + description: Output only. A system-assigned unique identifier for a the GitRepositoryLink. + output: true + - name: name type: String - description: | + description: |- Identifier. The resource name of the connection, in the format `projects/{project}/locations/{location}/connections/{connection_id}`. - min_version: 'beta' output: true - - name: 'createTime' - type: String - description: | - Output only. [Output only] Create timestamp - min_version: 'beta' + - name: reconciling + type: Boolean + description: |- + Output only. Set to true when the connection is being set up or updated in the + background. output: true - - name: 'updateTime' + - name: gitlabEnterpriseConfig + type: NestedObject + description: Configuration for connections to an instance of GitLab Enterprise. + properties: + - 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: 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 certificate to use for requests to GitLab + Enterprise instance. + - name: serverVersion + type: String + description: Output only. Version of the GitLab Enterprise server running on the `host_uri`. + output: true + - name: hostUri + type: String + description: Required. The URI of the GitLab Enterprise host this connection is for. + required: true + - name: webhookSecretSecretVersion + type: String + description: |- + Required. Immutable. SecretManager resource containing the webhook secret of a GitLab project, + 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: 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 - min_version: 'beta' + description: Output only. [Output only] Update timestamp output: true - - name: 'deleteTime' + - name: deleteTime type: String - description: | - Output only. [Output only] Delete timestamp - min_version: 'beta' + description: Output only. [Output only] Delete timestamp output: true - - name: 'labels' - type: KeyValueLabels - description: | - Optional. Labels as key value pairs - min_version: 'beta' - - name: 'installationState' + - name: installationState type: NestedObject - description: | - Describes stage and necessary actions to be taken by the user to complete the installation. - Used for GitHub and GitHub Enterprise based connections. - min_version: 'beta' + description: |- + Describes stage and necessary actions to be taken by the + user to complete the installation. Used for GitHub and GitHub Enterprise + based connections. output: true properties: - - name: 'stage' + - name: message type: String - description: | + description: |- + Output only. Message of what the user should do next to continue the installation. + Empty string if the installation is already complete. + - name: actionUri + type: String + description: |- + Output only. Link to follow for next action. Empty string if the installation is already + complete. + - name: stage + type: String + description: |- Output only. Current step of the installation process. Possible values: - STAGE_UNSPECIFIED - PENDING_CREATE_APP - PENDING_USER_OAUTH - PENDING_INSTALL_APP - COMPLETE - min_version: 'beta' + STAGE_UNSPECIFIED + PENDING_CREATE_APP + PENDING_USER_OAUTH + PENDING_INSTALL_APP + COMPLETE output: true - - name: 'message' - type: String - description: | - Output only. Message of what the user should do next to continue - the installation.Empty string if the installation is already complete. - min_version: 'beta' - - name: 'actionUri' - type: String - description: | - Output only. Link to follow for next action. Empty string if the - installation is already complete. - min_version: 'beta' - - name: 'disabled' - type: Boolean - description: - Optional. If disabled is set to true, functionality is disabled for - this connection. Repository based API methods and webhooks processing - for repositories in this connection will be disabled. - min_version: 'beta' - - name: 'reconciling' + - name: disabled type: Boolean - description: | - Output only. Set to true when the connection is being set up or updated - in the background. - min_version: 'beta' - output: true - - name: 'annotations' + description: |- + Optional. If disabled is set to true, functionality is disabled for this connection. + Repository based API methods and webhooks processing for repositories in + this connection will be disabled. + - name: annotations type: KeyValueAnnotations - description: | - Optional. Allows clients to store small amounts of arbitrary data. - min_version: 'beta' - - name: 'etag' - type: String - description: | - Optional. This checksum is computed by the server based on the value - of other fields, and may be sent on update and delete requests to ensure the - client has an up-to-date value before proceeding. - min_version: 'beta' - - name: 'uid' + description: Optional. Allows clients to store small amounts of arbitrary data. + - name: gitlabConfig + type: NestedObject + description: Configuration for connections to gitlab.com. + properties: + - name: webhookSecretSecretVersion + type: String + description: |- + Required. Immutable. SecretManager resource containing the webhook secret of a GitLab project, + 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: 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: createTime type: String - description: | - Output only. A system-assigned unique identifier for a the GitRepositoryLink. - min_version: 'beta' + description: Output only. [Output only] Create timestamp output: true + - name: cryptoKeyConfig + type: NestedObject + description: |- + The crypto key configuration. This field is used by the Customer-managed + encryption keys (CMEK) feature. + properties: + - name: keyReference + type: String + description: |- + Required. The name of the key which is used to encrypt/decrypt customer data. For key + in Cloud KMS, the key should be in the format of + `projects/*/locations/*/keyRings/*/cryptoKeys/*`. + required: true diff --git a/mmv1/products/developerconnect/GitRepositoryLink.yaml b/mmv1/products/developerconnect/GitRepositoryLink.yaml index 7a0f083e3bf8..d65ae4f34f2c 100644 --- a/mmv1/products/developerconnect/GitRepositoryLink.yaml +++ b/mmv1/products/developerconnect/GitRepositoryLink.yaml @@ -12,124 +12,156 @@ # limitations under the License. --- -name: 'GitRepositoryLink' -description: "A git repository link to a parent connection." -min_version: 'beta' -docs: -id_format: 'projects/{{project}}/locations/{{location}}/connections/{{parent_connection}}/gitRepositoryLinks/{{git_repository_link_id}}' -base_url: 'projects/{{project}}/locations/{{location}}/connections/{{parent_connection}}/gitRepositoryLinks' -self_link: 'projects/{{project}}/locations/{{location}}/connections/{{parent_connection}}/gitRepositoryLinks/{{git_repository_link_id}}' -create_url: 'projects/{{project}}/locations/{{location}}/connections/{{parent_connection}}/gitRepositoryLinks?gitRepositoryLinkId={{git_repository_link_id}}' +name: GitRepositoryLink +description: A git repository link to a parent connection. +base_url: projects/{{project}}/locations/{{location}}/connections/{{parent_connection}}/gitRepositoryLinks immutable: true +self_link: projects/{{project}}/locations/{{location}}/connections/{{parent_connection}}/gitRepositoryLinks/{{git_repository_link_id}} +create_url: projects/{{project}}/locations/{{location}}/connections/{{parent_connection}}/gitRepositoryLinks?gitRepositoryLinkId={{git_repository_link_id}} +id_format: projects/{{project}}/locations/{{location}}/connections/{{parent_connection}}/gitRepositoryLinks/{{git_repository_link_id}} import_format: - - 'projects/{{project}}/locations/{{location}}/connections/{{parent_connection}}/gitRepositoryLinks/{{git_repository_link_id}}' -timeouts: - insert_minutes: 20 - update_minutes: 20 - delete_minutes: 20 -autogen_async: true -async: - actions: ['create', 'delete', 'update'] - type: 'OpAsync' - operation: - base_url: '{{op_id}}' - result: - resource_inside_response: true -custom_code: + - projects/{{project}}/locations/{{location}}/connections/{{parent_connection}}/gitRepositoryLinks/{{git_repository_link_id}} examples: # These tests depend on secrets stored in a separate project, so we prefer not # to show them in the docs. - name: 'developer_connect_git_repository_link_github' primary_resource_id: 'primary' - min_version: 'beta' vars: connection_name: 'my-connection' git_repository_link_name: 'my-repository' exclude_docs: true - name: 'developer_connect_git_repository_link_github_doc' - min_version: 'beta' exclude_test: true + - name: 'developer_connect_git_repository_link_github_enterprise' + primary_resource_id: 'primary' + vars: + connection_name: 'my-connection' + git_repository_link_name: 'my-repository' + exclude_docs: true + - name: 'developer_connect_git_repository_link_github_enterprise_doc' + exclude_test: true + - name: 'developer_connect_git_repository_link_gitlab' + primary_resource_id: 'my-connection' + primary_resource_name: 'fmt.Sprintf("tf-test-connection%s", context["random_suffix"])' + vars: + connection_name: 'tf-test-connection' + git_repository_link_name: 'my-repository' + exclude_docs: true + - name: 'developer_connect_git_repository_link_gitlab_doc' + exclude_test: true + - name: 'developer_connect_git_repository_link_gitlab_enterprise' + primary_resource_id: 'my-connection' + primary_resource_name: 'fmt.Sprintf("tf-test-connection%s", context["random_suffix"])' + vars: + connection_name: 'tf-test-connection' + git_repository_link_name: 'my-repository' + exclude_docs: true + - name: 'developer_connect_git_repository_link_gitlab_enterprise_doc' + exclude_test: true + - name: 'developer_connect_git_repository_link_bitbucket_cloud' + primary_resource_id: 'my-connection' + primary_resource_name: 'fmt.Sprintf("tf-test-connection%s", context["random_suffix"])' + vars: + connection_name: 'tf-test-connection' + git_repository_link_name: 'my-repository' + exclude_docs: true + - name: 'developer_connect_git_repository_link_bitbucket_cloud_doc' + exclude_test: true + - name: 'developer_connect_git_repository_link_bbdc' + primary_resource_id: 'my-connection' + primary_resource_name: 'fmt.Sprintf("tf-test-connection%s", context["random_suffix"])' + vars: + connection_name: 'tf-test-connection' + git_repository_link_name: 'my-repository' + exclude_docs: true + - name: 'developer_connect_git_repository_link_bitbucket_cloud_doc' + exclude_test: true +autogen_async: true +async: + operation: + timeouts: + insert_minutes: 20 + update_minutes: 20 + delete_minutes: 20 + base_url: '{{op_id}}' + actions: + - create + - delete + - update + type: OpAsync + result: + resource_inside_response: true + error: {} + include_project: false +autogen_status: R2l0UmVwb3NpdG9yeUxpbms= parameters: - - name: 'location' + - name: location type: String - description: - "Resource ID segment making up resource `name`. It identifies the resource - within its parent collection as described in https://google.aip.dev/122. See documentation - for resource type `developerconnect.googleapis.com/GitRepositoryLink`. " - min_version: 'beta' + description: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. + immutable: true url_param_only: true required: true - immutable: true - - name: 'parent_connection' + - name: parent_connection type: String - description: - "Resource ID segment making up resource `name`. It identifies the resource - within its parent collection as described in https://google.aip.dev/122. See documentation - for resource type `developerconnect.googleapis.com/GitRepositoryLink`. " - min_version: 'beta' + description: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. + immutable: true url_param_only: true required: true - immutable: true - - name: 'gitRepositoryLinkId' + - name: gitRepositoryLinkId type: String - description: - "Required. The ID to use for the repository, which will become the - final component of\nthe repository's resource name. This ID should be unique in - the connection.\nAllows alphanumeric characters and any of -._~%!$&'()*+,;=@. " - min_version: 'beta' + description: |- + Required. The ID to use for the repository, which will become the final component of + the repository's resource name. This ID should be unique in the connection. + Allows alphanumeric characters and any of -._~%!$&'()*+,;=@. + immutable: true url_param_only: true required: true - immutable: true properties: - - name: 'name' - type: String - description: "Identifier. Resource name of the repository, in the format\n`projects/*/locations/*/connections/*/gitRepositoryLinks/*`. " - min_version: 'beta' - output: true - - name: 'cloneUri' + - name: cloneUri type: String - description: "Required. Git Clone URI. " - min_version: 'beta' + description: Required. Git Clone URI. required: true - - name: 'createTime' + - name: labels + type: KeyValueLabels + description: Optional. Labels as key value pairs + - name: annotations + type: KeyValueAnnotations + description: Optional. Allows clients to store small amounts of arbitrary data. + - name: uid type: String - description: "Output only. [Output only] Create timestamp " - min_version: 'beta' + description: Output only. A system-assigned unique identifier for a the GitRepositoryLink. output: true - - name: 'updateTime' + - name: name type: String - description: "Output only. [Output only] Update timestamp " - min_version: 'beta' + description: |- + Identifier. Resource name of the repository, in the format + `projects/*/locations/*/connections/*/gitRepositoryLinks/*`. output: true - - name: 'deleteTime' + - name: updateTime type: String - description: "Output only. [Output only] Delete timestamp " - min_version: 'beta' + description: Output only. [Output only] Update timestamp output: true - - name: 'labels' - type: KeyValueLabels - description: "Optional. Labels as key value pairs " - min_version: 'beta' - - name: 'etag' + - name: deleteTime + type: String + description: Output only. [Output only] Delete timestamp + output: true + - name: etag type: String - description: - "Optional. This checksum is computed by the server based on the value - of other\nfields, and may be sent on update and delete requests to ensure the\nclient - has an up-to-date value before proceeding. " - min_version: 'beta' - - name: 'reconciling' + description: |- + Optional. This checksum is computed by the server based on the value of other + fields, and may be sent on update and delete requests to ensure the + client has an up-to-date value before proceeding. + - name: reconciling type: Boolean - description: - "Output only. Set to true when the connection is being set up or updated - in the\nbackground. " - min_version: 'beta' + description: |- + Output only. Set to true when the connection is being set up or updated in the + background. output: true - - name: 'annotations' - type: KeyValueAnnotations - description: "Optional. Allows clients to store small amounts of arbitrary data. " - min_version: 'beta' - - name: 'uid' + - name: webhookId + type: String + description: Output only. External ID of the webhook created for the repository. + output: true + - name: createTime type: String - description: "Output only. A system-assigned unique identifier for a the GitRepositoryLink. " - min_version: 'beta' + description: Output only. [Output only] Create timestamp output: true diff --git a/mmv1/products/developerconnect/product.yaml b/mmv1/products/developerconnect/product.yaml index 5a32e127e0af..ee8ce01b6678 100644 --- a/mmv1/products/developerconnect/product.yaml +++ b/mmv1/products/developerconnect/product.yaml @@ -12,10 +12,11 @@ # limitations under the License. --- -name: 'DeveloperConnect' -display_name: 'Developer Connect' -versions: - - name: 'beta' - base_url: 'https://developerconnect.googleapis.com/v1/' +name: DeveloperConnect +display_name: Developer Connect scopes: - 'https://www.googleapis.com/auth/cloud-platform' +versions: + - base_url: 'https://developerconnect.googleapis.com/v1/' + name: ga +caibaseurl: "" diff --git a/mmv1/templates/terraform/examples/developer_connect_connection_bbdc.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_connection_bbdc.tf.tmpl new file mode 100644 index 000000000000..266515e11928 --- /dev/null +++ b/mmv1/templates/terraform/examples/developer_connect_connection_bbdc.tf.tmpl @@ -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" + } + } +} diff --git a/mmv1/templates/terraform/examples/developer_connect_connection_bbdc_doc.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_connection_bbdc_doc.tf.tmpl new file mode 100644 index 000000000000..e8a424184423 --- /dev/null +++ b/mmv1/templates/terraform/examples/developer_connect_connection_bbdc_doc.tf.tmpl @@ -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:service-123456789@gcp-sa-devconnect.iam.gserviceaccount.com"] + } +} + +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_cloud_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 + ] +} diff --git a/mmv1/templates/terraform/examples/developer_connect_connection_bitbucket_cloud.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_connection_bitbucket_cloud.tf.tmpl new file mode 100644 index 000000000000..382f5abc2302 --- /dev/null +++ b/mmv1/templates/terraform/examples/developer_connect_connection_bitbucket_cloud.tf.tmpl @@ -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" + } + } +} diff --git a/mmv1/templates/terraform/examples/developer_connect_connection_bitbucket_cloud_doc.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_connection_bitbucket_cloud_doc.tf.tmpl new file mode 100644 index 000000000000..3147391380cd --- /dev/null +++ b/mmv1/templates/terraform/examples/developer_connect_connection_bitbucket_cloud_doc.tf.tmpl @@ -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:service-123456789@gcp-sa-devconnect.iam.gserviceaccount.com"] + } +} + +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 + ] +} diff --git a/mmv1/templates/terraform/examples/developer_connect_connection_basic.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_connection_github.tf.tmpl similarity index 94% rename from mmv1/templates/terraform/examples/developer_connect_connection_basic.tf.tmpl rename to mmv1/templates/terraform/examples/developer_connect_connection_github.tf.tmpl index 693baf83874b..97d07f9deacf 100644 --- a/mmv1/templates/terraform/examples/developer_connect_connection_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/developer_connect_connection_github.tf.tmpl @@ -1,5 +1,4 @@ resource "google_developer_connect_connection" "{{$.PrimaryResourceId}}" { - provider = google-beta location = "us-central1" connection_id = "{{index $.Vars "connection_name"}}" diff --git a/mmv1/templates/terraform/examples/developer_connect_connection_github_doc.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_connection_github_doc.tf.tmpl index 07933b8641b4..4fe608a1bede 100644 --- a/mmv1/templates/terraform/examples/developer_connect_connection_github_doc.tf.tmpl +++ b/mmv1/templates/terraform/examples/developer_connect_connection_github_doc.tf.tmpl @@ -1,6 +1,5 @@ resource "google_secret_manager_secret" "github-token-secret" { - provider = google-beta secret_id = "github-token-secret" replication { @@ -10,7 +9,6 @@ resource "google_secret_manager_secret" "github-token-secret" { resource "google_secret_manager_secret_version" "github-token-secret-version" { - provider = google-beta secret = google_secret_manager_secret.github-token-secret.id secret_data = file("my-github-token.txt") } @@ -25,14 +23,12 @@ data "google_iam_policy" "p4sa-secretAccessor" { resource "google_secret_manager_secret_iam_policy" "policy" { - provider = google-beta secret_id = google_secret_manager_secret.github-token-secret.secret_id policy_data = data.google_iam_policy.p4sa-secretAccessor.policy_data } resource "google_developer_connect_connection" "my-connection" { - provider = google-beta location = "us-central1" connection_id = "my-connection" diff --git a/mmv1/templates/terraform/examples/developer_connect_connection_github_enterprise.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_connection_github_enterprise.tf.tmpl new file mode 100644 index 000000000000..1ded312974f5 --- /dev/null +++ b/mmv1/templates/terraform/examples/developer_connect_connection_github_enterprise.tf.tmpl @@ -0,0 +1,12 @@ +resource "google_developer_connect_connection" "{{$.PrimaryResourceId}}" { + location = "us-central1" + connection_id = "{{index $.Vars "connection_name"}}" + + github_enterprise_config { + host_uri = "https://ghe.proctor-staging-test.com" + app_id = 864434 + private_key_secret_version = "projects/devconnect-terraform-creds/secrets/tf-test-ghe-do-not-change-ghe-private-key-f522d2/versions/latest" + webhook_secret_secret_version = "projects/devconnect-terraform-creds/secrets/tf-test-ghe-do-not-change-ghe-webhook-secret-3c806f/versions/latest" + app_installation_id = 837537 + } +} diff --git a/mmv1/templates/terraform/examples/developer_connect_connection_github_enterprise_doc.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_connection_github_enterprise_doc.tf.tmpl new file mode 100644 index 000000000000..456a7d34e8ca --- /dev/null +++ b/mmv1/templates/terraform/examples/developer_connect_connection_github_enterprise_doc.tf.tmpl @@ -0,0 +1,61 @@ +resource "google_secret_manager_secret" "private-key-secret" { + secret_id = "ghe-pk-secret" + + replication { + auto {} + } +} + +resource "google_secret_manager_secret_version" "private-key-secret-version" { + secret = google_secret_manager_secret.private-key-secret.id + secret_data = file("private-key.pem") +} + +resource "google_secret_manager_secret" "webhook-secret-secret" { + secret_id = "ghe-token-secret" + + replication { + auto {} + } +} + +resource "google_secret_manager_secret_version" "webhook-secret-secret-version" { + secret = google_secret_manager_secret.webhook-secret-secret.id + secret_data = "" +} + +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:service-123456789@gcp-sa-devconnect.iam.gserviceaccount.com"] + } +} + +resource "google_secret_manager_secret_iam_policy" "policy-pk" { + secret_id = google_secret_manager_secret.private-key-secret.secret_id + policy_data = data.google_iam_policy.p4sa-secretAccessor.policy_data +} + +resource "google_secret_manager_secret_iam_policy" "policy-whs" { + secret_id = google_secret_manager_secret.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" + + github_enterprise_config { + host_uri = "https://ghe.com" + private_key_secret_version = google_secret_manager_secret_version.private-key-secret-version.id + webhook_secret_secret_version = google_secret_manager_secret_version.webhook-secret-secret-version.id + app_id = 100 + app_installation_id = 123123 + } + + depends_on = [ + google_secret_manager_secret_iam_policy.policy-pk, + google_secret_manager_secret_iam_policy.policy-whs + ] +} diff --git a/mmv1/templates/terraform/examples/developer_connect_connection_gitlab.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_connection_gitlab.tf.tmpl new file mode 100644 index 000000000000..e62e64a88461 --- /dev/null +++ b/mmv1/templates/terraform/examples/developer_connect_connection_gitlab.tf.tmpl @@ -0,0 +1,16 @@ +resource "google_developer_connect_connection" "{{$.PrimaryResourceId}}" { + location = "us-central1" + connection_id = "{{index $.Vars "connection_name"}}" + + gitlab_config { + webhook_secret_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-webhook/versions/latest" + + read_authorizer_credential { + user_token_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-read-cred/versions/latest" + } + + authorizer_credential { + user_token_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-auth-cred/versions/latest" + } + } +} diff --git a/mmv1/templates/terraform/examples/developer_connect_connection_gitlab_doc.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_connection_gitlab_doc.tf.tmpl new file mode 100644 index 000000000000..51c2f4714f38 --- /dev/null +++ b/mmv1/templates/terraform/examples/developer_connect_connection_gitlab_doc.tf.tmpl @@ -0,0 +1,81 @@ +resource "google_secret_manager_secret" "gitlab-read-cred-secret" { + secret_id = "gitlab-read-cred" + replication { + auto {} + } +} + +resource "google_secret_manager_secret_version" "gitlab-read-cred-secret-version" { + secret = google_secret_manager_secret.gitlab-read-cred-secret.id + secret_data = file("my-gitlab-read-cred.txt") +} + +resource "google_secret_manager_secret" "gitlab-auth-cred-secret" { + secret_id = "gitlab-auth-cred" + replication { + auto {} + } +} + +resource "google_secret_manager_secret_version" "gitlab-auth-cred-secret-version" { + secret = google_secret_manager_secret.gitlab-auth-cred-secret.id + secret_data = file("my-gitlab-auth-cred.txt") +} + +resource "google_secret_manager_secret" "gitlab-webhook-secret-secret" { + secret_id = "gitlab-webhook-secret" + replication { + auto {} + } +} + +resource "google_secret_manager_secret_version" "gitlab-webhook-secret-secret-version" { + secret = google_secret_manager_secret.gitlab-webhook-secret-secret.id + secret_data = file("my-gitlab-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:service-123456789@gcp-sa-devconnect.iam.gserviceaccount.com"] + } +} + +resource "google_secret_manager_secret_iam_policy" "policy-rc" { + secret_id = google_secret_manager_secret.gitlab-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.gitlab-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.gitlab-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" + + gitlab_config { + webhook_secret_secret_version = google_secret_manager_secret_version.gitlab-webhook-secret-secret-version.id + + read_authorizer_credential { + user_token_secret_version = google_secret_manager_secret_version.gitlab-read-cred-secret-version.id + } + + authorizer_credential { + user_token_secret_version = google_secret_manager_secret_version.gitlab-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 + ] +} diff --git a/mmv1/templates/terraform/examples/developer_connect_connection_gitlab_enterprise.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_connection_gitlab_enterprise.tf.tmpl new file mode 100644 index 000000000000..dcf4fa7847a2 --- /dev/null +++ b/mmv1/templates/terraform/examples/developer_connect_connection_gitlab_enterprise.tf.tmpl @@ -0,0 +1,18 @@ +resource "google_developer_connect_connection" "{{$.PrimaryResourceId}}" { + location = "us-central1" + connection_id = "{{index $.Vars "connection_name"}}" + + gitlab_enterprise_config { + host_uri = "https://gle-us-central1.gcb-test.com" + + webhook_secret_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-enterprise-webhook/versions/latest" + + read_authorizer_credential { + user_token_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-enterprise-read-cred/versions/latest" + } + + authorizer_credential { + user_token_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-enterprise-auth-cred/versions/latest" + } + } +} diff --git a/mmv1/templates/terraform/examples/developer_connect_connection_gitlab_enterprise_doc.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_connection_gitlab_enterprise_doc.tf.tmpl new file mode 100644 index 000000000000..1ff9b798b57a --- /dev/null +++ b/mmv1/templates/terraform/examples/developer_connect_connection_gitlab_enterprise_doc.tf.tmpl @@ -0,0 +1,83 @@ +resource "google_secret_manager_secret" "gitlab-read-cred-secret" { + secret_id = "gitlab-read-cred" + replication { + auto {} + } +} + +resource "google_secret_manager_secret_version" "gitlab-read-cred-secret-version" { + secret = google_secret_manager_secret.gitlab-read-cred-secret.id + secret_data = file("my-gitlab-read-cred.txt") +} + +resource "google_secret_manager_secret" "gitlab-auth-cred-secret" { + secret_id = "gitlab-auth-cred" + replication { + auto {} + } +} + +resource "google_secret_manager_secret_version" "gitlab-auth-cred-secret-version" { + secret = google_secret_manager_secret.gitlab-auth-cred-secret.id + secret_data = file("my-gitlab-auth-cred.txt") +} + +resource "google_secret_manager_secret" "gitlab-webhook-secret-secret" { + secret_id = "gitlab-webhook-secret" + replication { + auto {} + } +} + +resource "google_secret_manager_secret_version" "gitlab-webhook-secret-secret-version" { + secret = google_secret_manager_secret.gitlab-webhook-secret-secret.id + secret_data = file("my-gitlab-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:service-123456789@gcp-sa-devconnect.iam.gserviceaccount.com"] + } +} + +resource "google_secret_manager_secret_iam_policy" "policy-rc" { + secret_id = google_secret_manager_secret.gitlab-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.gitlab-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.gitlab-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" + + gitlab_enterprise_config { + host_uri = "https://gle.com" + + webhook_secret_secret_version = google_secret_manager_secret_version.gitlab-webhook-secret-secret-version.id + + read_authorizer_credential { + user_token_secret_version = google_secret_manager_secret_version.gitlab-read-cred-secret-version.id + } + + authorizer_credential { + user_token_secret_version = google_secret_manager_secret_version.gitlab-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 + ] +} diff --git a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_bbdc.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_bbdc.tf.tmpl new file mode 100644 index 000000000000..75fbe0252e68 --- /dev/null +++ b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_bbdc.tf.tmpl @@ -0,0 +1,29 @@ +resource "google_developer_connect_git_repository_link" "{{$.PrimaryResourceId}}" { + git_repository_link_id = "{{index $.Vars "git_repository_link_name"}}" + parent_connection = google_developer_connect_connection.bbdc_conn.connection_id + clone_uri = "https://bitbucket-us-central.gcb-test.com/scm/test/inarayanan-test.git" + location = "us-central1" + annotations = {} + labels = {} +} + +resource "google_developer_connect_connection" "bbdc_conn" { + + location = "us-central1" + connection_id = "{{index $.Vars "connection_name"}}" + disabled = false + + 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" + } + } +} diff --git a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_bbdc_doc.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_bbdc_doc.tf.tmpl new file mode 100644 index 000000000000..4a72567e7ccd --- /dev/null +++ b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_bbdc_doc.tf.tmpl @@ -0,0 +1,90 @@ +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:service-123456789@gcp-sa-devconnect.iam.gserviceaccount.com"] + } +} + +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_cloud_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 + ] +} + +resource "google_developer_connect_git_repository_link" "my-repository" { + location = "us-central1" + git_repository_link_id = "my-repo" + parent_connection = google_developer_connect_connection.my-connection.connection_id + clone_uri = "https://bitbucket-test-server.com/scm/test/myrepo.git" +} diff --git a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_bitbucket_cloud.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_bitbucket_cloud.tf.tmpl new file mode 100644 index 000000000000..4904a24e500e --- /dev/null +++ b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_bitbucket_cloud.tf.tmpl @@ -0,0 +1,29 @@ +resource "google_developer_connect_git_repository_link" "{{$.PrimaryResourceId}}" { + git_repository_link_id = "{{index $.Vars "git_repository_link_name"}}" + parent_connection = google_developer_connect_connection.bbc_conn.connection_id + clone_uri = "https://bitbucket.org/proctor-test-dc/inarayanan-test.git" + location = "us-central1" + annotations = {} + labels = {} +} + +resource "google_developer_connect_connection" "bbc_conn" { + + location = "us-central1" + connection_id = "{{index $.Vars "connection_name"}}" + disabled = false + + 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" + } + } +} diff --git a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_bitbucket_cloud_doc.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_bitbucket_cloud_doc.tf.tmpl new file mode 100644 index 000000000000..4b06ea8d6ba1 --- /dev/null +++ b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_bitbucket_cloud_doc.tf.tmpl @@ -0,0 +1,90 @@ +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:service-123456789@gcp-sa-devconnect.iam.gserviceaccount.com"] + } +} + +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 + ] +} + +resource "google_developer_connect_git_repository_link" "my-repository" { + location = "us-central1" + git_repository_link_id = "my-repo" + parent_connection = google_developer_connect_connection.my-connection.connection_id + clone_uri = "https://bitbucket.org/test-workspace/myrepo.git" +} diff --git a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github.tf.tmpl index 1c253849206f..b673c58bfbb9 100644 --- a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github.tf.tmpl +++ b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github.tf.tmpl @@ -1,17 +1,15 @@ resource "google_developer_connect_git_repository_link" "{{$.PrimaryResourceId}}" { - provider = google-beta - git_repository_link_id = "{{index $.Vars "git_repository_link_name"}}" + git_repository_link_id = "{{index $.Vars "git_repository_link_name"}}" parent_connection = google_developer_connect_connection.github_conn.connection_id - clone_uri = "https://github.com/gcb-developerconnect-robot/tf-demo.git" - location = "us-central1" - annotations = {} + clone_uri = "https://github.com/gcb-developerconnect-robot/tf-demo.git" + location = "us-central1" + annotations = {} + labels = {} } - -resource "google_developer_connect_connection" "github_conn" { - provider = google-beta +resource "google_developer_connect_connection" "github_conn" { location = "us-central1" - connection_id = "{{index $.Vars "connection_name"}}" + connection_id = "{{index $.Vars "connection_name"}}" disabled = false github_config { @@ -23,3 +21,4 @@ resource "google_developer_connect_connection" "github_conn" { } } } + diff --git a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github_doc.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github_doc.tf.tmpl index db9d1943ebb4..8f3b566677d5 100644 --- a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github_doc.tf.tmpl +++ b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github_doc.tf.tmpl @@ -1,5 +1,4 @@ resource "google_secret_manager_secret" "github-token-secret" { - provider = google-beta secret_id = "github-token-secret" replication { @@ -42,5 +41,5 @@ resource "google_developer_connect_git_repository_link" "my-repository" { location = "us-central1" git_repository_link_id = "my-repo" parent_connection = google_developer_connect_connection.my-connection.connection_id - remote_uri = "https://github.com/myuser/myrepo.git" + clone_uri = "https://github.com/myuser/myrepo.git" } diff --git a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github_enterprise.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github_enterprise.tf.tmpl new file mode 100644 index 000000000000..1633252ef757 --- /dev/null +++ b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github_enterprise.tf.tmpl @@ -0,0 +1,23 @@ +resource "google_developer_connect_git_repository_link" "{{$.PrimaryResourceId}}" { + git_repository_link_id = "{{index $.Vars "git_repository_link_name"}}" + parent_connection = google_developer_connect_connection.github_enterprise_conn.connection_id + clone_uri = "https://ghe.proctor-staging-test.com/proctorteam/inarayanan-test.git" + location = "us-central1" + annotations = {} + labels = {} +} + +resource "google_developer_connect_connection" "github_enterprise_conn" { + + location = "us-central1" + connection_id = "{{index $.Vars "connection_name"}}" + disabled = false + + github_enterprise_config { + host_uri = "https://ghe.proctor-staging-test.com" + app_id = 864434 + private_key_secret_version = "projects/devconnect-terraform-creds/secrets/tf-test-ghe-do-not-change-ghe-private-key-f522d2/versions/latest" + webhook_secret_secret_version = "projects/devconnect-terraform-creds/secrets/tf-test-ghe-do-not-change-ghe-webhook-secret-3c806f/versions/latest" + app_installation_id = 837537 + } +} diff --git a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github_enterprise_doc.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github_enterprise_doc.tf.tmpl new file mode 100644 index 000000000000..fbf9a62e188e --- /dev/null +++ b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_github_enterprise_doc.tf.tmpl @@ -0,0 +1,68 @@ +resource "google_secret_manager_secret" "private-key-secret" { + secret_id = "ghe-pk-secret" + + replication { + auto {} + } +} + +resource "google_secret_manager_secret_version" "private-key-secret-version" { + secret = google_secret_manager_secret.private-key-secret.id + secret_data = file("private-key.pem") +} + +resource "google_secret_manager_secret" "webhook-secret-secret" { + secret_id = "ghe-token-secret" + + replication { + auto {} + } +} + +resource "google_secret_manager_secret_version" "webhook-secret-secret-version" { + secret = google_secret_manager_secret.webhook-secret-secret.id + secret_data = "" +} + +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:service-123456789@gcp-sa-devconnect.iam.gserviceaccount.com"] + } +} + +resource "google_secret_manager_secret_iam_policy" "policy-pk" { + secret_id = google_secret_manager_secret.private-key-secret.secret_id + policy_data = data.google_iam_policy.p4sa-secretAccessor.policy_data +} + +resource "google_secret_manager_secret_iam_policy" "policy-whs" { + secret_id = google_secret_manager_secret.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" + + github_enterprise_config { + host_uri = "https://ghe.com" + private_key_secret_version = google_secret_manager_secret_version.private-key-secret-version.id + webhook_secret_secret_version = google_secret_manager_secret_version.webhook-secret-secret-version.id + app_id = 100 + app_installation_id = 123123 + } + + depends_on = [ + google_secret_manager_secret_iam_policy.policy-pk, + google_secret_manager_secret_iam_policy.policy-whs + ] +} + +resource "google_developer_connect_git_repository_link" "my-repository" { + location = "us-central1" + git_repository_link_id = "my-repo" + parent_connection = google_developer_connect_connection.my-connection.connection_id + clone_uri = "https://ghe.com/myuser/myrepo.git" +} diff --git a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_gitlab.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_gitlab.tf.tmpl new file mode 100644 index 000000000000..d82f50cdeceb --- /dev/null +++ b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_gitlab.tf.tmpl @@ -0,0 +1,27 @@ +resource "google_developer_connect_git_repository_link" "{{$.PrimaryResourceId}}" { + git_repository_link_id = "{{index $.Vars "git_repository_link_name"}}" + parent_connection = google_developer_connect_connection.gitlab_conn.connection_id + clone_uri = "https://gitlab.com/devconnect-eng-team/inarayanan-test.git" + location = "us-central1" + annotations = {} + labels = {} +} + +resource "google_developer_connect_connection" "gitlab_conn" { + + location = "us-central1" + connection_id = "{{index $.Vars "connection_name"}}" + disabled = false + + gitlab_config { + webhook_secret_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-webhook/versions/latest" + + read_authorizer_credential { + user_token_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-read-cred/versions/latest" + } + + authorizer_credential { + user_token_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-auth-cred/versions/latest" + } + } +} diff --git a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_gitlab_doc.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_gitlab_doc.tf.tmpl new file mode 100644 index 000000000000..0b56a9bfeecd --- /dev/null +++ b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_gitlab_doc.tf.tmpl @@ -0,0 +1,88 @@ +resource "google_secret_manager_secret" "gitlab-read-cred-secret" { + secret_id = "gitlab-read-cred" + replication { + auto {} + } +} + +resource "google_secret_manager_secret_version" "gitlab-read-cred-secret-version" { + secret = google_secret_manager_secret.gitlab-read-cred-secret.id + secret_data = file("my-gitlab-read-cred.txt") +} + +resource "google_secret_manager_secret" "gitlab-auth-cred-secret" { + secret_id = "gitlab-auth-cred" + replication { + auto {} + } +} + +resource "google_secret_manager_secret_version" "gitlab-auth-cred-secret-version" { + secret = google_secret_manager_secret.gitlab-auth-cred-secret.id + secret_data = file("my-gitlab-auth-cred.txt") +} + +resource "google_secret_manager_secret" "gitlab-webhook-secret-secret" { + secret_id = "gitlab-webhook-secret" + replication { + auto {} + } +} + +resource "google_secret_manager_secret_version" "gitlab-webhook-secret-secret-version" { + secret = google_secret_manager_secret.gitlab-webhook-secret-secret.id + secret_data = file("my-gitlab-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:service-123456789@gcp-sa-devconnect.iam.gserviceaccount.com"] + } +} + +resource "google_secret_manager_secret_iam_policy" "policy-rc" { + secret_id = google_secret_manager_secret.gitlab-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.gitlab-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.gitlab-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" + + gitlab_config { + webhook_secret_secret_version = google_secret_manager_secret_version.gitlab-webhook-secret-secret-version.id + + read_authorizer_credential { + user_token_secret_version = google_secret_manager_secret_version.gitlab-read-cred-secret-version.id + } + + authorizer_credential { + user_token_secret_version = google_secret_manager_secret_version.gitlab-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 + ] +} + +resource "google_developer_connect_git_repository_link" "my-repository" { + location = "us-central1" + git_repository_link_id = "my-repo" + parent_connection = google_developer_connect_connection.my-connection.connection_id + clone_uri = "https://gitlab.com/myuser/myrepo.git" +} diff --git a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_gitlab_enterprise.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_gitlab_enterprise.tf.tmpl new file mode 100644 index 000000000000..567c08694359 --- /dev/null +++ b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_gitlab_enterprise.tf.tmpl @@ -0,0 +1,29 @@ +resource "google_developer_connect_git_repository_link" "{{$.PrimaryResourceId}}" { + git_repository_link_id = "{{index $.Vars "git_repository_link_name"}}" + parent_connection = google_developer_connect_connection.gitlab_enterprise_conn.connection_id + clone_uri = "https://gle-us-central1.gcb-test.com/test-group/inarayanan-test.git" + location = "us-central1" + annotations = {} + labels = {} +} + +resource "google_developer_connect_connection" "gitlab_enterprise_conn" { + + location = "us-central1" + connection_id = "{{index $.Vars "connection_name"}}" + disabled = false + + gitlab_enterprise_config { + host_uri = "https://gle-us-central1.gcb-test.com" + + webhook_secret_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-enterprise-webhook/versions/latest" + + read_authorizer_credential { + user_token_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-enterprise-read-cred/versions/latest" + } + + authorizer_credential { + user_token_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-enterprise-auth-cred/versions/latest" + } + } +} diff --git a/mmv1/templates/terraform/examples/developer_connect_git_repository_link_gitlab_enterprise_doc.tf.tmpl b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_gitlab_enterprise_doc.tf.tmpl new file mode 100644 index 000000000000..5e61679d339f --- /dev/null +++ b/mmv1/templates/terraform/examples/developer_connect_git_repository_link_gitlab_enterprise_doc.tf.tmpl @@ -0,0 +1,90 @@ +resource "google_secret_manager_secret" "gitlab-read-cred-secret" { + secret_id = "gitlab-read-cred" + replication { + auto {} + } +} + +resource "google_secret_manager_secret_version" "gitlab-read-cred-secret-version" { + secret = google_secret_manager_secret.gitlab-read-cred-secret.id + secret_data = file("my-gitlab-read-cred.txt") +} + +resource "google_secret_manager_secret" "gitlab-auth-cred-secret" { + secret_id = "gitlab-auth-cred" + replication { + auto {} + } +} + +resource "google_secret_manager_secret_version" "gitlab-auth-cred-secret-version" { + secret = google_secret_manager_secret.gitlab-auth-cred-secret.id + secret_data = file("my-gitlab-auth-cred.txt") +} + +resource "google_secret_manager_secret" "gitlab-webhook-secret-secret" { + secret_id = "gitlab-webhook-secret" + replication { + auto {} + } +} + +resource "google_secret_manager_secret_version" "gitlab-webhook-secret-secret-version" { + secret = google_secret_manager_secret.gitlab-webhook-secret-secret.id + secret_data = file("my-gitlab-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:service-123456789@gcp-sa-devconnect.iam.gserviceaccount.com"] + } +} + +resource "google_secret_manager_secret_iam_policy" "policy-rc" { + secret_id = google_secret_manager_secret.gitlab-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.gitlab-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.gitlab-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" + + gitlab_enterprise_config { + host_uri = "https://gle.com" + + webhook_secret_secret_version = google_secret_manager_secret_version.gitlab-webhook-secret-secret-version.id + + read_authorizer_credential { + user_token_secret_version = google_secret_manager_secret_version.gitlab-read-cred-secret-version.id + } + + authorizer_credential { + user_token_secret_version = google_secret_manager_secret_version.gitlab-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 + ] +} + +resource "google_developer_connect_git_repository_link" "my-repository" { + location = "us-central1" + git_repository_link_id = "my-repo" + parent_connection = google_developer_connect_connection.my-connection.connection_id + clone_uri = "https://gle.com/myuser/myrepo.git" +} diff --git a/mmv1/third_party/terraform/services/developerconnect/resource_developer_connect_connection_test.go.tmpl b/mmv1/third_party/terraform/services/developerconnect/resource_developer_connect_connection_test.go.tmpl index 717d43ef0330..2c58f64d3ad6 100644 --- a/mmv1/third_party/terraform/services/developerconnect/resource_developer_connect_connection_test.go.tmpl +++ b/mmv1/third_party/terraform/services/developerconnect/resource_developer_connect_connection_test.go.tmpl @@ -1,15 +1,15 @@ package developerconnect_test -{{- if ne $.TargetVersionName "ga" }} import ( "testing" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-provider-google/google/acctest" + ) -func TestAccDeveloperConnectConnection_update(t *testing.T) { +func TestAccDeveloperConnectConnection_developerConnectConnectionGithubUpdate(t *testing.T) { t.Parallel() context := map[string]interface{}{ @@ -18,10 +18,10 @@ func TestAccDeveloperConnectConnection_update(t *testing.T) { acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccDeveloperConnectConnection_basic(context), + Config: testAccDeveloperConnectConnection_Github(context), }, { ResourceName: "google_developer_connect_connection.my-connection", @@ -30,22 +30,22 @@ func TestAccDeveloperConnectConnection_update(t *testing.T) { ImportStateVerifyIgnore: []string{"annotations", "connection_id", "labels", "location", "terraform_labels"}, }, { - Config: testAccDeveloperConnectConnection_update(context), + Config: testAccDeveloperConnectConnection_GithubUpdate(context), }, { ResourceName: "google_developer_connect_connection.my-connection", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"annotations", "connection_id", "labels", "location", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"connection_id", "location", "terraform_labels"}, }, }, }) } -func testAccDeveloperConnectConnection_basic(context map[string]interface{}) string { - return acctest.Nprintf(` + +func testAccDeveloperConnectConnection_Github(context map[string]interface{}) string { + return acctest.Nprintf(` resource "google_developer_connect_connection" "my-connection" { - provider = google-beta location = "us-central1" connection_id = "tf-test-tf-test-connection%{random_suffix}" @@ -61,12 +61,17 @@ resource "google_developer_connect_connection" "my-connection" { } -func testAccDeveloperConnectConnection_update(context map[string]interface{}) string { +func testAccDeveloperConnectConnection_GithubUpdate(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_developer_connect_connection" "my-connection" { - provider = google-beta location = "us-central1" connection_id = "tf-test-tf-test-connection%{random_suffix}" + annotations = {} + labels = {} + + crypto_key_config { + key_reference = "projects/devconnect-terraform-creds/locations/us-central1/keyRings/tf-keyring/cryptoKeys/tf-crypto-key" + } github_config { github_app = "DEVELOPER_CONNECT" @@ -80,4 +85,591 @@ resource "google_developer_connect_connection" "my-connection" { `, context) } -{{ end }} + +func TestAccDeveloperConnectConnection_developerConnectConnectionGithubEnterpriseUpdate(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + Steps: []resource.TestStep{ + { + Config: testAccDeveloperConnectConnection_GithubEnterprise(context), + }, + { + ResourceName: "google_developer_connect_connection.my-connection", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"connection_id", "labels", "terraform_labels"}, + }, + { + Config: testAccDeveloperConnectConnection_GithubEnterpriseUpdate(context), + }, + { + ResourceName: "google_developer_connect_connection.my-connection", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"connection_id", "location", "terraform_labels"}, + }, + }, + }) +} + + +func testAccDeveloperConnectConnection_GithubEnterprise(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_developer_connect_connection" "my-connection" { + location = "us-central1" + connection_id = "tf-test-tf-test-connection%{random_suffix}" + + github_enterprise_config { + host_uri = "https://ghe.proctor-staging-test.com" + app_id = 864434 + private_key_secret_version = "projects/devconnect-terraform-creds/secrets/tf-test-ghe-do-not-change-ghe-private-key-f522d2/versions/latest" + webhook_secret_secret_version = "projects/devconnect-terraform-creds/secrets/tf-test-ghe-do-not-change-ghe-webhook-secret-3c806f/versions/latest" + } +} +`, context) +} + + +func testAccDeveloperConnectConnection_GithubEnterpriseUpdate(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_developer_connect_connection" "my-connection" { + location = "us-central1" + connection_id = "tf-test-tf-test-connection%{random_suffix}" + annotations = {} + labels = {} + + crypto_key_config { + key_reference = "projects/devconnect-terraform-creds/locations/us-central1/keyRings/tf-keyring/cryptoKeys/tf-crypto-key" + } + + github_enterprise_config { + host_uri = "https://ghe.proctor-staging-test.com" + app_id = 864434 + private_key_secret_version = "projects/devconnect-terraform-creds/secrets/tf-test-ghe-do-not-change-ghe-private-key-f522d2/versions/latest" + webhook_secret_secret_version = "projects/devconnect-terraform-creds/secrets/tf-test-ghe-do-not-change-ghe-webhook-secret-3c806f/versions/latest" + app_installation_id = 837537 + } +} +`, context) +} + + +func TestAccDeveloperConnectConnection_GhePrivConnection(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + Steps: []resource.TestStep{ + { + Config: testAccDeveloperConnectConnection_GhePrivConnection(context), + }, + { + ResourceName: "google_developer_connect_connection.my-connection", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"connection_id", "location", "terraform_labels"}, + }, + }, + }) +} + + +func testAccDeveloperConnectConnection_GhePrivConnection(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_developer_connect_connection" "my-connection" { + location = "us-central1" + connection_id = "tf-test-tf-test-connection%{random_suffix}" + annotations = {} + labels = {} + + github_enterprise_config { + host_uri = "https://ghe.proctor-private-ca.com" + app_id = 26 + private_key_secret_version = "projects/devconnect-terraform-creds/secrets/ghe-priv-private-key/versions/latest" + webhook_secret_secret_version = "projects/devconnect-terraform-creds/secrets/tf-test-ghe-do-not-change-ghe-webhook-secret-3c806f/versions/latest" + app_installation_id = 24 + + ssl_ca_certificate = "-----BEGIN CERTIFICATE-----\nMIIEXTCCA0WgAwIBAgIUANaBCc9j/xdKJHU0sgmv6yE2WCIwDQYJKoZIhvcNAQEL\nBQAwLDEUMBIGA1UEChMLUHJvY3RvciBFbmcxFDASBgNVBAMTC1Byb2N0b3ItZW5n\nMB4XDTIxMDcxNTIwMDcwMloXDTIyMDcxNTIwMDcwMVowADCCASIwDQYJKoZIhvcN\nAQEBBQADggEPADCCAQoCggEBAMVel7I88DkhwW445BNPBZvJNTV1AreHdz4um4U1\nop2+4L7JeNrUs5SRc0fzeOyOmA9ZzTDu9hBC7zj/sVNUy6cIQGCj32sr5SCAEIat\nnFZlzmVqJPT4J5NAaE37KO5347myTJEBrvpq8az4CtvX0yUzPK0gbUmaSaztVi4o\ndbJLKyv575xCLC/Hu6fIHBDH19eG1Ath9VpuAOkttRRoxu2VqijJZrGqaS+0o+OX\nrLi5HMtZbZjgQB4mc1g3ZDKX/gynxr+CDNaqNOqxuog33Tl5OcOk9DrR3MInaE7F\nyQFuH9mzF64AqOoTf7Tr/eAIz5XVt8K51nk+fSybEfKVwtMCAwEAAaOCAaEwggGd\nMA4GA1UdDwEB/wQEAwIFoDAMBgNVHRMBAf8EAjAAMB0GA1UdDgQWBBQU/9dYyqMz\nv9rOMwPZcoIRMDAQCjAfBgNVHSMEGDAWgBTkQGTiCkLCmv/Awxdz5TAVRmyFfDCB\njQYIKwYBBQUHAQEEgYAwfjB8BggrBgEFBQcwAoZwaHR0cDovL3ByaXZhdGVjYS1j\nb250ZW50LTYxYWEyYzA5LTAwMDAtMjJjMi05ZjYyLWQ0ZjU0N2Y4MDIwMC5zdG9y\nYWdlLmdvb2dsZWFwaXMuY29tLzQxNGU4ZTJjZjU2ZWEyYzQxNmM0L2NhLmNydDAo\nBgNVHREBAf8EHjAcghpnaGUucHJvY3Rvci1wcml2YXRlLWNhLmNvbTCBggYDVR0f\nBHsweTB3oHWgc4ZxaHR0cDovL3ByaXZhdGVjYS1jb250ZW50LTYxYWEyYzA5LTAw\nMDAtMjJjMi05ZjYyLWQ0ZjU0N2Y4MDIwMC5zdG9yYWdlLmdvb2dsZWFwaXMuY29t\nLzQxNGU4ZTJjZjU2ZWEyYzQxNmM0L2NybC5jcmwwDQYJKoZIhvcNAQELBQADggEB\nABo6BQLEZZ+YNiDuv2sRvcxSopQQb7fZjqIA9XOA35pNSKay2SncODnNvfsdRnOp\ncoy25sQSIzWyJ9zWl8DZ6evoOu5csZ2PoFqx5LsIq37w+ZcwD6DM8Zm7JqASxmxx\nGqTF0nHC4Aw8q8aJBeRD3PsSkfN5Q3DP3nTDnLyd0l+yPIkHUbZMoiFHX3BkhCng\nG96mYy/y3t16ghfV9lZkXpD/JK5aiN0bTHCDRc69owgfYiAcAqzBJ9gfZ90MBgzv\ngTTQel5dHg49SYXfnUpTy0HdQLEcoggOF8Q8V+xKdKa6eVbrvjJrkEJmvIQI5iCR\nhNvKR25mx8JUopqEXmONmqU=\n-----END CERTIFICATE-----\n\n-----BEGIN CERTIFICATE-----\nMIIDSDCCAjCgAwIBAgITMwWN+62nLcgyLa7p+jD1K90g6TANBgkqhkiG9w0BAQsF\nADAsMRQwEgYDVQQKEwtQcm9jdG9yIEVuZzEUMBIGA1UEAxMLUHJvY3Rvci1lbmcw\nHhcNMjEwNzEyMTM1OTQ0WhcNMzEwNzEwMTM1OTQzWjAsMRQwEgYDVQQKEwtQcm9j\ndG9yIEVuZzEUMBIGA1UEAxMLUHJvY3Rvci1lbmcwggEiMA0GCSqGSIb3DQEBAQUA\nA4IBDwAwggEKAoIBAQCYqJP5Qt90jIbld2dtuUV/zIkBFsTe4fapJfhBji03xBpN\nO1Yxj/jPSZ67Kdeoy0lEwvc2hL5FQGhIjLMR0mzOyN4fk/DZiA/4tAVi7hJyqpUC\n71JSwp7MwXL1b26CSE1MhcoCqA/E4iZxfJfF/ef4lhmC24UEmu8FEbldoy+6OysB\nRu7dGDwicW5F9h7eSkpGAsCRdJHh65iUx/IH0C4Ux2UZRDZdj6wVbuVu9tb938xF\nyRuVClONoLSn/lwdzeV7hQmBSm8qmfgbNPbYRaNLz3hOpsT+27aDQp2/pxue8hFJ\nd7We3+Lr5O4IL45PBwhVEAiFZqde6d4qViNEB2qTAgMBAAGjYzBhMA4GA1UdDwEB\n/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTkQGTiCkLCmv/Awxdz\n5TAVRmyFfDAfBgNVHSMEGDAWgBTkQGTiCkLCmv/Awxdz5TAVRmyFfDANBgkqhkiG\n9w0BAQsFAAOCAQEAfy5BJsWdx0oWWi7SFg9MbryWjBVPJl93UqACgG0Cgh813O/x\nlDZQhGO/ZFVhHz/WgooE/HgVNoVJTubKLLzz+zCkOB0wa3GMqJDyFjhFmUtd/3VM\nZh0ZQ+JWYsAiZW4VITj5xEn/d/B3xCFWGC1vhvhptEJ8Fo2cE1yM2pzk08NqFWoY\n4FaH0sbxWgyCKwTmtcYDbnx4FYuddryGCIxbYizqUK1dr4DGKeHonhm/d234Ew3x\n3vIBPoHMOfBec/coP1xAf5o+F+MRMO/sQ3tTGgyOH18lwsHo9SmXCrmOwVQPKrEw\nm+A+5TjXLmenyaBhqXa0vkAZYJhWdROhWC0VTA==\n-----END CERTIFICATE-----\n" + + service_directory_config { + service = "projects/devconnect-terraform-creds/locations/us-central1/namespaces/my-namespace/services/terraform-github" + } + } + +} +`, context) +} + + +func TestAccDeveloperConnectConnection_developerConnectConnectionGitlabUpdate(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + Steps: []resource.TestStep{ + { + Config: testAccDeveloperConnectConnection_Gitlab(context), + }, + { + ResourceName: "google_developer_connect_connection.my-connection", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"connection_id", "location", "terraform_labels"}, + }, + { + Config: testAccDeveloperConnectConnection_GitlabUpdate(context), + }, + { + ResourceName: "google_developer_connect_connection.my-connection", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"connection_id", "location", "terraform_labels"}, + }, + }, + }) +} + + +func testAccDeveloperConnectConnection_Gitlab(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_developer_connect_connection" "my-connection" { + location = "us-central1" + connection_id = "tf-test-tf-test-connection%{random_suffix}" + + gitlab_config { + webhook_secret_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-webhook/versions/latest" + + read_authorizer_credential { + user_token_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-read-cred/versions/latest" + } + + authorizer_credential { + user_token_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-auth-cred/versions/latest" + } + } +} +`, context) +} + + +func testAccDeveloperConnectConnection_GitlabUpdate(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_developer_connect_connection" "my-connection" { + location = "us-central1" + connection_id = "tf-test-tf-test-connection%{random_suffix}" + annotations = {} + labels = {} + + crypto_key_config { + key_reference = "projects/devconnect-terraform-creds/locations/us-central1/keyRings/tf-keyring/cryptoKeys/tf-crypto-key" + } + + gitlab_config { + webhook_secret_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-webhook/versions/latest" + + read_authorizer_credential { + user_token_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-read-cred-update/versions/latest" + } + + authorizer_credential { + user_token_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-auth-cred/versions/latest" + } + } +} +`, context) +} + +func TestAccDeveloperConnectConnection_GlePrivConnection(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + Steps: []resource.TestStep{ + { + Config: testAccDeveloperConnectConnection_GlePrivConnection(context), + }, + { + ResourceName: "google_developer_connect_connection.my-connection", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"connection_id", "location", "terraform_labels"}, + }, + }, + }) +} + + +func testAccDeveloperConnectConnection_GlePrivConnection(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_developer_connect_connection" "my-connection" { + location = "us-central1" + connection_id = "tf-test-tf-test-connection%{random_suffix}" + annotations = {} + labels = {} + + gitlab_enterprise_config { + host_uri = "https://gle-us.gle-us-private.com" + + webhook_secret_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-enterprise-webhook/versions/latest" + + read_authorizer_credential { + user_token_secret_version = "projects/devconnect-terraform-creds/secrets/gle-private-read-token/versions/latest" + } + + authorizer_credential { + user_token_secret_version = "projects/devconnect-terraform-creds/secrets/gle-private-api/versions/latest" + } + + ssl_ca_certificate = "-----BEGIN CERTIFICATE-----\nMIIFbjCCA1agAwIBAgIUH+nsWsqagMW9Ld8E9J71yPLPpD8wDQYJKoZIhvcNAQEL\nBQAwJDEiMCAGA1UEAwwZZ2xlLXVzLmdsZS11cy1wcml2YXRlLmNvbTAeFw0yNDEw\nMzExNjQzMjBaFw0zNDEwMjkxNjQzMjBaMCQxIjAgBgNVBAMMGWdsZS11cy5nbGUt\ndXMtcHJpdmF0ZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDL\n+dUU8MHo+Eskx4SSnI1thRIiljgsyJSzSOplaD4lqahFnrG0cB0ovKpyRL4A+0wM\nzVW7W1Pfi8DiEOxxfNo7pEj+0zrzJHHqnzW9kApIlRmO1TBBJ7i9HaVamJ1Od01b\n2WI/pnKFEvNfLQSDQBulhkHZ2McyauDhb1DxefKnVX8ac6qhxtc4IzrezIQuJ18N\nDPtNLUDD4rtU4mIX4lx1yBIplrgypAo1HDbJOwW8OR76MtjAY7ek3K6UCyduQtwy\nmfZ23b3Eg69W10HVMVTy6m5NaGKi/TWy2MJ71hKUQ1+tWIPH5SL7FzYPKL4XXw5W\np61LhIiBAd2tgD41b2cQxhUbVifc1qHtnwNz/tE77M9ySH37rEUIlExzr3D3JV+f\nXjXEXUr9as8GRnS5zhD/opKe7wKbwpYMHhylK1h6XH/sBO7dBajf5xCvpZZBDzrK\nkpTqwHspT7p40WF9d8odjEk/xZKn5LdcDG2I+4U7SVS5e8ud41HUQxJwQx56lKfh\n2WB+zs7nSyMfspTj4doY1OADEC1VQCyGrwlbclKTKmUWrgwQdm38KxDzW5Juyjmm\nzvfsWIlSMdnes0qVVo38N3Jz8/MHCLD79R2veWgA2fbqS3+4h2dRkR7htjaVlJMJ\nt7SwFiG39ic3OZpo+wTkaHlG4CBnbFDueUsOW2wEpQIDAQABo4GXMIGUMB0GA1Ud\nDgQWBBTExgzH2gz9+rJHvlTFPO0AvG88azAfBgNVHSMEGDAWgBTExgzH2gz9+rJH\nvlTFPO0AvG88azAPBgNVHRMBAf8EBTADAQH/MEEGA1UdEQQ6MDiCGWdsZS11cy5n\nbGUtdXMtcHJpdmF0ZS5jb22CGyouZ2xlLXVzLmdsZS11cy1wcml2YXRlLmNvbTAN\nBgkqhkiG9w0BAQsFAAOCAgEAjkd1ZNoekoWrmozD+Ta1OM0zWhv04eqhP8aYzhbd\nXRS+GyF6ifMwfWg9HogkH22ZPT5GszaL5DacSyOUqZgJ905Q6g1EFPnaKmFVHHeC\nzZAhg5oedAzcakZpYwZDSiLuPgsQfwgRnqWIYR8JcIM5bKRZNGyOg8eZ8cKu23A2\nPavL4B3Ra1l93KllKm21rigIhLPIPLoEyxEg9c9oTJF92r0+aRdf2Ln853260Fqf\ncEUWoXhqMGvDv/YEbqDjGQ/Kh7ZWdlIWhcKFOA0gluF7oExjt/MgSitukgg3aaic\n/eXXOrZDNYH7Ve610NUuNlhub1M47Tp7EgjUJVWlsKK84T8ZcZq7Hn4BzioUr95d\nHao6u19HWA/ISM8bwzHaYxscFI4u6phEL0HJzLf4EysEmS0rAnLxyol0apNx6znR\nhXsqxnSexKhXoLqnK1Vuhcg8DsvobXHqg68EGZ7BZ3ycPYaHSWU8Xh3l1gtYkcQ6\nzxXsKIijlpVKuYJvGA3EOMoZu6+2MYF8Tgp3N4sKMvPhqBhsmgxOYF5OkAbGlsUP\nyCYWFDBFHmbhvUu5JpbKuID2CPkBi16EetemvMQ9PGlLq/0fO/BBNkn6TYn9Kvg8\nAyvuONz54uFEAIKPCcZIosa3ml+5/pt+tBhtVzHA6vMxn18IYaNpuTwSxi/+M10K\nRjw=\n-----END CERTIFICATE-----\n" + + + service_directory_config { + service = "projects/devconnect-terraform-creds/locations/us-central1/namespaces/my-namespace/services/terraform-gle" + } + } + +} +`, context) +} + + +func TestAccDeveloperConnectConnection_developerConnectConnectionGitlabEnterpriseUpdate(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + Steps: []resource.TestStep{ + { + Config: testAccDeveloperConnectConnection_GitlabEnterprise(context), + }, + { + ResourceName: "google_developer_connect_connection.my-connection", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"connection_id", "location", "terraform_labels"}, + }, + { + Config: testAccDeveloperConnectConnection_GitlabEnterpriseUpdate(context), + }, + { + ResourceName: "google_developer_connect_connection.my-connection", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"connection_id", "location", "terraform_labels"}, + }, + }, + }) +} + + +func testAccDeveloperConnectConnection_GitlabEnterprise(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_developer_connect_connection" "my-connection" { + location = "us-central1" + connection_id = "tf-test-tf-test-connection%{random_suffix}" + + gitlab_enterprise_config { + host_uri = "https://gle-us-central1.gcb-test.com" + + webhook_secret_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-enterprise-webhook/versions/latest" + + read_authorizer_credential { + user_token_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-enterprise-read-cred/versions/latest" + } + + authorizer_credential { + user_token_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-enterprise-auth-cred/versions/latest" + } + } +} +`, context) +} + + +func testAccDeveloperConnectConnection_GitlabEnterpriseUpdate(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_developer_connect_connection" "my-connection" { + location = "us-central1" + connection_id = "tf-test-tf-test-connection%{random_suffix}" + annotations = {} + labels = {} + + crypto_key_config { + key_reference = "projects/devconnect-terraform-creds/locations/us-central1/keyRings/tf-keyring/cryptoKeys/tf-crypto-key" + } + + gitlab_enterprise_config { + host_uri = "https://gle-us-central1.gcb-test.com" + + webhook_secret_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-enterprise-webhook/versions/latest" + + read_authorizer_credential { + user_token_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-enterprise-read-cred-update/versions/latest" + } + + authorizer_credential { + user_token_secret_version = "projects/devconnect-terraform-creds/secrets/gitlab-enterprise-auth-cred/versions/latest" + } + } +} +`, context) +} + + +func TestAccDeveloperConnectConnection_developerConnectConnectionBitbucketCloudUpdate(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + Steps: []resource.TestStep{ + { + Config: testAccDeveloperConnectConnection_BitbucketCloud(context), + }, + { + ResourceName: "google_developer_connect_connection.my-connection", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"connection_id", "location", "terraform_labels"}, + }, + { + Config: testAccDeveloperConnectConnection_BitbucketCloud(context), + }, + { + ResourceName: "google_developer_connect_connection.my-connection", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"connection_id", "location", "terraform_labels"}, + }, + }, + }) +} + + +func testAccDeveloperConnectConnection_BitbucketCloud(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_developer_connect_connection" "my-connection" { + location = "us-central1" + connection_id = "tf-test-tf-test-connection%{random_suffix}" + + 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" + } + } +} +`, context) +} + + +func testAccDeveloperConnectConnection_BitbucketCloudUpdate(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_developer_connect_connection" "my-connection" { + location = "us-central1" + connection_id = "tf-test-tf-test-connection%{random_suffix}" + annotations = {} + labels = {} + + crypto_key_config { + key_reference = "projects/devconnect-terraform-creds/locations/us-central1/keyRings/tf-keyring/cryptoKeys/tf-crypto-key" + } + + 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-update/versions/latest" + } + + authorizer_credential { + user_token_secret_version = "projects/devconnect-terraform-creds/secrets/bbc-auth-token/versions/latest" + } + } +} +`, context) +} + + +func TestAccDeveloperConnectConnection_developerConnectConnectionBitbucketDataCenterUpdate(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + Steps: []resource.TestStep{ + { + Config: testAccDeveloperConnectConnection_BitbucketDataCenter(context), + }, + { + ResourceName: "google_developer_connect_connection.my-connection", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"connection_id", "location", "terraform_labels"}, + }, + { + Config: testAccDeveloperConnectConnection_BitbucketDataCenterUpdate(context), + }, + { + ResourceName: "google_developer_connect_connection.my-connection", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"connection_id", "location", "terraform_labels"}, + }, + }, + }) +} + + +func testAccDeveloperConnectConnection_BitbucketDataCenter(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_developer_connect_connection" "my-connection" { + location = "us-central1" + connection_id = "tf-test-tf-test-connection%{random_suffix}" + + 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" + } + } +} +`, context) +} + + +func testAccDeveloperConnectConnection_BitbucketDataCenterUpdate(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_developer_connect_connection" "my-connection" { + location = "us-central1" + connection_id = "tf-test-tf-test-connection%{random_suffix}" + annotations = {} + labels = {} + + crypto_key_config { + key_reference = "projects/devconnect-terraform-creds/locations/us-central1/keyRings/tf-keyring/cryptoKeys/tf-crypto-key" + } + + 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-update/versions/latest" + } + + authorizer_credential { + user_token_secret_version = "projects/devconnect-terraform-creds/secrets/bbdc-auth-token/versions/latest" + } + } +} +`, context) +} + +func TestAccDeveloperConnectConnection_BbdcPrivConnection(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + Steps: []resource.TestStep{ + { + Config: testAccDeveloperConnectConnection_BbdcPrivConnection(context), + }, + { + ResourceName: "google_developer_connect_connection.my-connection", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"connection_id", "location", "terraform_labels"}, + }, + }, + }) +} + + +func testAccDeveloperConnectConnection_BbdcPrivConnection(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_developer_connect_connection" "my-connection" { + location = "us-central1" + connection_id = "tf-test-tf-test-connection%{random_suffix}" + annotations = {} + labels = {} + + bitbucket_data_center_config { + host_uri = "https://private-bitbucket.proctor-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-priv-read-token/versions/latest" + } + + authorizer_credential { + user_token_secret_version = "projects/devconnect-terraform-creds/secrets/bbdc-priv-auth-token/versions/latest" + } + + ssl_ca_certificate = "-----BEGIN CERTIFICATE-----\nMIIDjDCCAnSgAwIBAgIUBh5+3oeT1vmUSS5rSNaFfy6igSAwDQYJKoZIhvcNAQEL\nBQAwVzELMAkGA1UEBhMCVVMxGzAZBgNVBAoMEkdvb2dsZSBDbG91ZCBCdWlsZDEr\nMCkGA1UEAwwicHJpdmF0ZS1iaXRidWNrZXQucHJvY3Rvci10ZXN0LmNvbTAeFw0y\nMzEyMTIyMzI5NTlaFw0yNDEyMTEyMzI5NTlaMFcxCzAJBgNVBAYTAlVTMRswGQYD\nVQQKDBJHb29nbGUgQ2xvdWQgQnVpbGQxKzApBgNVBAMMInByaXZhdGUtYml0YnVj\na2V0LnByb2N0b3ItdGVzdC5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK\nAoIBAQCNfMx4ImGD4imZR64RbmRtpUNmypDokx2/S9kgobmyNvBWeSgRVhOGHGbU\nUgyvENcEg803K8unwF2jF6sdGrocRnIdPpr2tUoViOM2Ss6ds+TD8a2kqBA6+hmQ\nOMJiEIirpGT3Mw1pYTpuLisfIeeuuYssoS5k18kFLZ+Mk6MUSAHCgC8EowUZLGBZ\nagh9OhrjpMSXyidv+2d7FKTh/k3BWffVkDXehjvWjcr47hSvQwqW5m773ewCq0uD\nwxUgO6MAAAxLJz15cjhfvk4ishgSqcp49IZrx+xsNCLbHjPVyGkrL2OhgFaGsQS/\nq6GkXYfJ1sJYrf5Xm1EXbZlQZzJPAgMBAAGjUDBOMC0GA1UdEQQmMCSCInByaXZh\ndGUtYml0YnVja2V0LnByb2N0b3ItdGVzdC5jb20wHQYDVR0OBBYEFISmuuTpHKMB\n+m1h62gEqg1ovC86MA0GCSqGSIb3DQEBCwUAA4IBAQAwIwR6pIum9EZyLtC438Q1\nEgH3SKqbdyMFCkFSBvr4WfFU6ja1pn5ZxzJWt5TRFlI9GMy7BupQrxJGebOiFuUC\noNJpc4QDt9a0/GKh48DGF7uKo9XK33p0v1ahq3ewNT/CUnHewQNX7aXXP1/rL+br\nZPA20XWURUTviMik7DdhaXKQv76K9coI3H74heeBUp+OHKgUkqA3D1QIGNRGOKos\n4z6MyBWVpMUIeJQGtIQBd9CY1hBN231iG1+hdOlOMwgyNVK2GS738r+HbngFo9v4\nh2I1HMUHVcHiPQLqwZ2/OTmTmF1aWCUbhnAvoisu20rHVcGnVIOqMrHYFzdGr3ZQ\n-----END CERTIFICATE-----\n" + + service_directory_config { + service = "projects/devconnect-terraform-creds/locations/us-central1/namespaces/my-namespace/services/terraform-bbdc" + } + } +} +`, context) +}