diff --git a/.gitignore b/.gitignore index c5e66e1..4f7e4d3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.tfstate* main.tf +variables.tf *.env diff --git a/provider/catalog_repository_resource.go b/provider/catalog_repository_resource.go index 37f6547..eed33d6 100644 --- a/provider/catalog_repository_resource.go +++ b/provider/catalog_repository_resource.go @@ -191,11 +191,14 @@ func (r *catalogRepositoryResource) Delete(ctx context.Context, req resource.Del func catalogRepositoryCYModelToData(org string, cr *models.ServiceCatalogSource, data *catalogRepositoryResourceModel) diag.Diagnostics { var diags diag.Diagnostics + if cr.Owner != nil { + data.Owner = types.StringPointerValue(cr.Owner.Username) + } + data.Name = types.StringPointerValue(cr.Name) data.Url = types.StringPointerValue(cr.URL) data.Branch = types.StringValue(cr.Branch) data.Canonical = types.StringPointerValue(cr.Canonical) - data.Owner = types.StringPointerValue(cr.Owner.Username) data.OrganizationCanonical = types.StringValue(org) data.CredentialCanonical = types.StringValue(cr.CredentialCanonical) diff --git a/provider/credential_resource.go b/provider/credential_resource.go index 36f7d94..e2323d4 100644 --- a/provider/credential_resource.go +++ b/provider/credential_resource.go @@ -210,15 +210,18 @@ func (r *credentialResource) Delete(ctx context.Context, req resource.DeleteRequ ) return } - } // credentialCYModelToData converts the 'cred' into the 'credentialResourceModel' func credentialCYModelToData(ctx context.Context, org string, cred *models.Credential, data *credentialResourceModel) diag.Diagnostics { var diags diag.Diagnostics + + if cred.Owner != nil { + data.Owner = types.StringPointerValue(cred.Owner.Username) + } + data.Name = types.StringPointerValue(cred.Name) data.Description = types.StringValue(cred.Description) - data.Owner = types.StringPointerValue(cred.Owner.Username) data.Canonical = types.StringPointerValue(cred.Canonical) data.OrganizationCanonical = types.StringValue(org) data.Body.AccessKey = types.StringValue(cred.Raw.AccessKey)