Skip to content

fix: do not null fields if Argo CD API doesn't return fields #701

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

Conversation

blakepettersson
Copy link
Collaborator

Potentially fixes #697.

@blakepettersson blakepettersson force-pushed the fix/inconsistent-state-for-repositories branch from c36ab5a to b10f2dd Compare August 4, 2025 07:41
Signed-off-by: Blake Pettersson <[email protected]>
Just do the conversions directly without any checks

Signed-off-by: Blake Pettersson <[email protected]>
@blakepettersson blakepettersson force-pushed the fix/inconsistent-state-for-repositories branch from 5eec0de to 6840140 Compare August 4, 2025 12:22
For some reason this always suffixes a newline. If I add a newline, then it adds yet
another newline, etc etc.

Signed-off-by: Blake Pettersson <[email protected]>
Comment on lines 140 to 145
result.Name = data.Name
result.Username = data.Username
result.GitHubAppID = data.GitHubAppID
result.GitHubAppInstallationID = data.GitHubAppInstallationID
result.GitHubAppEnterpriseBaseURL = data.GitHubAppEnterpriseBaseURL
result.TLSClientCertData = data.TLSClientCertData
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just checking... Are all of these treated as sensitive by ArgoCD? Surely the ArgoCD API at least returns Name? I would also think it potentially returns Username, GitHubAppEnterpriseBaseURL and TLSClientCertData.

To stay more true to the former implementation (pre
terraform-plugin-framework) we should just load the state, and make
any prerequisite modifications from the API if necessary. This also
resolves the issues coming from the tf-plugin-framework migration.

Signed-off-by: Blake Pettersson <[email protected]>
@blakepettersson blakepettersson force-pushed the fix/inconsistent-state-for-repositories branch from 979827c to 82d9c3d Compare August 9, 2025 08:51
Copy link
Collaborator

@the-technat the-technat left a comment

Choose a reason for hiding this comment

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

Thanks for the fix @blakepettersson!

@blakepettersson blakepettersson enabled auto-merge (squash) August 12, 2025 07:20
@blakepettersson blakepettersson merged commit a974a07 into argoproj-labs:main Aug 12, 2025
9 checks passed
blakepettersson added a commit to blakepettersson/terraform-provider-argocd that referenced this pull request Aug 13, 2025
Similar to what has been done in argoproj-labs#701, add consistency tests to verify
that there won't be any inconsistent state after doing a few applies.

Signed-off-by: Blake Pettersson <[email protected]>
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.

argocd Provider 7.9.0, 7.10.0 - githubapp_id, githubapp_installation_id are both set to null
3 participants