Skip to content

Commit 51f955e

Browse files
authored
Merge pull request #1303 from hashicorp/zainq11/bitbucket-data-center
Add Bitbucket Data Center support
2 parents 9b21183 + 04983f9 commit 51f955e

22 files changed

+107
-101
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## Unreleased
2+
3+
ENHANCEMENTS:
4+
* `r/tfe_oauth_client`: Add Bitbucket Data Center support with the `bitbucket_data_center` option for `service_provider` by @zainq11 [#1303](https://github.com/hashicorp/terraform-provider-tfe/pull/1304)
5+
16
## v0.55.0
27

38
FEATURES:

internal/provider/data_source_oauth_client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ func dataSourceTFEOAuthClient() *schema.Resource {
4545
string(tfe.ServiceProviderAzureDevOpsServer),
4646
string(tfe.ServiceProviderAzureDevOpsServices),
4747
string(tfe.ServiceProviderBitbucket),
48+
string(tfe.ServiceProviderBitbucketDataCenter),
4849
string(tfe.ServiceProviderBitbucketServer),
4950
string(tfe.ServiceProviderBitbucketServerLegacy),
5051
string(tfe.ServiceProviderGithub),

internal/provider/resource_tfe_oauth_client.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func resourceTFEOAuthClient() *schema.Resource {
8484
Type: schema.TypeString,
8585
ForceNew: true,
8686
Optional: true,
87-
// this field is only for BitBucket Server, and requires these other
87+
// this field is only for BitBucket Data Center, and requires these other
8888
RequiredWith: []string{"secret", "key"},
8989
},
9090

@@ -98,6 +98,7 @@ func resourceTFEOAuthClient() *schema.Resource {
9898
string(tfe.ServiceProviderAzureDevOpsServices),
9999
string(tfe.ServiceProviderBitbucket),
100100
string(tfe.ServiceProviderBitbucketServer),
101+
string(tfe.ServiceProviderBitbucketDataCenter),
101102
string(tfe.ServiceProviderGithub),
102103
string(tfe.ServiceProviderGithubEE),
103104
string(tfe.ServiceProviderGitlab),
@@ -157,7 +158,7 @@ func resourceTFEOAuthClientCreate(d *schema.ResourceData, meta interface{}) erro
157158
if serviceProvider == tfe.ServiceProviderAzureDevOpsServer {
158159
options.PrivateKey = tfe.String(privateKey)
159160
}
160-
if serviceProvider == tfe.ServiceProviderBitbucketServer {
161+
if serviceProvider == tfe.ServiceProviderBitbucketServer || serviceProvider == tfe.ServiceProviderBitbucketDataCenter {
161162
options.RSAPublicKey = tfe.String(rsaPublicKey)
162163
options.Secret = tfe.String(secret)
163164
}

internal/provider/resource_tfe_oauth_client_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ func TestAccTFEOAuthClient_rsaKeys(t *testing.T) {
9393
testAccCheckTFEOAuthClientExists("tfe_oauth_client.foobar", oc),
9494
testAccCheckTFEOAuthClientAttributes(oc),
9595
resource.TestCheckResourceAttr(
96-
"tfe_oauth_client.foobar", "api_url", "https://bbs.example.com"),
96+
"tfe_oauth_client.foobar", "api_url", "https://bbdc.example.com"),
9797
resource.TestCheckResourceAttr(
98-
"tfe_oauth_client.foobar", "http_url", "https://bbs.example.com"),
98+
"tfe_oauth_client.foobar", "http_url", "https://bbdc.example.com"),
9999
resource.TestCheckResourceAttr(
100-
"tfe_oauth_client.foobar", "service_provider", "bitbucket_server"),
100+
"tfe_oauth_client.foobar", "service_provider", "bitbucket_data_center"),
101101
resource.TestCheckResourceAttr(
102102
"tfe_oauth_client.foobar", "key", "1e4843e138b0d44911a50d15e0f7cee4"),
103103
resource.TestCheckResourceAttr(
@@ -200,9 +200,9 @@ resource "tfe_organization" "foobar" {
200200
resource "tfe_oauth_client" "foobar" {
201201
organization = tfe_organization.foobar.id
202202
name = "foobar_oauth"
203-
api_url = "https://bbs.example.com"
204-
http_url = "https://bbs.example.com"
205-
service_provider = "bitbucket_server"
203+
api_url = "https://bbdc.example.com"
204+
http_url = "https://bbdc.example.com"
205+
service_provider = "bitbucket_data_center"
206206
key = "1e4843e138b0d44911a50d15e0f7cee4"
207207
secret = <<EOT
208208
-----BEGIN RSA PRIVATE KEY-----

website/docs/cdktf/csharp/d/oauth_client.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ be set.
8181
* `OauthClientId` - (Optional) ID of the OAuth client.
8282
* `Organization` - (Optional) The name of the organization in which to search.
8383
* `ServiceProvider` - (Optional) The API identifier of the OAuth service provider. If set,
84-
must be one of: `AdoServer`, `AdoServices`, `BitbucketHosted`, `BitbucketServer`,
84+
must be one of: `AdoServer`, `AdoServices`,`BitbucketDataCenter`, `BitbucketHosted`, `BitbucketServer`(deprecated),
8585
`Github`, `GithubEnterprise`, `GitlabHosted`, `GitlabCommunityEdition`, or
8686
`GitlabEnterpriseEdition`.
8787

website/docs/cdktf/csharp/r/oauth_client.html.markdown

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ class MyConvertedCode : TerraformStack
7070
}
7171
```
7272

73-
#### BitBucket Server Usage
73+
#### BitBucket Data Center Usage
7474

75-
See [documentation for HCP Terraform and Terraform Enterprise setup](https://developer.hashicorp.com/terraform/cloud-docs/vcs/bitbucket-server).
75+
See [documentation for HCP Terraform and Terraform Enterprise setup](https://developer.hashicorp.com/terraform/cloud-docs/vcs/bitbucket-data-center).
7676

77-
When using BitBucket Server, you must use three required fields: `Key`, `Secret`, `RsaPublicKey`.
77+
When using BitBucket Data Center, you must use three required fields: `Key`, `Secret`, `RsaPublicKey`.
7878

7979

8080
```csharp
@@ -88,10 +88,10 @@ class MyConvertedCode : TerraformStack
8888
public MyConvertedCode(Construct scope, string name) : base(scope, name)
8989
{
9090
new OauthClient.OauthClient(this, "test", new OauthClientConfig {
91-
ApiUrl = "https://bbs.example.com",
92-
HttpUrl = "https://bss.example.com",
91+
ApiUrl = "https://bbdc.example.com",
92+
HttpUrl = "https://bbdc.example.com",
9393
Key = "<consumer key>",
94-
Name = "my-bbs-oauth-client",
94+
Name = "my-bbdc-oauth-client",
9595
Organization = "my-org-name",
9696
RsaPublicKey = @"-----BEGIN PUBLIC KEY-----
9797
content
@@ -101,7 +101,7 @@ class MyConvertedCode : TerraformStack
101101
content
102102
-----END RSA PRIVATE KEY-----
103103
",
104-
ServiceProvider = "bitbucket_server"
104+
ServiceProvider = "bitbucket_data_center"
105105
});
106106
}
107107
}
@@ -121,20 +121,20 @@ The following arguments are supported:
121121
* `PrivateKey` - (Required for `AdoServer`) The text of the private key associated with your Azure DevOps Server account
122122
* `Key` - The OAuth Client key can refer to a Consumer Key, Application Key,
123123
or another type of client key for the VCS provider.
124-
* `Secret` - (Required for `BitbucketServer`) The OAuth Client secret is used for BitBucket Server, this secret is the
125-
the text of the SSH private key associated with your BitBucket Server
124+
* `Secret` - (Required for `BitbucketDataCenter`) The OAuth Client secret is used for BitBucket Data Center, this secret is the
125+
the text of the SSH private key associated with your BitBucket Data Center
126126
Application Link.
127-
* `RsaPublicKey` - (Required for `BitbucketServer`) Required for BitBucket
128-
Server in conjunction with the secret. Not used for any other providers. The
129-
text of the SSH public key associated with your BitBucket Server Application
127+
* `RsaPublicKey` - (Required for `BitbucketDataCenter`) Required for BitBucket
128+
Data Center in conjunction with the secret. Not used for any other providers. The
129+
text of the SSH public key associated with your BitBucket Data Center Application
130130
Link.
131131
* `ServiceProvider` - (Required) The VCS provider being connected with. Valid
132-
options are `AdoServer`, `AdoServices`, `BitbucketHosted`, `BitbucketServer`, `Github`, `GithubEnterprise`, `GitlabHosted`,
132+
options are `AdoServer`, `AdoServices`, `BitbucketHosted`, `BitbucketDataCenter`, `BitbucketServer`(deprecated), `Github`, `GithubEnterprise`, `GitlabHosted`,
133133
`GitlabCommunityEdition`, or `GitlabEnterpriseEdition`.
134134

135135
## Attributes Reference
136136

137137
* `Id` - The ID of the OAuth client.
138138
* `OauthTokenId` - The ID of the OAuth token associated with the OAuth client.
139139

140-
<!-- cache-key: cdktf-0.17.0-pre.15 input-0dea494ef76c038939d94b5ae6a0e741e36a87509a350f558cd11d098bf1bde9 -->
140+
<!-- cache-key: cdktf-0.17.0-pre.15 input-0dea494ef76c038939d94b5ae6a0e741e36a87509a350f558cd11d098bf1bde9 -->

website/docs/cdktf/csharp/r/registry_module.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ The `VcsRepo` block supports:
223223
For most VCS providers outside of BitBucket Cloud and Azure DevOps, this will match the `Identifier`
224224
string.
225225
* `Identifier` - (Required) A reference to your VCS repository in the format
226-
`<organization>/<repository>` where `<organization>` and `<repository>` refer to the organization (or project key, for Bitbucket Server)
226+
`<organization>/<repository>` where `<organization>` and `<repository>` refer to the organization (or project key, for Bitbucket Data Center)
227227
and repository in your VCS provider. The format for Azure DevOps is `<ado organization>/<ado project>/_git/<ado repository>`.
228228
* `OauthTokenId` - (Optional) Token ID of the VCS Connection (OAuth Connection Token) to use. This conflicts with `GithubAppInstallationId` and can only be used if `GithubAppInstallationId` is not used.
229229
* `GithubAppInstallationId` - (Optional) The installation id of the Github App. This conflicts with `OauthTokenId` and can only be used if `OauthTokenId` is not used.

website/docs/cdktf/go/d/oauth_client.html.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ be set.
9090
* `OauthClientId` - (Optional) ID of the OAuth client.
9191
* `Organization` - (Optional) The name of the organization in which to search.
9292
* `ServiceProvider` - (Optional) The API identifier of the OAuth service provider. If set,
93-
must be one of: `AdoServer`, `AdoServices`, `BitbucketHosted`, `BitbucketServer`,
93+
must be one of: `AdoServer`, `AdoServices`, `BitbucketDataCenter`, `BitbucketHosted`, `BitbucketServer`(deprecated),
9494
`Github`, `GithubEnterprise`, `GitlabHosted`, `GitlabCommunityEdition`, or
9595
`GitlabEnterpriseEdition`.
9696

@@ -109,4 +109,4 @@ In addition to all arguments above, the following attributes are exported:
109109
* `ServiceProvider` - The API identifier of the OAuth service provider.
110110
* `ServiceProviderDisplayName` - The display name of the OAuth service provider.
111111

112-
<!-- cache-key: cdktf-0.17.0-pre.15 input-59b4bcbbb310e7ee913a245f3c751829442542dbcf1bbb4c87ac286043b69348 -->
112+
<!-- cache-key: cdktf-0.17.0-pre.15 input-59b4bcbbb310e7ee913a245f3c751829442542dbcf1bbb4c87ac286043b69348 -->

website/docs/cdktf/go/r/oauth_client.html.markdown

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ func newMyConvertedCode(scope construct, name *string) *myConvertedCode {
7373
}
7474
```
7575

76-
#### BitBucket Server Usage
76+
#### BitBucket Data Center Usage
7777

78-
See [documentation for HCP Terraform and Terraform Enterprise setup](https://developer.hashicorp.com/terraform/cloud-docs/vcs/bitbucket-server).
78+
See [documentation for HCP Terraform and Terraform Enterprise setup](https://developer.hashicorp.com/terraform/cloud-docs/vcs/bitbucket-data-center).
7979

80-
When using BitBucket Server, you must use three required fields: `Key`, `Secret`, `RsaPublicKey`.
80+
When using BitBucket Data Center, you must use three required fields: `Key`, `Secret`, `RsaPublicKey`.
8181

8282

8383
```go
@@ -94,14 +94,14 @@ func newMyConvertedCode(scope construct, name *string) *myConvertedCode {
9494
this := &myConvertedCode{}
9595
cdktf.NewTerraformStack_Override(this, scope, name)
9696
oauthClient.NewOauthClient(this, jsii.String("test"), &oauthClientConfig{
97-
apiUrl: jsii.String("https://bbs.example.com"),
98-
httpUrl: jsii.String("https://bss.example.com"),
97+
apiUrl: jsii.String("https://bbdc.example.com"),
98+
httpUrl: jsii.String("https://bbdc.example.com"),
9999
key: jsii.String("<consumer key>"),
100-
name: jsii.String("my-bbs-oauth-client"),
100+
name: jsii.String("my-bbdc-oauth-client"),
101101
organization: jsii.String("my-org-name"),
102102
rsaPublicKey: jsii.String("-----BEGIN PUBLIC KEY-----\ncontent\n-----END PUBLIC KEY-----\n"),
103103
secret: jsii.String("-----BEGIN RSA PRIVATE KEY-----\ncontent\n-----END RSA PRIVATE KEY-----\n"),
104-
serviceProvider: jsii.String("bitbucket_server"),
104+
serviceProvider: jsii.String("bitbucket_data_center"),
105105
})
106106
return this
107107
}
@@ -121,20 +121,20 @@ The following arguments are supported:
121121
* `PrivateKey` - (Required for `AdoServer`) The text of the private key associated with your Azure DevOps Server account
122122
* `Key` - The OAuth Client key can refer to a Consumer Key, Application Key,
123123
or another type of client key for the VCS provider.
124-
* `Secret` - (Required for `BitbucketServer`) The OAuth Client secret is used for BitBucket Server, this secret is the
125-
the text of the SSH private key associated with your BitBucket Server
124+
* `Secret` - (Required for `BitbucketDataCenter`) The OAuth Client secret is used for Bitbucket Data Center, this secret is the
125+
the text of the SSH private key associated with your Bitbucket Data Center
126126
Application Link.
127-
* `RsaPublicKey` - (Required for `BitbucketServer`) Required for BitBucket
128-
Server in conjunction with the secret. Not used for any other providers. The
129-
text of the SSH public key associated with your BitBucket Server Application
127+
* `RsaPublicKey` - (Required for `BitbucketDataCenter`) Required for Bitbucket Data Center
128+
in conjunction with the secret. Not used for any other providers. The
129+
text of the SSH public key associated with your Bitbucket Data Center Application
130130
Link.
131131
* `ServiceProvider` - (Required) The VCS provider being connected with. Valid
132-
options are `AdoServer`, `AdoServices`, `BitbucketHosted`, `BitbucketServer`, `Github`, `GithubEnterprise`, `GitlabHosted`,
132+
options are `AdoServer`, `AdoServices`, `BitbucketDataCenter`, `BitbucketHosted`, `BitbucketServer`(deprecated), `Github`, `GithubEnterprise`, `GitlabHosted`,
133133
`GitlabCommunityEdition`, or `GitlabEnterpriseEdition`.
134134

135135
## Attributes Reference
136136

137137
* `Id` - The ID of the OAuth client.
138138
* `OauthTokenId` - The ID of the OAuth token associated with the OAuth client.
139139

140-
<!-- cache-key: cdktf-0.17.0-pre.15 input-0dea494ef76c038939d94b5ae6a0e741e36a87509a350f558cd11d098bf1bde9 -->
140+
<!-- cache-key: cdktf-0.17.0-pre.15 input-0dea494ef76c038939d94b5ae6a0e741e36a87509a350f558cd11d098bf1bde9 -->

website/docs/cdktf/go/r/registry_module.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ The `VcsRepo` block supports:
253253
For most VCS providers outside of BitBucket Cloud and Azure DevOps, this will match the `Identifier`
254254
string.
255255
* `Identifier` - (Required) A reference to your VCS repository in the format
256-
`<organization>/<repository>` where `<organization>` and `<repository>` refer to the organization (or project key, for Bitbucket Server)
256+
`<organization>/<repository>` where `<organization>` and `<repository>` refer to the organization (or project key, for Bitbucket Data Center)
257257
and repository in your VCS provider. The format for Azure DevOps is `<ado organization>/<ado project>/_git/<ado repository>`.
258258
* `OauthTokenId` - (Optional) Token ID of the VCS Connection (OAuth Connection Token) to use. This conflicts with `GithubAppInstallationId` and can only be used if `GithubAppInstallationId` is not used.
259259
* `GithubAppInstallationId` - (Optional) The installation id of the Github App. This conflicts with `OauthTokenId` and can only be used if `OauthTokenId` is not used.

0 commit comments

Comments
 (0)