Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix astra token integration test #402

Merged
merged 1 commit into from
Sep 30, 2024
Merged

fix astra token integration test #402

merged 1 commit into from
Sep 30, 2024

Conversation

pgier
Copy link
Collaborator

@pgier pgier commented Sep 30, 2024

The token integration test started failing after the addition of the optional org_id field (#399). The initial token creation works successfully but subsequent calls to Terraform apply cause the token to be regenerated instead of re-using the previously generated token. Adding the Computed: true flag fixes this issue by indicating to the Terraform SDK that the field was automatically generated from the auth token.

Error message from tests:

=== RUN   TestToken
2024/09/19 21:00:31 [DEBUG] POST https://api.test.cloud.datastax.com/v2/organizations/roles
2024/09/19 21:00:31 [DEBUG] GET https://api.test.cloud.datastax.com/v2/currentOrg
2024/09/19 21:00:31 [DEBUG] GET https://api.test.cloud.datastax.com/v2/organizations/roles/6c081bb7-3dce-4525-8c19-2ae16e0b13e9
2024/09/19 21:00:31 [DEBUG] POST https://api.test.cloud.datastax.com/v2/tokens
    resource_token_test.go:11: Step 1/1 error: After applying this test step, the plan was not empty.
        stdout:
        
        
        Terraform used the selected providers to generate the following execution
        plan. Resource actions are indicated with the following symbols:
        -/+ destroy and then create replacement
        
        Terraform will perform the following actions:
        
          # astra_token.example must be replaced
        -/+ resource "astra_token" "example" {
              ~ client_id = "kqOPeOShqbFZXMbpdzstdmKs" -> (known after apply)
              ~ id        = "kqOPeOShqbFZXMbpdzstdmKs" -> (known after apply)
              - org_id    = "3155c078-f822-4ae2-8605-f2f49e6d7ca1" -> null # forces replacement
              ~ secret    = (sensitive value)
              ~ token     = (sensitive value)
                # (1 unchanged attribute hidden)
            }
        
        Plan: 1 to add, 0 to change, 1 to destroy.

--- FAIL: TestToken (2.89s)

The token integration test started failing after the addition of the
optional `org_id` field (#399).
The initial token creation works successfully but subsequent calls to Terraform apply
cause the token to be regenerated instead of re-using the previously generated token.
Adding the `Computed: true` flag fixes this issue by indicating to the Terraform SDK
that the field was automatically generated from the auth token.
Copy link
Contributor

@emerkle826 emerkle826 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch

@pgier pgier merged commit 1ca01d5 into main Sep 30, 2024
4 checks passed
@pgier pgier deleted the fix-astra-token-test branch September 30, 2024 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants