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

fix: Ignore changes to attributes #2402

Merged
merged 1 commit into from
Sep 27, 2024
Merged

Conversation

grahamhar
Copy link
Contributor

@grahamhar grahamhar commented Sep 25, 2024

When a github_repository_file resource was created with a provider version older than 6.3.0 the new attributes added in that version causes a new commit to be created when there should be no changes to the file.

Resolves #2400


Before the change?

On an existing resource the github_repository_file is updated due to new attributes.

After the change?

On an existing resource the github_repository_file is note updated due to new attributes.

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • [] Yes
  • No

I have tested this against a resource created using the older provider version, then using this codebase built locally.
Output of test run

TF_ACC=1 go test -v ./... -run "^TestAccGithubRepositoryFile$"
?       github.com/integrations/terraform-provider-github/v6    [no test files]
=== RUN   TestAccGithubRepositoryFile
=== RUN   TestAccGithubRepositoryFile/creates_and_manages_files
=== RUN   TestAccGithubRepositoryFile/creates_and_manages_files/with_an_anonymous_account
    resource_github_repository_file_test.go:81: anonymous account not supported for this operation
=== RUN   TestAccGithubRepositoryFile/creates_and_manages_files/with_an_individual_account
=== RUN   TestAccGithubRepositoryFile/creates_and_manages_files/with_an_organization_account
=== RUN   TestAccGithubRepositoryFile/can_be_configured_to_overwrite_files_on_create
=== RUN   TestAccGithubRepositoryFile/can_be_configured_to_overwrite_files_on_create/with_an_anonymous_account
    resource_github_repository_file_test.go:162: anonymous account not supported for this operation
=== RUN   TestAccGithubRepositoryFile/can_be_configured_to_overwrite_files_on_create/with_an_individual_account
=== RUN   TestAccGithubRepositoryFile/can_be_configured_to_overwrite_files_on_create/with_an_organization_account
=== RUN   TestAccGithubRepositoryFile/creates_and_manages_files_on_default_branch_if_branch_is_omitted
=== RUN   TestAccGithubRepositoryFile/creates_and_manages_files_on_default_branch_if_branch_is_omitted/with_an_anonymous_account
    resource_github_repository_file_test.go:251: anonymous account not supported for this operation
=== RUN   TestAccGithubRepositoryFile/creates_and_manages_files_on_default_branch_if_branch_is_omitted/with_an_individual_account
=== RUN   TestAccGithubRepositoryFile/creates_and_manages_files_on_default_branch_if_branch_is_omitted/with_an_organization_account
=== RUN   TestAccGithubRepositoryFile/creates_and_manages_files_on_auto_created_branch_if_branch_does_not_exist
=== RUN   TestAccGithubRepositoryFile/creates_and_manages_files_on_auto_created_branch_if_branch_does_not_exist/with_an_anonymous_account
    resource_github_repository_file_test.go:335: anonymous account not supported for this operation
=== RUN   TestAccGithubRepositoryFile/creates_and_manages_files_on_auto_created_branch_if_branch_does_not_exist/with_an_individual_account
=== RUN   TestAccGithubRepositoryFile/creates_and_manages_files_on_auto_created_branch_if_branch_does_not_exist/with_an_organization_account
--- PASS: TestAccGithubRepositoryFile (131.83s)
    --- PASS: TestAccGithubRepositoryFile/creates_and_manages_files (27.28s)
        --- SKIP: TestAccGithubRepositoryFile/creates_and_manages_files/with_an_anonymous_account (0.00s)
        --- PASS: TestAccGithubRepositoryFile/creates_and_manages_files/with_an_individual_account (13.75s)
        --- PASS: TestAccGithubRepositoryFile/creates_and_manages_files/with_an_organization_account (13.53s)
    --- PASS: TestAccGithubRepositoryFile/can_be_configured_to_overwrite_files_on_create (31.28s)
        --- SKIP: TestAccGithubRepositoryFile/can_be_configured_to_overwrite_files_on_create/with_an_anonymous_account (0.00s)
        --- PASS: TestAccGithubRepositoryFile/can_be_configured_to_overwrite_files_on_create/with_an_individual_account (15.87s)
        --- PASS: TestAccGithubRepositoryFile/can_be_configured_to_overwrite_files_on_create/with_an_organization_account (15.41s)
    --- PASS: TestAccGithubRepositoryFile/creates_and_manages_files_on_default_branch_if_branch_is_omitted (39.36s)
        --- SKIP: TestAccGithubRepositoryFile/creates_and_manages_files_on_default_branch_if_branch_is_omitted/with_an_anonymous_account (0.00s)
        --- PASS: TestAccGithubRepositoryFile/creates_and_manages_files_on_default_branch_if_branch_is_omitted/with_an_individual_account (19.96s)
        --- PASS: TestAccGithubRepositoryFile/creates_and_manages_files_on_default_branch_if_branch_is_omitted/with_an_organization_account (19.40s)
    --- PASS: TestAccGithubRepositoryFile/creates_and_manages_files_on_auto_created_branch_if_branch_does_not_exist (33.91s)
        --- SKIP: TestAccGithubRepositoryFile/creates_and_manages_files_on_auto_created_branch_if_branch_does_not_exist/with_an_anonymous_account (0.00s)
        --- PASS: TestAccGithubRepositoryFile/creates_and_manages_files_on_auto_created_branch_if_branch_does_not_exist/with_an_individual_account (16.75s)
        --- PASS: TestAccGithubRepositoryFile/creates_and_manages_files_on_auto_created_branch_if_branch_does_not_exist/with_an_organization_account (17.16s)
PASS
ok      github.com/integrations/terraform-provider-github/v6/github     132.904s

When a `github_repository_file` resource was created with a
provider version older than 6.3.0 the new attributes added in
that version causes a new commit to be created when there
should be no changes to the file.
Copy link
Member

@kfcampbell kfcampbell left a comment

Choose a reason for hiding this comment

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

Thank you @grahamhar! I appreciate the timely fix and attention to detail.

@kfcampbell kfcampbell merged commit 5b50181 into integrations:main Sep 27, 2024
4 checks passed
@grahamhar grahamhar deleted the 2400 branch September 27, 2024 19:03
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.

[BUG]: github_repository_file is updated when no changes following #2100
2 participants