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

[Feature Request] archive repo on destroy #432

Merged
merged 7 commits into from
Sep 15, 2020

Conversation

anGie44
Copy link
Contributor

@anGie44 anGie44 commented Apr 18, 2020

@ghost ghost added size/L Type: Documentation Improvements or additions to documentation labels Apr 18, 2020
@anGie44 anGie44 linked an issue Apr 18, 2020 that may be closed by this pull request
@anGie44 anGie44 requested a review from jcudit April 20, 2020 15:45
Copy link

@pmiles01 pmiles01 left a comment

Choose a reason for hiding this comment

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

@anGie44 This implements exactly what I'm looking for.

Many thanks :-)

Copy link
Contributor

@jcudit jcudit left a comment

Choose a reason for hiding this comment

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

Indented changes look good here. A bit of friction with acceptance tests though:

=== CONT  TestAccGithubRepository_archiveUpdate
--- FAIL: TestAccGithubRepository_archiveUpdate (4.24s)
    testing.go:654: Step 0 error: errors during apply:

        Error: PATCH https://api.github.com/repos/terraformtesting/tf-acc-test-04yb6rh4g0: 404 Not Found []

          on /var/folders/t1/p9cyhv6s2wg4g8s_x6zkpz_m0000gn/T/tf-test406284962/main.tf line 2:
          (source code not available)


FAIL
FAIL	github.com/terraform-providers/terraform-provider-github/github	4.491s

☝️ saw a few other tests fail as well when running locally, but it may be general acceptance test flakiness rather than what this PR proposes. I'll queue more time to investigate.

@@ -22,6 +22,7 @@ func resourceGithubRepository() *schema.Resource {
Importer: &schema.ResourceImporter{
State: func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
d.Set("auto_init", false)
d.Set("archive_on_destroy", false)
Copy link
Contributor

Choose a reason for hiding this comment

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

If a repository is imported with configuration that specifies archive_on_destroy to be true, will terraform perform the import and then update the resource's preference in some subsequent step? That seems like the probable flow, but wanted to ask in case you can confirm this behaviour.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah yes another plan and apply will be necessary after import as the API doesn't return this info at Read time; i'm now wondering what's a better way to approach this though.. set the archive_on_destroy to false here at import time, or don't explicitly set a value here? in either case there will be a non-empty plan after import

Copy link
Contributor Author

@anGie44 anGie44 May 9, 2020

Choose a reason for hiding this comment

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

ah or we could import by repo_name:archive_on_destroy instead to avoid the non-empty plan🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

@anGie44 I think the value this option provides outweighs the annoyance of a plan / apply step after an import.

Perhaps we can add a log statement during the import to explain this side effect rather than modifying the import ID.

@jcudit jcudit added this to the v2.8.0 milestone Apr 30, 2020
@anGie44 anGie44 modified the milestones: v2.8.0, v2.8.1 May 15, 2020
@jcudit jcudit modified the milestones: v2.9.0, v2.10.0 Jun 3, 2020
@jcudit jcudit modified the milestones: v2.10.0, v3.1.0 Jul 10, 2020
@jcudit
Copy link
Contributor

jcudit commented Sep 13, 2020

Looks like recent updates to the branch protection plumbing has added conflicts to this PR. I've got this queued to address this week, but welcome anyone else jumping in to remove conflicts.

@ghost ghost added size/XXL and removed size/L labels Sep 15, 2020
@jcudit jcudit force-pushed the ap_425_archive_repo_on_destroy branch from 0878429 to 9320227 Compare September 15, 2020 16:05
@ghost ghost added size/M and removed size/XXL labels Sep 15, 2020
@jcudit jcudit merged commit fda286e into master Sep 15, 2020
@jcudit jcudit deleted the ap_425_archive_repo_on_destroy branch September 15, 2020 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/M Type: Documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Option to archive repository on destroy
3 participants