Skip to content

Commit 77dd211

Browse files
committed
feat: implement sa access token resource
1 parent a4654bb commit 77dd211

File tree

4 files changed

+1
-27
lines changed

4 files changed

+1
-27
lines changed

docs/resources/service_account_access_token.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,11 @@ description: |-
1717
rotation_days = 80
1818
}
1919
20-
// The access token is valid for 180 days but is configured to rotate every 80 days
21-
// when a Terraform apply is triggered.
2220
resource "stackit_service_account_access_token" "sa1" {
2321
project_id = var.stackit_project_id
2422
service_account_email = stackit_service_account.sa.email
2523
ttl_days = 180
2624
27-
// Trigger token rotation based on time_rotating changes.
2825
rotate_when_changed = {
2926
rotation = time_rotating.rotate.id
3027
}
@@ -50,14 +47,11 @@ resource "time_rotating" "rotate" {
5047
rotation_days = 80
5148
}
5249
53-
// The access token is valid for 180 days but is configured to rotate every 80 days
54-
// when a Terraform apply is triggered.
5550
resource "stackit_service_account_access_token" "sa1" {
5651
project_id = var.stackit_project_id
5752
service_account_email = stackit_service_account.sa.email
5853
ttl_days = 180
5954
60-
// Trigger token rotation based on time_rotating changes.
6155
rotate_when_changed = {
6256
rotation = time_rotating.rotate.id
6357
}

stackit/internal/services/serviceaccount/serviceaccount_acc_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func TestServiceAccount(t *testing.T) {
6060
ProtoV6ProviderFactories: testutil.TestAccProtoV6ProviderFactories,
6161
CheckDestroy: testAccCheckServiceAccountDestroy,
6262
Steps: []resource.TestStep{
63-
// Create
63+
// Creation
6464
{
6565
Config: inputServiceAccountResourceConfig(serviceAccountResource["name01"]),
6666
Check: resource.ComposeAggregateTestCheckFunc(

stackit/internal/services/serviceaccount/token/const.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@ resource "time_rotating" "rotate" {
1616
rotation_days = 80
1717
}
1818
19-
// The access token is valid for 180 days but is configured to rotate every 80 days
20-
// when a Terraform apply is triggered.
2119
resource "stackit_service_account_access_token" "sa1" {
2220
project_id = var.stackit_project_id
2321
service_account_email = stackit_service_account.sa.email
2422
ttl_days = 180
2523
26-
// Trigger token rotation based on time_rotating changes.
2724
rotate_when_changed = {
2825
rotation = time_rotating.rotate.id
2926
}

stackit/internal/testutil/testutil.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -404,23 +404,6 @@ func AuthorizationProviderConfig() string {
404404
)
405405
}
406406

407-
func ServiceAccountProviderConfig() string {
408-
if ServiceAccountCustomEndpoint == "" {
409-
return `
410-
provider "stackit" {
411-
region = "eu01"
412-
enable_beta_resources = true
413-
}`
414-
}
415-
return fmt.Sprintf(`
416-
provider "stackit" {
417-
service_account_custom_endpoint = "%s"
418-
enable_beta_resources = true
419-
}`,
420-
ServiceAccountCustomEndpoint,
421-
)
422-
}
423-
424407
func ResourceNameWithDateTime(name string) string {
425408
dateTime := time.Now().Format(time.RFC3339)
426409
// Remove timezone to have a smaller datetime

0 commit comments

Comments
 (0)