fix(repository_deploy_keys): Make deploy keys compatible to bitbucket-dc-lts

For some reason this api does return ints, where it is supposed to
return strings in older LTS versions.
This commit is contained in:
xvlcwk
2025-03-18 14:57:55 +01:00
committed by chris
parent 82b25662a3
commit 3e77c275e0
12 changed files with 131 additions and 103 deletions

View File

@@ -18,9 +18,9 @@ func TestAccBitbucketDataApplicationProperties(t *testing.T) {
{
Config: config,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.bitbucketserver_application_properties.main", "version", "8.5.4"),
resource.TestCheckResourceAttr("data.bitbucketserver_application_properties.main", "build_number", "8005004"),
resource.TestCheckResourceAttr("data.bitbucketserver_application_properties.main", "build_date", "1681201969213"),
resource.TestCheckResourceAttr("data.bitbucketserver_application_properties.main", "version", "9.4.2"),
resource.TestCheckResourceAttr("data.bitbucketserver_application_properties.main", "build_number", "9004002"),
resource.TestCheckResourceAttr("data.bitbucketserver_application_properties.main", "build_date", "1736803793767"),
resource.TestCheckResourceAttr("data.bitbucketserver_application_properties.main", "display_name", "Bitbucket"),
),
},

View File

@@ -34,7 +34,7 @@ func TestAccBitbucketDataProjectHooks_simple(t *testing.T) {
resource.TestCheckResourceAttr("data.bitbucketserver_project_hooks.test", "hooks.0.name", "All reviewers approve"),
resource.TestCheckResourceAttr("data.bitbucketserver_project_hooks.test", "hooks.0.type", "PRE_PULL_REQUEST_MERGE"),
resource.TestCheckResourceAttr("data.bitbucketserver_project_hooks.test", "hooks.0.description", "Require all reviewers to approve the pull request."),
resource.TestCheckResourceAttr("data.bitbucketserver_project_hooks.test", "hooks.0.version", "8.5.4"),
resource.TestCheckResourceAttr("data.bitbucketserver_project_hooks.test", "hooks.0.version", "9.4.2"),
resource.TestCheckResourceAttr("data.bitbucketserver_project_hooks.test", "hooks.0.scope_types.#", "2"),
resource.TestCheckResourceAttr("data.bitbucketserver_project_hooks.test", "hooks.0.scope_types.0", "PROJECT"),
resource.TestCheckResourceAttr("data.bitbucketserver_project_hooks.test", "hooks.0.scope_types.1", "REPOSITORY"),
@@ -74,7 +74,7 @@ func TestAccBitbucketDataProjectHooks_type(t *testing.T) {
resource.TestCheckResourceAttr("data.bitbucketserver_project_hooks.test", "hooks.0.name", "Reject Force Push"),
resource.TestCheckResourceAttr("data.bitbucketserver_project_hooks.test", "hooks.0.type", "PRE_RECEIVE"),
resource.TestCheckResourceAttr("data.bitbucketserver_project_hooks.test", "hooks.0.description", "Reject all force pushes (git push --force) to this repository"),
resource.TestCheckResourceAttr("data.bitbucketserver_project_hooks.test", "hooks.0.version", "8.5.4"),
resource.TestCheckResourceAttr("data.bitbucketserver_project_hooks.test", "hooks.0.version", "9.4.2"),
resource.TestCheckResourceAttr("data.bitbucketserver_project_hooks.test", "hooks.0.scope_types.#", "2"),
resource.TestCheckResourceAttr("data.bitbucketserver_project_hooks.test", "hooks.0.scope_types.0", "PROJECT"),
resource.TestCheckResourceAttr("data.bitbucketserver_project_hooks.test", "hooks.0.scope_types.1", "REPOSITORY"),

View File

@@ -40,7 +40,7 @@ func TestAccBitbucketDataRepositoryHooks_simple(t *testing.T) {
resource.TestCheckResourceAttr("data.bitbucketserver_repository_hooks.test", "hooks.0.name", "All reviewers approve"),
resource.TestCheckResourceAttr("data.bitbucketserver_repository_hooks.test", "hooks.0.type", "PRE_PULL_REQUEST_MERGE"),
resource.TestCheckResourceAttr("data.bitbucketserver_repository_hooks.test", "hooks.0.description", "Require all reviewers to approve the pull request."),
resource.TestCheckResourceAttr("data.bitbucketserver_repository_hooks.test", "hooks.0.version", "8.5.4"),
resource.TestCheckResourceAttr("data.bitbucketserver_repository_hooks.test", "hooks.0.version", "9.4.2"),
resource.TestCheckResourceAttr("data.bitbucketserver_repository_hooks.test", "hooks.0.scope_types.#", "2"),
resource.TestCheckResourceAttr("data.bitbucketserver_repository_hooks.test", "hooks.0.scope_types.0", "PROJECT"),
resource.TestCheckResourceAttr("data.bitbucketserver_repository_hooks.test", "hooks.0.scope_types.1", "REPOSITORY"),
@@ -86,7 +86,7 @@ func TestAccBitbucketDataRepositoryHooks_type(t *testing.T) {
resource.TestCheckResourceAttr("data.bitbucketserver_repository_hooks.test", "hooks.0.name", "Reject Force Push"),
resource.TestCheckResourceAttr("data.bitbucketserver_repository_hooks.test", "hooks.0.type", "PRE_RECEIVE"),
resource.TestCheckResourceAttr("data.bitbucketserver_repository_hooks.test", "hooks.0.description", "Reject all force pushes (git push --force) to this repository"),
resource.TestCheckResourceAttr("data.bitbucketserver_repository_hooks.test", "hooks.0.version", "8.5.4"),
resource.TestCheckResourceAttr("data.bitbucketserver_repository_hooks.test", "hooks.0.version", "9.4.2"),
resource.TestCheckResourceAttr("data.bitbucketserver_repository_hooks.test", "hooks.0.scope_types.#", "2"),
resource.TestCheckResourceAttr("data.bitbucketserver_repository_hooks.test", "hooks.0.scope_types.0", "PROJECT"),
resource.TestCheckResourceAttr("data.bitbucketserver_repository_hooks.test", "hooks.0.scope_types.1", "REPOSITORY"),

View File

@@ -10,7 +10,7 @@ func TestAccBitbucketPlugin_install(t *testing.T) {
config := `
resource "bitbucketserver_plugin" "test" {
key = "com.plugin.commitgraph.commitgraph"
version = "5.3.3"
version = "6.0.0"
license = "AAABCA0ODAoPeNpdj01PwkAURffzKyZxZ1IyUzARkllQ24gRaQMtGnaP8VEmtjPNfFT59yJVFyzfubkn796Ux0Bz6SmbUM5nbDzj97RISxozHpMUnbSq88poUaLztFEStUN6MJZ2TaiVpu/YY2M6tI6sQrtHmx8qd74EZ+TBIvyUU/AoYs7jiE0jzknWQxMuifA2IBlUbnQ7AulVjwN9AaU9atASs69O2dNFU4wXJLc1aOUGw9w34JwCTTZoe7RPqUgep2X0Vm0n0fNut4gSxl/Jcnj9nFb6Q5tP/Ueu3L+0PHW4ghZFmm2zZV5k6/95CbR7Y9bYGo/zGrV3Ir4jRbDyCA6vt34DO8p3SDAsAhQnJjLD5k9Fr3uaIzkXKf83o5vDdQIUe4XequNCC3D+9ht9ZYhNZFKmnhc=X02dh"
}
`
@@ -24,16 +24,16 @@ func TestAccBitbucketPlugin_install(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("bitbucketserver_plugin.test", "key", "com.plugin.commitgraph.commitgraph"),
resource.TestCheckResourceAttr("bitbucketserver_plugin.test", "enabled", "true"),
resource.TestCheckResourceAttr("bitbucketserver_plugin.test", "version", "5.3.3"),
resource.TestCheckResourceAttr("bitbucketserver_plugin.test", "version", "6.0.0"),
resource.TestCheckResourceAttr("bitbucketserver_plugin.test", "license", "AAABCA0ODAoPeNpdj01PwkAURffzKyZxZ1IyUzARkllQ24gRaQMtGnaP8VEmtjPNfFT59yJVFyzfubkn796Ux0Bz6SmbUM5nbDzj97RISxozHpMUnbSq88poUaLztFEStUN6MJZ2TaiVpu/YY2M6tI6sQrtHmx8qd74EZ+TBIvyUU/AoYs7jiE0jzknWQxMuifA2IBlUbnQ7AulVjwN9AaU9atASs69O2dNFU4wXJLc1aOUGw9w34JwCTTZoe7RPqUgep2X0Vm0n0fNut4gSxl/Jcnj9nFb6Q5tP/Ueu3L+0PHW4ghZFmm2zZV5k6/95CbR7Y9bYGo/zGrV3Ir4jRbDyCA6vt34DO8p3SDAsAhQnJjLD5k9Fr3uaIzkXKf83o5vDdQIUe4XequNCC3D+9ht9ZYhNZFKmnhc=X02dh"),
resource.TestCheckResourceAttr("bitbucketserver_plugin.test", "enabled_by_default", "true"),
resource.TestCheckResourceAttr("bitbucketserver_plugin.test", "name", "Charts and Graphs for Bitbucket Server"),
resource.TestCheckResourceAttr("bitbucketserver_plugin.test", "description", "Gain insight into Bitbucket with charts and graphs that help you visualize user contributions, commits, and team activity."),
resource.TestCheckResourceAttr("bitbucketserver_plugin.test", "user_installed", "true"),
resource.TestCheckResourceAttr("bitbucketserver_plugin.test", "optional", "true"),
resource.TestCheckResourceAttr("bitbucketserver_plugin.test", "vendor.name", "Mohami"),
resource.TestCheckResourceAttr("bitbucketserver_plugin.test", "vendor.link", "https://mohami.io"),
resource.TestCheckResourceAttr("bitbucketserver_plugin.test", "vendor.marketplace_link", "https://mohami.io"),
resource.TestCheckResourceAttr("bitbucketserver_plugin.test", "vendor.name", "Appfire"),
resource.TestCheckResourceAttr("bitbucketserver_plugin.test", "vendor.link", "https://apps.appf.re/landing"),
resource.TestCheckResourceAttr("bitbucketserver_plugin.test", "vendor.marketplace_link", "https://apps.appf.re/landing"),
resource.TestCheckResourceAttr("bitbucketserver_plugin.test", "applied_license.0.valid", "true"),
resource.TestCheckResourceAttr("bitbucketserver_plugin.test", "applied_license.0.evaluation", "true"),
resource.TestCheckResourceAttr("bitbucketserver_plugin.test", "applied_license.0.nearly_expired", "true"),

View File

@@ -15,14 +15,10 @@ import (
)
type SSHKey struct {
ID int `json:"id,omitempty"`
Name string `json:"name,omitempty"`
CreatedDate jsonTime `json:"createdDate,omitempty"`
UpdatedDate jsonTime `json:"updatedDate,omitempty"`
URL string `json:"url,omitempty"`
Active bool `json:"active"`
Events []interface{} `json:"events"`
Configuration WebhookConfiguration `json:"configuration"`
ID int `json:"id,omitempty"`
Name string `json:"name,omitempty"`
CreatedDate jsonTime `json:"createdDate,omitempty"`
UpdatedDate jsonTime `json:"updatedDate,omitempty"`
}
func resourceRepositoryDeployKey() *schema.Resource {
@@ -57,13 +53,19 @@ func resourceRepositoryDeployKey() *schema.Resource {
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{"REPO_READ", "REPO_WRITE", "REPO_ADMIN"}, false),
},
"expiry_days": {
Type: schema.TypeInt,
Optional: true,
ForceNew: true,
},
},
}
}
type KeyRequestKey struct {
Label string `json:"label"`
Text string `json:"text"`
Label string `json:"label"`
Text string `json:"text"`
ExpiryDays int `json:"expiryDays,omitempty"`
}
type KeyRequest struct {
@@ -73,85 +75,18 @@ type KeyRequest struct {
type KeyResponse struct {
Key struct {
Id int `json:"id"`
ExpiryDays int `json:"expiryDays"`
BitLength int `json:"bitLength"`
AlgorithmType string `json:"algorithmType"`
CreatedDate string `json:"createdDate"`
Fingerprint string `json:"fingerprint"`
LastAuthenticated string `json:"lastAuthenticated"`
Label string `json:"label"`
Text string `json:"text"`
Id int `json:"id"`
ExpiryDays int `json:"expiryDays"`
CreatedDate int `json:"createdDate"`
Label string `json:"label"`
Text string `json:"text"`
} `json:"key"`
Permission string `json:"permission"`
Project struct {
Name string `json:"name"`
Key string `json:"key"`
Id int `json:"id"`
Type string `json:"type"`
Public bool `json:"public"`
Avatar string `json:"avatar"`
Description string `json:"description"`
Namespace string `json:"namespace"`
Scope string `json:"scope"`
} `json:"project"`
Repository struct {
Name string `json:"name"`
Id int `json:"id"`
State string `json:"state"`
Public bool `json:"public"`
DefaultBranch string `json:"defaultBranch"`
HierarchyId string `json:"hierarchyId"`
StatusMessage string `json:"statusMessage"`
Archived bool `json:"archived"`
Forkable bool `json:"forkable"`
RelatedLinks struct {
} `json:"relatedLinks"`
Partition int `json:"partition"`
Origin struct {
Name string `json:"name"`
Id int `json:"id"`
State string `json:"state"`
Public bool `json:"public"`
DefaultBranch string `json:"defaultBranch"`
HierarchyId string `json:"hierarchyId"`
StatusMessage string `json:"statusMessage"`
Archived bool `json:"archived"`
Forkable bool `json:"forkable"`
RelatedLinks struct {
} `json:"relatedLinks"`
Partition int `json:"partition"`
Description string `json:"description"`
Project struct {
Name string `json:"name"`
Key string `json:"key"`
Id int `json:"id"`
Type string `json:"type"`
Public bool `json:"public"`
Avatar string `json:"avatar"`
Description string `json:"description"`
Namespace string `json:"namespace"`
Scope string `json:"scope"`
} `json:"project"`
Scope string `json:"scope"`
ScmId string `json:"scmId"`
Slug string `json:"slug"`
} `json:"origin"`
Description string `json:"description"`
Project struct {
Name string `json:"name"`
Key string `json:"key"`
Id int `json:"id"`
Type string `json:"type"`
Public bool `json:"public"`
Avatar string `json:"avatar"`
Description string `json:"description"`
Namespace string `json:"namespace"`
Scope string `json:"scope"`
Slug string `json:"slug"`
Project struct {
Key string `json:"key"`
} `json:"project"`
Scope string `json:"scope"`
ScmId string `json:"scmId"`
Slug string `json:"slug"`
} `json:"repository"`
}
@@ -164,6 +99,11 @@ func resourceRepositoryDeployKeyCreate(d *schema.ResourceData, m interface{}) er
Permission: d.Get("permission").(string),
}
expiryDays := d.Get("expiry_days")
if expiryDays != nil && expiryDays.(int) != 0 {
keyRequest.Key.ExpiryDays = expiryDays.(int)
}
request, err := json.Marshal(keyRequest)
client := m.(*bitbucketTypes.BitbucketServerProvider).BitbucketClient
@@ -220,6 +160,8 @@ func storeResponse(d *schema.ResourceData, resp *http.Response) error {
keyError := store(d, keyResponse, keyResponse.Key.Text, "key")
projectError := store(d, keyResponse, keyResponse.Repository.Project.Key, "project")
repositoryError := store(d, keyResponse, keyResponse.Repository.Slug, "repository")
days := keyResponse.Key.ExpiryDays
d.Set("expiry_days", days)
return errors.Join(labelError, permissionError, keyError, projectError, repositoryError)
}

View File

@@ -30,6 +30,15 @@ func TestAccBitbucketResourceRepositoryDeployKey(t *testing.T) {
key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQD1F2KTOi8ptpqkXdcARgYy27uWRCav1isJUB3Hz59MDM6CSAXa+HCgUNDV+6gXQ1eR24nr1Efb7AkEM8LmvMkNlQqpAsPEPxVlndA0KSRLXb3mWruJzkZtrJo1HhVDffuKnevPLFkB75wyBX3jn1FNtc2qfc2i80mu8TfviZnOPYnrRa8B2S9Q8IlUtXAyihQ1G3fn5r5nxrw3QQGrD3cckB9nCZpzAPn6hlDHVk6n5efoWAUxM5AhKln0OLsA1HwjGJN7/dbDPu1nSLuiJSAISSSg4E4SNdfnr3FOhTA79AKNzsor2/EXdbG+f+S4op3s3wtt05zwkHLXRSqKYoT31RFiV9d1XIav+dGTvXCgc6DNG6rbogE6ZbugDZXdcHOAoNs7IUDFbtI/HGKS7CStxAUEchoxM8HDYXmhYt1kUEpmP3g2ckILHGoGPEkOCYGPqx5HbDvAXAJVk3DdSOibCckR2FK2qEoCbMgnPUX84CqNJPHBZ24AaE8htE6TKr0= user@somewhere"
permission = "REPO_READ"
}
resource "bitbucketserver_repository_deploy_key" "test_with_expiration" {
project = bitbucketserver_project.test.key
repository = bitbucketserver_repository.test.slug
label = "newLabelForTest"
expiry_days = 90
key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQD1F2KTOi8ptpqkXdcARgYy27uWRCav1isJUB3Hz59MDM6CSAXa+HCgUNDV+6gXQ1eR24nr1Efb7AkEM8LmvMkNlQqpAsPEPxVlndA0KSRLXb3mWruJzkZtrJo1HhVDffuKnevPLFkB75wyBX3jn1FNtc2qfc2i80mu8TfviZnOPYnrRa8B2S9Q8IlUtXAyihQ1G3fn5r5nxrw3QQGrD3cckB9nCZpzAPn6hlDHVk6n5efoWAUxM5AhKln0OLsA1HwjGJN7/dbDPu1nSLuiJSAISSSg4E4SNdfnr3FOhTA79AKNzsor2/EXdbG+f+S4op3s3wtt05zwkHLXRSqKYoT31RFiV9d1XIav+dGTvXCgc6DNG6rbogE6ZbugDZXdcHOAoNs7IUDFbtI/HGKS7CStxAUEchoxM8HDYXmhYt1kUEpmP3g2ckILHGoGPEkOCYGPqx5HbDvAXAJVk3DdSOibCckR2FK2qEoCbMgnPUX84CqNJPHBZ24AaE8htE6TKr0= user@somewhere"
permission = "REPO_READ"
}
`, projectKey, projectKey)
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
@@ -43,6 +52,18 @@ func TestAccBitbucketResourceRepositoryDeployKey(t *testing.T) {
resource.TestCheckResourceAttr("bitbucketserver_repository_deploy_key.test", "repository", "repo"),
resource.TestCheckResourceAttr("bitbucketserver_repository_deploy_key.test", "key", "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQD1F2KTOi8ptpqkXdcARgYy27uWRCav1isJUB3Hz59MDM6CSAXa+HCgUNDV+6gXQ1eR24nr1Efb7AkEM8LmvMkNlQqpAsPEPxVlndA0KSRLXb3mWruJzkZtrJo1HhVDffuKnevPLFkB75wyBX3jn1FNtc2qfc2i80mu8TfviZnOPYnrRa8B2S9Q8IlUtXAyihQ1G3fn5r5nxrw3QQGrD3cckB9nCZpzAPn6hlDHVk6n5efoWAUxM5AhKln0OLsA1HwjGJN7/dbDPu1nSLuiJSAISSSg4E4SNdfnr3FOhTA79AKNzsor2/EXdbG+f+S4op3s3wtt05zwkHLXRSqKYoT31RFiV9d1XIav+dGTvXCgc6DNG6rbogE6ZbugDZXdcHOAoNs7IUDFbtI/HGKS7CStxAUEchoxM8HDYXmhYt1kUEpmP3g2ckILHGoGPEkOCYGPqx5HbDvAXAJVk3DdSOibCckR2FK2qEoCbMgnPUX84CqNJPHBZ24AaE8htE6TKr0= user@somewhere"),
resource.TestCheckResourceAttr("bitbucketserver_repository_deploy_key.test", "label", "newLabelForTest"),
resource.TestCheckResourceAttr("bitbucketserver_repository_deploy_key.test", "expiry_days", "0"),
),
},
{
Config: config,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet("bitbucketserver_repository_deploy_key.test_with_expiration", "id"),
resource.TestCheckResourceAttr("bitbucketserver_repository_deploy_key.test_with_expiration", "project", projectKey),
resource.TestCheckResourceAttr("bitbucketserver_repository_deploy_key.test_with_expiration", "repository", "repo"),
resource.TestCheckResourceAttr("bitbucketserver_repository_deploy_key.test_with_expiration", "key", "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQD1F2KTOi8ptpqkXdcARgYy27uWRCav1isJUB3Hz59MDM6CSAXa+HCgUNDV+6gXQ1eR24nr1Efb7AkEM8LmvMkNlQqpAsPEPxVlndA0KSRLXb3mWruJzkZtrJo1HhVDffuKnevPLFkB75wyBX3jn1FNtc2qfc2i80mu8TfviZnOPYnrRa8B2S9Q8IlUtXAyihQ1G3fn5r5nxrw3QQGrD3cckB9nCZpzAPn6hlDHVk6n5efoWAUxM5AhKln0OLsA1HwjGJN7/dbDPu1nSLuiJSAISSSg4E4SNdfnr3FOhTA79AKNzsor2/EXdbG+f+S4op3s3wtt05zwkHLXRSqKYoT31RFiV9d1XIav+dGTvXCgc6DNG6rbogE6ZbugDZXdcHOAoNs7IUDFbtI/HGKS7CStxAUEchoxM8HDYXmhYt1kUEpmP3g2ckILHGoGPEkOCYGPqx5HbDvAXAJVk3DdSOibCckR2FK2qEoCbMgnPUX84CqNJPHBZ24AaE8htE6TKr0= user@somewhere"),
resource.TestCheckResourceAttr("bitbucketserver_repository_deploy_key.test_with_expiration", "label", "newLabelForTest"),
resource.TestCheckResourceAttr("bitbucketserver_repository_deploy_key.test_with_expiration", "expiry_days", "90"),
),
},
},

View File

@@ -14,7 +14,7 @@ data "bitbucketserver_project_hooks" "main" {
# "name" = "Reject Force Push",
# "type" = "PRE_RECEIVE",
# "description" = "Reject all force pushes (git push --force) to this repository",
# "version" = "8.5.4",
# "version" = "9.4.2",
# "scope_types" = ["PROJECT", "REPOSITORY"],
# "enabled" = "false",
# "configured" = "false",
@@ -46,7 +46,7 @@ data "bitbucketserver_project_hooks" "main" {
* `name` - Name of the hook e.g. `Reject Force Push`
* `type` - Type of the hook e.g. `PRE_RECEIVE`
* `description` - Detailed description e.g. `Reject all force pushes (git push --force) to this repository`
* `version` - Version of the hook, for system hooks this is the bitbucket version e.g. `8.5.4`
* `version` - Version of the hook, for system hooks this is the bitbucket version e.g. `9.4.2`
* `scope_types` - List of strings containing the scopes available for this hook, e.g. `["PROJECT", "REPOSITORY"]`
* `enabled` - Set if this hook is enabled for this project
* `configured` - Set if the hook is configured for this project

View File

@@ -15,7 +15,7 @@ data "bitbucketserver_repository_hooks" "main" {
# "name" = "Reject Force Push",
# "type" = "PRE_RECEIVE",
# "description" = "Reject all force pushes (git push --force) to this repository",
# "version" = "8.5.4",
# "version" = "9.4.2",
# "scope_types" = ["PROJECT", "REPOSITORY"],
# "enabled" = "false",
# "configured" = "false",
@@ -49,7 +49,7 @@ data "bitbucketserver_project_hooks" "main" {
* `name` - Name of the hook e.g. `Reject Force Push`
* `type` - Type of the hook e.g. `PRE_RECEIVE`
* `description` - Detailed description e.g. `Reject all force pushes (git push --force) to this repository`
* `version` - Version of the hook, for system hooks this is the bitbucket version e.g. `8.5.4`
* `version` - Version of the hook, for system hooks this is the bitbucket version e.g. `9.4.2`
* `scope_types` - List of strings containing the scopes available for this hook, e.g. `["PROJECT", "REPOSITORY"]`
* `enabled` - Set if this hook is enabled for this project
* `configured` - Set if the hook is configured for this project

View File

@@ -0,0 +1,32 @@
# Resource: bitbucketserver_user_access_token
Repository access tokens can be used to authenticate using the Bitbucket Server REST API over Token auth.
## Example Usage
```hcl
resource "bitbucketserver_repository_access_token" "test" {
project = bitbucketserver_project.test.key
repository = bitbucketserver_repository.test.slug
name = "newLabelForTest"
permissions = ["REPO_READ"]
}
```
## Argument Reference
* `project` - Required. Project for the repository.
* `repository` - Required. Slug for the repository.
* `name` - Required. Name of the access token.
* `permissions` - Required. List of permissions to grant the access token.
* `REPO_READ`
* `REPO_WRITE`
* `REPO_ADMIN`
## Attribute Reference
* `token` - The generated access token. Only available if token was generated on Terraform resource creation, not import/update.
## Import
Currently not supported

View File

@@ -0,0 +1,33 @@
# Resource: bitbucketserver_user_access_token
Repository access tokens can be used to authenticate using the Bitbucket Server REST API over Token auth.
## Example Usage
```hcl
resource "bitbucketserver_repository_deploy_key" "test" {
project = bitbucketserver_project.test.key
repository = bitbucketserver_repository.test.slug
label = "newLabelForTest"
key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQD1F2KTOi8ptpqkXdcARgYy27uWRCav1isJUB3Hz59MDM6CSAXa+HCgUNDV+6gXQ1eR24nr1Efb7AkEM8LmvMkNlQqpAsPEPxVlndA0KSRLXb3mWruJzkZtrJo1HhVDffuKnevPLFkB75wyBX3jn1FNtc2qfc2i80mu8TfviZnOPYnrRa8B2S9Q8IlUtXAyihQ1G3fn5r5nxrw3QQGrD3cckB9nCZpzAPn6hlDHVk6n5efoWAUxM5AhKln0OLsA1HwjGJN7/dbDPu1nSLuiJSAISSSg4E4SNdfnr3FOhTA79AKNzsor2/EXdbG+f+S4op3s3wtt05zwkHLXRSqKYoT31RFiV9d1XIav+dGTvXCgc6DNG6rbogE6ZbugDZXdcHOAoNs7IUDFbtI/HGKS7CStxAUEchoxM8HDYXmhYt1kUEpmP3g2ckILHGoGPEkOCYGPqx5HbDvAXAJVk3DdSOibCckR2FK2qEoCbMgnPUX84CqNJPHBZ24AaE8htE6TKr0= user@somewhere"
permission = "REPO_READ"
}
```
## Argument Reference
* `project` - Required. Project for the repository.
* `repository` - Required. Slug for the repository.
* `label` - Required. Name of the deploy key token.
* `key` - Required. The public key to grant access to
* `permissions` - Required. List of permissions to grant the access token.
* `REPO_READ`
* `REPO_WRITE`
* `REPO_ADMIN`
* expiry_days - Optional. Set if the key should expire. 0 means "does not expire" and is the default
## Attribute Reference
## Import
Currently not supported

View File

@@ -2,7 +2,7 @@ version: '2'
services:
bitbucket:
image: atlassian/bitbucket-server:8.5-ubuntu-jdk11
image: atlassian/bitbucket:9.4.2-jdk21
restart: always
networks:
- bridge

View File

@@ -6,7 +6,7 @@ cd ${DIR}
if [ ! -f ${DIR}/docker-compose ]; then
echo "--> Downloading docker-compose"
curl -L https://github.com/docker/compose/releases/download/1.20.1/docker-compose-`uname -s`-`uname -m` > ${DIR}/docker-compose
curl -L https://github.com/docker/compose/releases/download/v2.34.0/docker-compose-`uname -s`-`uname -m` > ${DIR}/docker-compose
chmod +x ${DIR}/docker-compose
fi