Skip to content

Commit 3073f18

Browse files
committed
Cleanup
1 parent cdce2e5 commit 3073f18

File tree

4 files changed

+4
-51
lines changed

4 files changed

+4
-51
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
terraform import grafana_cloud_access_policy_token_rotation.name "{{ region }}:{{ tokenId }}"
1+
terraform import grafana_cloud_access_policy_rotating_token.name "{{ region }}:{{ tokenId }}"

examples/resources/grafana_cloud_access_policy_rotating_token/resource.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ resource "time_rotating" "token_rotation" {
2323
rotation_days = 30
2424
}
2525

26-
resource "grafana_cloud_access_policy_token_rotation" "test" {
26+
resource "grafana_cloud_access_policy_rotating_token" "test" {
2727
region = "prod-us-east-0"
2828
access_policy_id = grafana_cloud_access_policy.test.policy_id
2929
name_prefix = "my-policy-rotating-token"

internal/resources/cloud/resource_cloud_access_policy_rotating_token.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ This is similar to the grafana_cloud_access_policy_token resource, but it repres
7979
Type: schema.TypeString,
8080
Required: true,
8181
ForceNew: true,
82-
Description: "Prefix for the name of the access policy token. The actual name will be stored in the computed field `name`, which will be in the format '<name_prefix>-<post_rotation_lifetime seconds>-<rotate_after timestamp>'",
82+
Description: "Prefix for the name of the access policy token. The actual name will be stored in the computed field `name`, which will be in the format '<name_prefix>-<rotate_after>-<post_rotation_lifetime>'",
8383
ValidateFunc: validation.StringLenBetween(1, 200),
8484
},
8585
"rotate_after": {
@@ -119,7 +119,7 @@ This is similar to the grafana_cloud_access_policy_token resource, but it repres
119119
"expires_at": {
120120
Type: schema.TypeString,
121121
Computed: true,
122-
Description: "Expiration date of the access policy token.",
122+
Description: "Expiration date of the access policy token. This is the result of adding `rotate_after` and `post_rotation_lifetime`",
123123
},
124124
}),
125125
}

internal/resources/cloud/resource_cloud_access_policy_rotating_token_test.go

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -254,50 +254,3 @@ func testAccCloudAccessPolicyRotatingTokenConfigNoToken(name, displayName, regio
254254
}
255255
`, name, displayName, strings.Join(scopes, `","`), os.Getenv("GRAFANA_CLOUD_ORG"), region)
256256
}
257-
258-
func testAccCloudAccessPolicyRotatingTokenConfigMismatch(name, displayName, region string, namePrefix string, rotateAfter int64, postRotationLifetime string) string {
259-
if displayName != "" {
260-
displayName = fmt.Sprintf("display_name = \"%s\"", displayName)
261-
}
262-
263-
scopes := []string{
264-
"metrics:read",
265-
"logs:write",
266-
"accesspolicies:read",
267-
"accesspolicies:write",
268-
"accesspolicies:delete",
269-
"datadog:validate",
270-
}
271-
272-
return fmt.Sprintf(`
273-
data "grafana_cloud_organization" "current" {
274-
slug = "%[4]s"
275-
}
276-
277-
resource "grafana_cloud_access_policy" "rotating_token_test" {
278-
region = "%[7]s"
279-
name = "%[1]s"
280-
%[2]s
281-
282-
scopes = ["%[3]s"]
283-
284-
realm {
285-
type = "org"
286-
identifier = data.grafana_cloud_organization.current.id
287-
288-
label_policy {
289-
selector = "{namespace=\"default\"}"
290-
}
291-
}
292-
}
293-
294-
resource "grafana_cloud_access_policy_rotating_token" "test" {
295-
region = "%[7]s"
296-
access_policy_id = grafana_cloud_access_policy.rotating_token_test.policy_id
297-
name_prefix = "%[5]s"
298-
rotate_after = "%[6]d"
299-
post_rotation_lifetime = "%[8]s"
300-
%[2]s
301-
}
302-
`, name, displayName, strings.Join(scopes, `","`), os.Getenv("GRAFANA_CLOUD_ORG"), namePrefix, rotateAfter, region, postRotationLifetime)
303-
}

0 commit comments

Comments
 (0)