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

Add v3.0.0 Breaking Changes To Provider Schema #521

Merged
merged 17 commits into from
Sep 4, 2020
Merged

Conversation

jcudit
Copy link
Contributor

@jcudit jcudit commented Jul 20, 2020

Ahead of our next major release, this PR modifies the provider schema in the following ways:

  • token becomes optional, with its absence signalling anonymous mode
  • organization is no longer deprecated and instead enables the management of organization-only resources
  • individual and anonymous removed
  • owner inferred from organization when present

This also refactors the provider configuration testing into a new provider_utils file alongside the original test file. The aim was to make this suite of tests more readable.

Finally, a trivial github_organization data source was added to aid in testing.

/cc https://github.com/terraform-providers/terraform-provider-github/issues/502#issuecomment-652399602

Jeremy Udit added 4 commits July 18, 2020 19:07
Breaking changes to provider configuration:
- Token becomes optional
- Organization no longer deprecated
- `individual` and `anonymous` removed
- `owner` inferred from `organization`

This also refactors the provider configuration testing into a new 
`provider_utils` file alongside the original test file. The aim was to 
make this suite of tests more readable.
- Add tests
- Add `Meta()` instead of `Clients()`
@ghost ghost added size/XXL Type: Documentation Improvements or additions to documentation labels Jul 20, 2020
@jcudit jcudit added this to the v3.0.0 milestone Jul 20, 2020
Jeremy Udit added 3 commits July 20, 2020 18:05
Removes a couple of statements that are no longer in use that were 
tripping up the linter.
@jcudit jcudit marked this pull request as ready for review July 20, 2020 23:13
@jcudit
Copy link
Contributor Author

jcudit commented Jul 27, 2020

--- PASS: TestAccConfigMeta (9.11s)
    --- PASS: TestAccConfigMeta/returns_an_anonymous_client_for_the_v3_REST_API (7.30s)
    --- SKIP: TestAccConfigMeta/returns_an_anonymous_client_for_the_v4_GraphQL_API (0.00s)
    --- PASS: TestAccConfigMeta/returns_a_v3_REST_API_client_to_manage_individual_resources (0.25s)
    --- PASS: TestAccConfigMeta/returns_a_v4_GraphQL_API_client_to_manage_individual_resources (0.20s)
    --- PASS: TestAccConfigMeta/returns_a_v3_REST_API_client_to_manage_organization_resources (0.23s)
    --- PASS: TestAccConfigMeta/returns_a_v4_GraphQL_API_client_to_manage_organization_resources (0.19s)
    --- PASS: TestAccConfigMeta/manages_individual_resources_for_a_GHES_deployment (0.94s)
PASS
ok  	github.com/terraform-providers/terraform-provider-github/github	9.789s
?   	github.com/terraform-providers/terraform-provider-github	[no test files]
=== RUN   TestAccProviderConfigure
=== RUN   TestAccProviderConfigure/can_be_configured_to_run_insecurely
=== RUN   TestAccProviderConfigure/can_be_configured_to_run_anonymously
=== RUN   TestAccProviderConfigure/can_be_configured_with_an_individual_account
=== RUN   TestAccProviderConfigure/can_be_configured_with_an_organization_account
=== RUN   TestAccProviderConfigure/can_be_configured_with_a_GHES_deployment
--- PASS: TestAccProviderConfigure (21.43s)
    --- PASS: TestAccProviderConfigure/can_be_configured_to_run_insecurely (0.17s)
    --- PASS: TestAccProviderConfigure/can_be_configured_to_run_anonymously (2.67s)
    --- PASS: TestAccProviderConfigure/can_be_configured_with_an_individual_account (5.62s)
    --- PASS: TestAccProviderConfigure/can_be_configured_with_an_organization_account (10.23s)
    --- PASS: TestAccProviderConfigure/can_be_configured_with_a_GHES_deployment (2.74s)
PASS
ok  	github.com/terraform-providers/terraform-provider-github/github	21.758s

Added more testing around the GHES use case. This is functioning well locally and will push to merge this week. Follow up PRs are expected as iteration continues towards the new acceptance testing workflow.

github/provider_utils.go Outdated Show resolved Hide resolved
github/provider_utils.go Outdated Show resolved Hide resolved
github/provider_test.go Outdated Show resolved Hide resolved
github/provider_test.go Outdated Show resolved Hide resolved
github/provider_test.go Outdated Show resolved Hide resolved
Experimentation with `ConflictsWith` for this use case added too much 
friction. This diff opts to use a custom `OwnerOrOrgEnvDefaultFunc` 
function instead to ensure owner and organization flags are used 
correctly in CI.
@jcudit
Copy link
Contributor Author

jcudit commented Sep 4, 2020

https://github.com/terraform-providers/terraform-provider-github/pull/544 addresses the concerns raised above.

I will merge this to accommodate progress on refreshing most tests and adding new testing workflows.

@jcudit jcudit merged commit 213e7ef into master Sep 4, 2020
@colltoaction
Copy link

colltoaction commented Dec 23, 2020

Is it possible that there is an undocumented breaking change here? When upgrading from 2.9 to 3.1 I had to change from

provider "github" {
  base_url = "https://my-ghe-host/api/v3"
  organization = "my-org"
}

to

provider "github" {
  base_url = "https://my-ghe-host"
  organization = "my-org"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XXL Type: Documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants