Skip to content

Commit e189ddb

Browse files
authored
Merge pull request #1277 from gitlabhq/bugfix/issue-1260
resource/gitlab_repository_file: Fix check if file exists during read. Closes #1260
2 parents 31bd538 + 0ece426 commit e189ddb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/provider/resource_gitlab_repository_file.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ func resourceGitlabRepositoryFileRead(ctx context.Context, d *schema.ResourceDat
163163

164164
repositoryFile, _, err := client.RepositoryFiles.GetFile(project, filePath, options, gitlab.WithContext(ctx))
165165
if err != nil {
166-
if strings.Contains(err.Error(), "404 File Not Found") {
167-
log.Printf("[WARN] file %s not found, removing from state", filePath)
166+
if is404(err) {
167+
log.Printf("[DEBUG] file %s not found, removing from state", filePath)
168168
d.SetId("")
169169
return nil
170170
}

0 commit comments

Comments
 (0)