-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[upstream:0fff276074064e3f5faaebf947e8668693026279] Signed-off-by: Modular Magician <[email protected]>
- Loading branch information
1 parent
5bce892
commit 36df02e
Showing
6 changed files
with
519 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
```release-note:new-resource | ||
`google_developer_connect_connection` | ||
``` | ||
```release-note:new-resource | ||
`google_developer_connect_git_repository_link` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
google/services/developerconnect/resource_developer_connect_connection_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
package developerconnect_test |
296 changes: 296 additions & 0 deletions
296
website/docs/r/developer_connect_connection.html.markdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,296 @@ | ||
--- | ||
# ---------------------------------------------------------------------------- | ||
# | ||
# *** AUTO GENERATED CODE *** Type: MMv1 *** | ||
# | ||
# ---------------------------------------------------------------------------- | ||
# | ||
# This file is automatically generated by Magic Modules and manual | ||
# changes will be clobbered when the file is regenerated. | ||
# | ||
# Please read more about how to change this file in | ||
# .github/CONTRIBUTING.md. | ||
# | ||
# ---------------------------------------------------------------------------- | ||
subcategory: "Developer Connect" | ||
description: |- | ||
A connection to a GitHub App installation. | ||
--- | ||
|
||
# google_developer_connect_connection | ||
|
||
A connection to a GitHub App installation. | ||
|
||
~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider. | ||
See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources. | ||
|
||
|
||
<div class = "oics-button" style="float: right; margin: 0 0 -15px"> | ||
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md&cloudshell_working_dir=developer_connect_connection_basic&open_in_editor=main.tf" target="_blank"> | ||
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;"> | ||
</a> | ||
</div> | ||
## Example Usage - Developer Connect Connection Basic | ||
|
||
|
||
```hcl | ||
resource "google_developer_connect_connection" "my-connection" { | ||
provider = google-beta | ||
location = "us-central1" | ||
connection_id = "tf-test-connection" | ||
github_config { | ||
github_app = "DEVELOPER_CONNECT" | ||
authorizer_credential { | ||
oauth_token_secret_version = "projects/devconnect-terraform-creds/secrets/tf-test-do-not-change-github-oauthtoken-e0b9e7/versions/1" | ||
} | ||
} | ||
} | ||
``` | ||
## Example Usage - Developer Connect Connection Github Doc | ||
|
||
|
||
```hcl | ||
resource "google_secret_manager_secret" "github-token-secret" { | ||
provider = google-beta | ||
secret_id = "github-token-secret" | ||
replication { | ||
auto {} | ||
} | ||
} | ||
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") | ||
} | ||
data "google_iam_policy" "p4sa-secretAccessor" { | ||
binding { | ||
role = "roles/secretmanager.secretAccessor" | ||
// Here, 123456789 is the Google Cloud project number for the project that contains the connection. | ||
members = ["serviceAccount:[email protected]"] | ||
} | ||
} | ||
resource "google_secret_manager_secret_iam_policy" "policy" { | ||
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" | ||
github_config { | ||
github_app = "DEVELOPER_CONNECT" | ||
app_installation_id = 123123 | ||
authorizer_credential { | ||
oauth_token_secret_version = google_secret_manager_secret_version.github-token-secret-version.id | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
|
||
* `location` - | ||
(Required) | ||
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`. | ||
|
||
* `connection_id` - | ||
(Required) | ||
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 | ||
|
||
|
||
- - - | ||
|
||
|
||
* `github_config` - | ||
(Optional) | ||
Configuration for connections to github.com. | ||
Structure is [documented below](#nested_github_config). | ||
|
||
* `labels` - | ||
(Optional) | ||
Optional. Labels as key value pairs | ||
**Note**: This field is non-authoritative, and will only manage the labels present in your configuration. | ||
Please refer to the field `effective_labels` for all of the labels present on the resource. | ||
|
||
* `disabled` - | ||
(Optional) | ||
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. | ||
|
||
* `annotations` - | ||
(Optional) | ||
Optional. Allows clients to store small amounts of arbitrary data. | ||
**Note**: This field is non-authoritative, and will only manage the annotations present in your configuration. | ||
Please refer to the field `effective_annotations` for all of the annotations present on the resource. | ||
|
||
* `etag` - | ||
(Optional) | ||
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. | ||
|
||
* `project` - (Optional) The ID of the project in which the resource belongs. | ||
If it is not provided, the provider project is used. | ||
|
||
|
||
<a name="nested_github_config"></a>The `github_config` block supports: | ||
|
||
* `github_app` - | ||
(Required) | ||
Required. Immutable. The GitHub Application that was installed to the GitHub user or | ||
organization. | ||
Possible values: | ||
GIT_HUB_APP_UNSPECIFIED | ||
DEVELOPER_CONNECT | ||
FIREBASE | ||
|
||
* `authorizer_credential` - | ||
(Optional) | ||
Represents an OAuth token of the account that authorized the Connection, | ||
and associated metadata. | ||
Structure is [documented below](#nested_authorizer_credential). | ||
|
||
* `app_installation_id` - | ||
(Optional) | ||
Optional. GitHub App installation id. | ||
|
||
* `installation_uri` - | ||
(Output) | ||
Output only. The URI to navigate to in order to manage the installation associated | ||
with this GitHubConfig. | ||
|
||
|
||
<a name="nested_authorizer_credential"></a>The `authorizer_credential` block supports: | ||
|
||
* `oauth_token_secret_version` - | ||
(Required) | ||
Required. A SecretManager resource containing the OAuth token that authorizes | ||
the connection. Format: `projects/*/secrets/*/versions/*`. | ||
|
||
* `username` - | ||
(Output) | ||
Output only. The username associated with this token. | ||
|
||
## Attributes Reference | ||
|
||
In addition to the arguments listed above, the following computed attributes are exported: | ||
|
||
* `id` - an identifier for the resource with format `projects/{{project}}/locations/{{location}}/connections/{{connection_id}}` | ||
|
||
* `name` - | ||
Identifier. The resource name of the connection, in the format | ||
`projects/{project}/locations/{location}/connections/{connection_id}`. | ||
|
||
* `create_time` - | ||
Output only. [Output only] Create timestamp | ||
|
||
* `update_time` - | ||
Output only. [Output only] Update timestamp | ||
|
||
* `delete_time` - | ||
Output only. [Output only] Delete timestamp | ||
|
||
* `installation_state` - | ||
Describes stage and necessary actions to be taken by the | ||
user to complete the installation. Used for GitHub and GitHub Enterprise | ||
based connections. | ||
Structure is [documented below](#nested_installation_state). | ||
|
||
* `reconciling` - | ||
Output only. Set to true when the connection is being set up or updated in the | ||
background. | ||
|
||
* `uid` - | ||
Output only. A system-assigned unique identifier for a the GitRepositoryLink. | ||
|
||
* `terraform_labels` - | ||
The combination of labels configured directly on the resource | ||
and default labels configured on the provider. | ||
|
||
* `effective_labels` - | ||
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services. | ||
|
||
* `effective_annotations` - | ||
All of annotations (key/value pairs) present on the resource in GCP, including the annotations configured through Terraform, other clients and services. | ||
|
||
|
||
<a name="nested_installation_state"></a>The `installation_state` block contains: | ||
|
||
* `stage` - | ||
(Output) | ||
Output only. Current step of the installation process. | ||
Possible values: | ||
STAGE_UNSPECIFIED | ||
PENDING_CREATE_APP | ||
PENDING_USER_OAUTH | ||
PENDING_INSTALL_APP | ||
COMPLETE | ||
|
||
* `message` - | ||
(Optional) | ||
Output only. Message of what the user should do next to continue the installation. | ||
Empty string if the installation is already complete. | ||
|
||
* `action_uri` - | ||
(Optional) | ||
Output only. Link to follow for next action. Empty string if the installation is already | ||
complete. | ||
|
||
## Timeouts | ||
|
||
This resource provides the following | ||
[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options: | ||
|
||
- `create` - Default is 20 minutes. | ||
- `update` - Default is 20 minutes. | ||
- `delete` - Default is 20 minutes. | ||
|
||
## Import | ||
|
||
|
||
Connection can be imported using any of these accepted formats: | ||
|
||
* `projects/{{project}}/locations/{{location}}/connections/{{connection_id}}` | ||
* `{{project}}/{{location}}/{{connection_id}}` | ||
* `{{location}}/{{connection_id}}` | ||
|
||
|
||
In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Connection using one of the formats above. For example: | ||
|
||
```tf | ||
import { | ||
id = "projects/{{project}}/locations/{{location}}/connections/{{connection_id}}" | ||
to = google_developer_connect_connection.default | ||
} | ||
``` | ||
|
||
When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), Connection can be imported using one of the formats above. For example: | ||
|
||
``` | ||
$ terraform import google_developer_connect_connection.default projects/{{project}}/locations/{{location}}/connections/{{connection_id}} | ||
$ terraform import google_developer_connect_connection.default {{project}}/{{location}}/{{connection_id}} | ||
$ terraform import google_developer_connect_connection.default {{location}}/{{connection_id}} | ||
``` | ||
|
||
## User Project Overrides | ||
|
||
This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override). |
Oops, something went wrong.