Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ resource "torque_gitlab_enterprise_repository_space_association" "repository" {

### Optional

- `token` (String) Authentication Token to the project/repository. If omitted, existing credentials provided in the credential_name field will be used for authentication. If provided, a new credentials object will be created.
- `token` (String, Deprecated) Authentication Token to the project/repository. If omitted, existing credentials provided in the credential_name field will be used for authentication. If provided, a new credentials object will be created.
2 changes: 1 addition & 1 deletion docs/resources/repository_space_association.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ resource "torque_repository_space_association" "repository" {

### Optional

- `access_token` (String) Personal Access Token (PAT) to authenticate with to the repository. Credentials will be automatically created with the specified token, or use existing credentials instead.
- `access_token` (String, Deprecated) Personal Access Token (PAT) to authenticate with to the repository. Credentials will be automatically created with the specified token, or use existing credentials instead.
- `branch` (String) Repository branch to use for blueprints and automation assets
- `credential_name` (String) The name of existing credentials to use.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func (r *TorqueSpaceGitlabEnterpriseRepositoryResource) Schema(ctx context.Conte
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
DeprecationMessage: "The token attribute is deprecated and will be removed in a future release. Use the torque_git_credentials resource to store the token and reference it in this resource using the credential_name attribute instead.",
},
"branch": schema.StringAttribute{
Description: "Repository branch to use for blueprints and automation assets",
Expand Down
1 change: 1 addition & 0 deletions internal/provider/resources/space_repository_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func (r *TorqueSpaceRepositoryResource) Schema(ctx context.Context, req resource
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
DeprecationMessage: "The access_token attribute is deprecated and will be removed in a future release. Use the torque_git_credentials resource to store the token and reference it in this resource using the credential_name attribute instead.",
Validators: []validator.String{
// Validate only this attribute or other_attr is configured or neither.
stringvalidator.ConflictsWith(path.Expressions{
Expand Down
19 changes: 10 additions & 9 deletions internal/provider/tests/catalog_item_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ const (
blueprint_name = "ec2"
repository_name = "TerraformProviderAcceptanceTests"
new_blueprint_name = "rds"
display_name = "display_name"
)

func TestCatalogItemResource(t *testing.T) {
spaceName := os.Getenv("TORQUE_SPACE")
var unique_blueprint_name = blueprint_name + "_" + index
var new_unique_blueprint_name = new_blueprint_name + "_" + index

var unique_display_name = display_name + "_" + index
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
Expand Down Expand Up @@ -78,16 +79,16 @@ func TestCatalogItemResource(t *testing.T) {
{
Config: providerConfig + fmt.Sprintf(`
resource "torque_catalog_item" "catalog_item" {
space_name = "%s"
blueprint_name = "%s"
repository_name = "%s"
display_name ="display_name"
space_name = "%s"
blueprint_name = "%s"
repository_name = "%s"
display_name = "%s"
default_duration = "PT3H"
default_extend = "PT9H"
max_duration = "P1DT6H"
labels = ["k8s"]
default_extend = "PT9H"
max_duration = "P1DT6H"
labels = ["k8s"]
}
`, spaceName, new_unique_blueprint_name, repository_name),
`, spaceName, new_unique_blueprint_name, repository_name, unique_display_name),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("torque_catalog_item.catalog_item", "space_name", spaceName),
resource.TestCheckResourceAttr("torque_catalog_item.catalog_item", "blueprint_name", new_unique_blueprint_name),
Expand Down
64 changes: 32 additions & 32 deletions internal/provider/tests/git_repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package tests

import (
"fmt"
"os"
"testing"

"github.com/hashicorp/terraform-plugin-testing/helper/resource"
Expand Down Expand Up @@ -50,34 +49,35 @@ func TestGitRepoWithCreds(t *testing.T) {
})
}

func TestGitRepoWithToken(t *testing.T) {
access_token := os.Getenv("GITHUB_TOKEN")
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
// Create and Read testing
{
Config: providerConfig + fmt.Sprintf(`
resource "torque_repository_space_association" "repository_with_token" {
space_name = "%s"
repository_url = "%s"
access_token = "%s"
repository_type = "%s"
branch = "%s"
repository_name = "%s"
}
`, fullSpaceName, repository_url, access_token, repository_type, branch, repo_name),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("torque_repository_space_association.repository_with_token", "space_name", fullSpaceName),
resource.TestCheckResourceAttr("torque_repository_space_association.repository_with_token", "repository_name", repo_name),
resource.TestCheckResourceAttr("torque_repository_space_association.repository_with_token", "branch", branch),
resource.TestCheckResourceAttr("torque_repository_space_association.repository_with_token", "repository_url", repository_url),
resource.TestCheckResourceAttr("torque_repository_space_association.repository_with_token", "repository_type", repository_type),
),
},
// Update and Read testing
// Delete testing automatically occurs in TestCase
},
})
}
// Deprecated
// func TestGitRepoWithToken(t *testing.T) {
// access_token := os.Getenv("GITHUB_TOKEN")
// resource.Test(t, resource.TestCase{
// PreCheck: func() { testAccPreCheck(t) },
// ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
// Steps: []resource.TestStep{
// // Create and Read testing
// {
// Config: providerConfig + fmt.Sprintf(`
// resource "torque_repository_space_association" "repository_with_token" {
// space_name = "%s"
// repository_url = "%s"
// access_token = "%s"
// repository_type = "%s"
// branch = "%s"
// repository_name = "%s"
// }
// `, fullSpaceName, repository_url, access_token, repository_type, branch, repo_name),
// Check: resource.ComposeAggregateTestCheckFunc(
// resource.TestCheckResourceAttr("torque_repository_space_association.repository_with_token", "space_name", fullSpaceName),
// resource.TestCheckResourceAttr("torque_repository_space_association.repository_with_token", "repository_name", repo_name),
// resource.TestCheckResourceAttr("torque_repository_space_association.repository_with_token", "branch", branch),
// resource.TestCheckResourceAttr("torque_repository_space_association.repository_with_token", "repository_url", repository_url),
// resource.TestCheckResourceAttr("torque_repository_space_association.repository_with_token", "repository_type", repository_type),
// ),
// },
// // Update and Read testing
// // Delete testing automatically occurs in TestCase
// },
// })
// }
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

func TestTorqueEmailApprovalChannel(t *testing.T) {
const (
approval_channel = "approval_channel"
approval_channel = "email_approval_channel"
description = "description"
new_description = "new_description"
approver = "terraformtester@quali.com"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

func TestTorqueServiceNowApprovalChannel(t *testing.T) {
const (
approval_channel = "approval_channel"
approval_channel = "snow_approval_channel"
description = "description"
new_description = "new_description"
approver = "terraformtester@quali.com"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

func TestTorqueTeamsApprovalChannel(t *testing.T) {
const (
approval_channel = "approval_channel"
approval_channel = "teams_approval_channel"
description = "description"
new_description = "new_description"
approver = "terraformtester@quali.com"
Expand Down
Loading