Skip to main content

tharsis_vcs_provider

Defines and manages a VCS provider.

Example Usage​

resource "tharsis_vcs_provider" "this" {
name = "my-vcs-provider"
description = "GitLab VCS provider."
type = "gitlab"
group_id = tharsis_group.top_level.id
url = "https://gitlab.com"
oauth_client_id = "<oauth_client_id>"
oauth_client_secret = "<oauth_client_secret>"
auto_create_webhooks = true
}

Behavior​

  • The supported types are github and gitlab.
  • A VCS provider is created within a group and inherited by its child groups.
  • url is optional. If omitted, the public API URL for the provider type is used.
  • url and auto_create_webhooks cannot be changed after creation.
  • If auto_create_webhooks is false, webhooks must be configured manually in the repository.

OAuth​

The OAuth client ID and secret are never displayed by Tharsis. After the provider is created, complete the OAuth flow using the oauth_authorization_url attribute.

Deletion​

Deleting a VCS provider is irreversible and severs the connection to the OAuth application.

Schema​

Required​

  • auto_create_webhooks (Boolean) Whether to automatically create webhooks.
  • description (String) A description of the VCS provider.
  • name (String) The name of the VCS provider.
  • oauth_client_id (String) A description of the VCS provider.
  • oauth_client_secret (String) A description of the VCS provider.
  • type (String) The type of this VCS provider: gitlab, github, etc.

Optional​

  • group_id (String) The ID or TRN of the parent group.
  • group_path (String, Deprecated) The path of the group where this VCS provider resides.
  • url (String) API URL for this VCS provider.

Read-Only​

  • created_by (String) The email address of the user or account that created this VCS provider.
  • id (String) String identifier of the VCS provider.
  • last_updated (String) Timestamp when this VCS provider was most recently updated by Terraform.
  • oauth_authorization_url (String) URL to use to complete OAuth flow for any links to this VCS provider.
  • resource_path (String, Deprecated) The path within the Tharsis group hierarchy to this VCS provider.

Import​

Import is supported using the following syntax:

In Terraform v1.5.0 and later, the import block can be used with the id attribute, for example:

# A VCS provider can be imported by its TRN, which is "trn:vcs_provider:"
# followed by the group path and the provider name.
import {
to = tharsis_vcs_provider.this
id = "trn:vcs_provider:my-group/my-vcs-provider"
}

# The provider's ID also works as the id, shown by the "id" attribute or in the
# Tharsis UI.
#
# Note: oauth_client_id and oauth_client_secret are write-only and cannot be read
# back from Tharsis, and oauth_authorization_url is only returned when the
# provider is first created. After importing, set the two OAuth credentials in
# your configuration to match the values the provider was created with, or the
# next apply will update them.