@@ -96,23 +96,30 @@ func flattenRepository(repository *application.Repository, d *schema.ResourceDat
9696 "insecure" : repository .Insecure ,
9797 "name" : repository .Name ,
9898 "project" : repository .Project ,
99- // TODO: in case of repositoryCredentials existence, will perma-diff
100- //"username": repository.Username,
101- // TODO: ArgoCD API does not return sensitive data!
102- //"password": repository.Password,
103- //"ssh_private_key": repository.SSHPrivateKey,
104- //"tls_client_cert_key": repository.TLSClientCertKey,
105- "tls_client_cert_data" : repository .TLSClientCertData ,
106- "type" : repository .Type ,
107- "githubapp_enterprise_base_url" : repository .GitHubAppEnterpriseBaseURL ,
108- }
99+ "type" : repository .Type ,
109100
110- if repository .GithubAppId > 0 {
111- r ["githubapp_id" ] = convertInt64ToString (repository .GithubAppId )
101+ // ArgoCD API does not return sensitive data so we can't track the state of these attributes.
102+ // "password": repository.Password,
103+ // "ssh_private_key": repository.SSHPrivateKey,
104+ // "tls_client_cert_key": repository.TLSClientCertKey,
105+ // "githubapp_private_key": repository.GithubAppPrivateKey,
112106 }
113107
114- if repository .GithubAppInstallationId > 0 {
115- r ["githubapp_installation_id" ] = convertInt64ToString (repository .GithubAppInstallationId )
108+ if ! repository .InheritedCreds {
109+ // To prevent perma-diff in case of existence of repository credentials
110+ // existence, we only track the state of these values when the
111+ // repository is not inheriting credentials
112+ r ["githubapp_enterprise_base_url" ] = repository .GitHubAppEnterpriseBaseURL
113+ r ["tls_client_cert_data" ] = repository .TLSClientCertData
114+ r ["username" ] = repository .Username
115+
116+ if repository .GithubAppId > 0 {
117+ r ["githubapp_id" ] = convertInt64ToString (repository .GithubAppId )
118+ }
119+
120+ if repository .GithubAppInstallationId > 0 {
121+ r ["githubapp_installation_id" ] = convertInt64ToString (repository .GithubAppInstallationId )
122+ }
116123 }
117124
118125 for k , v := range r {
0 commit comments