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

Update Conf Auth resource to fix recreation issue #378

Merged
merged 1 commit into from
Mar 16, 2023
Merged

Conversation

VictorGFM
Copy link
Contributor

Description of the change

Fixes the repository_conf_auth resource re-creation issue by determining the http method (POST or PUT) during the resource creation. For further context see:

https://cyralinc.atlassian.net/browse/ENG-11209: Error when recreating terraform repository_conf_auth resource

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklists

Development

  • Lint rules pass locally
  • The code changed/added as part of this pull request has been covered with tests
  • All tests related to the changed code pass in development

Code review

  • This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
  • Jira issue referenced in commit message and/or PR title

Testing

Tested the resource recreation manually and ran the automated tests. All tests passed, see the result below:

go test github.com/cyralinc/terraform-provider-cyral/... -v -race -timeout 20m
?       github.com/cyralinc/terraform-provider-cyral    [no test files]
=== RUN   TestNewClient_WhenTLSSkipVerifyIsEnabled_ThenInsecureSkipVerifyIsTrue
2023/03/16 18:32:03 [DEBUG] Init NewClient
2023/03/16 18:32:03 [DEBUG] TokenSource: &{0xc0000bcf00 {0 0} <nil>}
2023/03/16 18:32:03 [DEBUG] End NewClient
--- PASS: TestNewClient_WhenTLSSkipVerifyIsEnabled_ThenInsecureSkipVerifyIsTrue (0.00s)
=== RUN   TestNewClient_WhenTLSSkipVerifyIsDisabled_ThenInsecureSkipVerifyIsFalse
2023/03/16 18:32:03 [DEBUG] Init NewClient
2023/03/16 18:32:03 [DEBUG] TokenSource: &{0xc0000bcf30 {0 0} <nil>}
2023/03/16 18:32:03 [DEBUG] End NewClient
--- PASS: TestNewClient_WhenTLSSkipVerifyIsDisabled_ThenInsecureSkipVerifyIsFalse (0.00s)
=== RUN   TestNewClient_WhenClientIDIsEmpty_ThenThrowError
2023/03/16 18:32:03 [DEBUG] Init NewClient
--- PASS: TestNewClient_WhenClientIDIsEmpty_ThenThrowError (0.00s)
=== RUN   TestNewClient_WhenClientSecretIsEmpty_ThenThrowError
2023/03/16 18:32:03 [DEBUG] Init NewClient
--- PASS: TestNewClient_WhenClientSecretIsEmpty_ThenThrowError (0.00s)
=== RUN   TestNewClient_WhenControlPlaneIsEmpty_ThenThrowError
2023/03/16 18:32:03 [DEBUG] Init NewClient
--- PASS: TestNewClient_WhenControlPlaneIsEmpty_ThenThrowError (0.00s)
PASS
ok      github.com/cyralinc/terraform-provider-cyral/client     (cached)
=== RUN   TestAccDatalabelDataSource
=== PAUSE TestAccDatalabelDataSource
=== RUN   TestAccIntegrationIdPSAMLDataSource
=== PAUSE TestAccIntegrationIdPSAMLDataSource
=== RUN   TestAccRepositoryDataSource
=== PAUSE TestAccRepositoryDataSource
=== RUN   TestAccRoleDataSource
=== PAUSE TestAccRoleDataSource
=== RUN   TestAccSAMLCertificateDataSource
=== PAUSE TestAccSAMLCertificateDataSource
=== RUN   TestAccSAMLConfigurationDataSource
=== PAUSE TestAccSAMLConfigurationDataSource
=== RUN   TestAccSidecarBoundPortsDataSource
=== PAUSE TestAccSidecarBoundPortsDataSource
=== RUN   TestAccSidecarCftTemplateDataSource
=== PAUSE TestAccSidecarCftTemplateDataSource
=== RUN   TestAccSidecarIDDataSource
=== PAUSE TestAccSidecarIDDataSource
=== RUN   TestAccSidecarInstanceIDsDataSource
=== PAUSE TestAccSidecarInstanceIDsDataSource
=== RUN   TestIntegrationsData_GetValue_Default
--- PASS: TestIntegrationsData_GetValue_Default (0.00s)
=== RUN   TestIntegrationsData_GetValue_Splunk
--- PASS: TestIntegrationsData_GetValue_Splunk (0.00s)
=== RUN   TestAccProvider
--- PASS: TestAccProvider (0.01s)
=== RUN   TestAccDatalabelResource
=== PAUSE TestAccDatalabelResource
=== RUN   TestAccDatadogIntegrationResource
=== PAUSE TestAccDatadogIntegrationResource
=== RUN   TestAccELKIntegrationResource
=== PAUSE TestAccELKIntegrationResource
=== RUN   TestAccHCVaultIntegrationResource
=== PAUSE TestAccHCVaultIntegrationResource
=== RUN   TestAccIntegrationIdPSAMLDraftResource
=== PAUSE TestAccIntegrationIdPSAMLDraftResource
=== RUN   TestAccIntegrationIdPSAMLResource
=== PAUSE TestAccIntegrationIdPSAMLResource
=== RUN   TestAccIdPIntegrationResource
=== PAUSE TestAccIdPIntegrationResource
=== RUN   TestAccLogstashIntegrationResource
=== PAUSE TestAccLogstashIntegrationResource
=== RUN   TestAccLookerIntegrationResource
=== PAUSE TestAccLookerIntegrationResource
=== RUN   TestAccDuoMFAIntegrationResource
=== PAUSE TestAccDuoMFAIntegrationResource
=== RUN   TestAccPagerDutyIntegrationResource
=== PAUSE TestAccPagerDutyIntegrationResource
=== RUN   TestAccSlackAlertsIntegrationResource
=== PAUSE TestAccSlackAlertsIntegrationResource
=== RUN   TestAccSplunkIntegrationResource
=== PAUSE TestAccSplunkIntegrationResource
=== RUN   TestAccSumoLogicIntegrationResource
=== PAUSE TestAccSumoLogicIntegrationResource
=== RUN   TestAccMsTeamsIntegrationResource
=== PAUSE TestAccMsTeamsIntegrationResource
=== RUN   TestAccPolicyRuleResource
=== PAUSE TestAccPolicyRuleResource
=== RUN   TestPolicyRuleResourceUpgradeV0
--- PASS: TestPolicyRuleResourceUpgradeV0 (0.00s)
=== RUN   TestAccPolicyResource
=== PAUSE TestAccPolicyResource
=== RUN   TestAccRepositoryAccessGatewayResource
=== PAUSE TestAccRepositoryAccessGatewayResource
=== RUN   TestAccRepositoryAccessRulesResource
=== PAUSE TestAccRepositoryAccessRulesResource
=== RUN   TestAccRepositoryBindingResource
=== PAUSE TestAccRepositoryBindingResource
=== RUN   TestAccRepositoryConfAnalysisResource
=== PAUSE TestAccRepositoryConfAnalysisResource
=== RUN   TestRepositoryConfAnalysisResourceUpgradeV0
--- PASS: TestRepositoryConfAnalysisResourceUpgradeV0 (0.00s)
=== RUN   TestAccRepositoryConfAuthResource
=== PAUSE TestAccRepositoryConfAuthResource
=== RUN   TestRepositoryConfAuthResourceUpgradeV0
--- PASS: TestRepositoryConfAuthResourceUpgradeV0 (0.00s)
=== RUN   TestAccRepositoryDatamapResource
=== PAUSE TestAccRepositoryDatamapResource
=== RUN   TestAccRepositoryNetworkAccessPolicyResource
=== PAUSE TestAccRepositoryNetworkAccessPolicyResource
=== RUN   TestAccRepositoryResource
=== PAUSE TestAccRepositoryResource
=== RUN   TestAccRepositoryUserAccountResource
=== PAUSE TestAccRepositoryUserAccountResource
=== RUN   TestAccRoleSSOGroupsResource
=== PAUSE TestAccRoleSSOGroupsResource
=== RUN   TestRoleSSOGroupsResourceUpgradeV0
--- PASS: TestRoleSSOGroupsResourceUpgradeV0 (0.00s)
=== RUN   TestAccRoleResource
=== PAUSE TestAccRoleResource
=== RUN   TestAccSidecarCredentialsResource
=== PAUSE TestAccSidecarCredentialsResource
=== RUN   TestSidecarListenerResource
=== PAUSE TestSidecarListenerResource
=== RUN   TestAccSidecarResource
=== PAUSE TestAccSidecarResource
=== RUN   TestElementsMatch
--- PASS: TestElementsMatch (0.00s)
=== CONT  TestAccRepositoryDataSource
=== CONT  TestAccDuoMFAIntegrationResource
=== CONT  TestAccPagerDutyIntegrationResource
=== CONT  TestAccDatalabelResource
=== CONT  TestSidecarListenerResource
=== CONT  TestAccSidecarResource
=== CONT  TestAccRoleResource
=== CONT  TestAccSidecarCredentialsResource
--- PASS: TestAccSidecarCredentialsResource (7.61s)
=== CONT  TestAccRoleSSOGroupsResource
--- PASS: TestAccPagerDutyIntegrationResource (8.49s)
=== CONT  TestAccRepositoryResource
=== CONT  TestAccRepositoryUserAccountResource
--- PASS: TestAccDuoMFAIntegrationResource (8.82s)
=== CONT  TestAccRepositoryDatamapResource
--- PASS: TestAccDatalabelResource (9.16s)
=== CONT  TestAccRepositoryConfAuthResource
--- PASS: TestAccRepositoryDataSource (15.61s)
=== CONT  TestAccRepositoryNetworkAccessPolicyResource
--- PASS: TestAccRoleResource (19.66s)
--- PASS: TestAccRoleSSOGroupsResource (13.13s)
=== CONT  TestAccRepositoryConfAnalysisResource
--- PASS: TestAccSidecarResource (27.90s)
=== CONT  TestAccRepositoryAccessRulesResource
=== CONT  TestAccRepositoryBindingResource
--- PASS: TestAccRepositoryResource (19.96s)
--- PASS: TestAccRepositoryConfAnalysisResource (9.07s)
=== CONT  TestAccRepositoryAccessGatewayResource
--- PASS: TestAccRepositoryConfAuthResource (15.68s)
=== CONT  TestAccPolicyResource
--- PASS: TestAccRepositoryDatamapResource (22.33s)
=== CONT  TestAccPolicyRuleResource
--- PASS: TestSidecarListenerResource (33.77s)
=== CONT  TestAccMsTeamsIntegrationResource
--- PASS: TestAccPolicyResource (7.60s)
=== CONT  TestAccSplunkIntegrationResource
--- PASS: TestAccRepositoryBindingResource (10.67s)
=== CONT  TestAccSlackAlertsIntegrationResource
--- PASS: TestAccMsTeamsIntegrationResource (6.54s)
=== CONT  TestAccLogstashIntegrationResource
--- PASS: TestAccRepositoryAccessRulesResource (15.07s)
=== CONT  TestAccLookerIntegrationResource
=== CONT  TestAccSumoLogicIntegrationResource
--- PASS: TestAccRepositoryNetworkAccessPolicyResource (24.00s)
=== CONT  TestAccIdPIntegrationResource
--- PASS: TestAccSlackAlertsIntegrationResource (6.31s)
=== CONT  TestAccSAMLConfigurationDataSource
--- PASS: TestAccSplunkIntegrationResource (7.83s)
=== CONT  TestAccSidecarInstanceIDsDataSource
--- PASS: TestAccRepositoryAccessGatewayResource (20.85s)
--- PASS: TestAccLookerIntegrationResource (8.52s)
=== CONT  TestAccIntegrationIdPSAMLDataSource
=== CONT  TestAccSidecarIDDataSource
--- PASS: TestAccSumoLogicIntegrationResource (8.27s)
--- PASS: TestAccPolicyRuleResource (21.22s)
=== CONT  TestAccDatadogIntegrationResource
=== CONT  TestAccSidecarBoundPortsDataSource
--- PASS: TestAccLogstashIntegrationResource (15.47s)
=== CONT  TestAccDatalabelDataSource
--- PASS: TestAccSAMLConfigurationDataSource (10.91s)
--- PASS: TestAccRepositoryUserAccountResource (50.30s)
=== CONT  TestAccSidecarCftTemplateDataSource
--- PASS: TestAccSidecarIDDataSource (8.58s)
=== CONT  TestAccSAMLCertificateDataSource
--- PASS: TestAccSidecarInstanceIDsDataSource (9.98s)
=== CONT  TestAccELKIntegrationResource
--- PASS: TestAccDatadogIntegrationResource (8.90s)
=== CONT  TestAccIntegrationIdPSAMLResource
=== CONT  TestAccIntegrationIdPSAMLDraftResource
--- PASS: TestAccSAMLCertificateDataSource (6.37s)
--- PASS: TestAccELKIntegrationResource (9.66s)
=== CONT  TestAccRoleDataSource
=== CONT  TestAccHCVaultIntegrationResource
--- PASS: TestAccSidecarBoundPortsDataSource (15.24s)
--- PASS: TestAccSidecarCftTemplateDataSource (13.75s)
--- PASS: TestAccIntegrationIdPSAMLDataSource (21.86s)
--- PASS: TestAccIntegrationIdPSAMLDraftResource (11.91s)
--- PASS: TestAccRoleDataSource (8.72s)
--- PASS: TestAccHCVaultIntegrationResource (9.16s)
--- PASS: TestAccDatalabelDataSource (23.48s)
--- PASS: TestAccIntegrationIdPSAMLResource (22.47s)
--- PASS: TestAccIdPIntegrationResource (46.09s)
PASS
ok      github.com/cyralinc/terraform-provider-cyral/cyral      92.165s

@sonarcloud
Copy link

sonarcloud bot commented Mar 16, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@wcmjunior wcmjunior merged commit 595038a into main Mar 16, 2023
@wcmjunior wcmjunior deleted the fix/ENG-11209 branch March 16, 2023 23:55
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