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

Support initial_version for creating branch based modules #1363

Merged
merged 4 commits into from
May 22, 2024

Conversation

aaabdelgany
Copy link
Contributor

@aaabdelgany aaabdelgany commented May 21, 2024

Description

Support for specifying a branch based modules initialVersion is missing from the tfe provider - if it is missing, we default to a version of 0.0.0. This PR addresses that by adding support for an initial_version string. This PR also removes the skipUnlessBeta flag from the tf test and branch based modules tests.
Remember to:

Testing plan

resource "tfe_organization" "foobar" {
 name  = "tst-terraform-%d"
 email = "admin@company.com"
}

resource "tfe_oauth_client" "foobar" {
 organization     = tfe_organization.foobar.name
 api_url          = "https://api.github.com"
 http_url         = "https://github.com"
 oauth_token      = "%s"
 service_provider = "github"
}

resource "tfe_registry_module" "foobar" {
 organization     = tfe_organization.foobar.name
 vcs_repo {
   display_identifier = "%s"
   identifier         = "%s"
   oauth_token_id     = tfe_oauth_client.foobar.oauth_token_id
   branch             = "main"
   tags				  = false
 }

 initial_version = "1.0.0"

 test_config {
   tests_enabled = false
 }

External links

Include any links here that might be helpful for people reviewing your PR. If there are none, feel free to delete this section.

https://pkg.go.dev/github.com/hashicorp/go-tfe@v1.53.0#RegistryModuleCreateWithVCSConnectionOptions.VCSRepo

Output from acceptance tests

Please run applicable acceptance tests locally and include the output here. See testing.md to learn how to run acceptance tests.

If you are an external contributor, your contribution(s) will first be reviewed before running them against the project's CI pipeline.

TF_ACC=1 TF_LOG_SDK_PROTO=OFF go test $(go list ./... |grep -v 'vendor') -v -run TestAccTFERegistryModule -timeout 15m
?   	github.com/hashicorp/terraform-provider-tfe	[no test files]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-tfe/internal/client	0.239s [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-tfe/internal/logging	0.120s [no tests to run]
?   	github.com/hashicorp/terraform-provider-tfe/internal/provider/validators	[no test files]
?   	github.com/hashicorp/terraform-provider-tfe/version	[no test files]
=== RUN   TestAccTFERegistryModule_vcs
--- PASS: TestAccTFERegistryModule_vcs (8.36s)
=== RUN   TestAccTFERegistryModule_GitHubApp
    provider_test.go:230: Please set GITHUB_APP_INSTALLATION_ID to run this test
--- SKIP: TestAccTFERegistryModule_GitHubApp (0.00s)
=== RUN   TestAccTFERegistryModule_emptyVCSRepo
--- PASS: TestAccTFERegistryModule_emptyVCSRepo (0.16s)
=== RUN   TestAccTFERegistryModule_nonVCSPrivateRegistryModuleWithoutRegistryName
--- PASS: TestAccTFERegistryModule_nonVCSPrivateRegistryModuleWithoutRegistryName (4.87s)
=== RUN   TestAccTFERegistryModule_nonVCSPrivateRegistryModuleWithRegistryName
--- PASS: TestAccTFERegistryModule_nonVCSPrivateRegistryModuleWithRegistryName (5.04s)
=== RUN   TestAccTFERegistryModule_publicRegistryModule
--- PASS: TestAccTFERegistryModule_publicRegistryModule (5.01s)
=== RUN   TestAccTFERegistryModule_noCodeModule
--- PASS: TestAccTFERegistryModule_noCodeModule (5.36s)
=== RUN   TestAccTFERegistryModuleImport_vcsPrivateRMDeprecatedFormat
--- PASS: TestAccTFERegistryModuleImport_vcsPrivateRMDeprecatedFormat (8.07s)
=== RUN   TestAccTFERegistryModuleImport_vcsPrivateRMRecommendedFormat
--- PASS: TestAccTFERegistryModuleImport_vcsPrivateRMRecommendedFormat (7.53s)
=== RUN   TestAccTFERegistryModuleImport_vcsPublishingMechanismBranchToTagsToBranch
--- PASS: TestAccTFERegistryModuleImport_vcsPublishingMechanismBranchToTagsToBranch (18.82s)
=== RUN   TestAccTFERegistryModuleImport_vcsPublishingMechanismBranchToTagsToBranchWithTests
--- PASS: TestAccTFERegistryModuleImport_vcsPublishingMechanismBranchToTagsToBranchWithTests (13.04s)
=== RUN   TestAccTFERegistryModuleImport_vcsPublishingMechanismTagsToBranchToTags
--- PASS: TestAccTFERegistryModuleImport_vcsPublishingMechanismTagsToBranchToTags (16.78s)
=== RUN   TestAccTFERegistryModule_invalidTestConfigOnCreate
--- PASS: TestAccTFERegistryModule_invalidTestConfigOnCreate (3.22s)
=== RUN   TestAccTFERegistryModule_invalidTestConfigOnUpdate
--- PASS: TestAccTFERegistryModule_invalidTestConfigOnUpdate (8.05s)
=== RUN   TestAccTFERegistryModule_branchAndInvalidTagsOnCreate
--- PASS: TestAccTFERegistryModule_branchAndInvalidTagsOnCreate (3.15s)
=== RUN   TestAccTFERegistryModule_branchAndTagsEnabledOnCreate
--- PASS: TestAccTFERegistryModule_branchAndTagsEnabledOnCreate (3.20s)
=== RUN   TestAccTFERegistryModule_branchAndTagsEnabledOnUpdate
--- PASS: TestAccTFERegistryModule_branchAndTagsEnabledOnUpdate (8.09s)
=== RUN   TestAccTFERegistryModuleImport_nonVCSPrivateRM
--- PASS: TestAccTFERegistryModuleImport_nonVCSPrivateRM (5.46s)
=== RUN   TestAccTFERegistryModuleImport_publicRM
--- PASS: TestAccTFERegistryModuleImport_publicRM (5.24s)
=== RUN   TestAccTFERegistryModule_invalidWithBothVCSRepoAndModuleProvider
--- PASS: TestAccTFERegistryModule_invalidWithBothVCSRepoAndModuleProvider (0.17s)
=== RUN   TestAccTFERegistryModule_invalidRegistryName
--- PASS: TestAccTFERegistryModule_invalidRegistryName (0.34s)
=== RUN   TestAccTFERegistryModule_invalidWithModuleProviderAndNoName
--- PASS: TestAccTFERegistryModule_invalidWithModuleProviderAndNoName (0.13s)
=== RUN   TestAccTFERegistryModule_invalidWithModuleProviderAndNoOrganization
--- PASS: TestAccTFERegistryModule_invalidWithModuleProviderAndNoOrganization (0.13s)
=== RUN   TestAccTFERegistryModule_invalidWithNamespaceAndNoRegistryName
--- PASS: TestAccTFERegistryModule_invalidWithNamespaceAndNoRegistryName (0.13s)
=== RUN   TestAccTFERegistryModule_invalidWithRegistryNameAndNoModuleProvider
--- PASS: TestAccTFERegistryModule_invalidWithRegistryNameAndNoModuleProvider (0.12s)
PASS
ok  	github.com/hashicorp/terraform-provider-tfe/internal/provider	131.113s
...

@aaabdelgany aaabdelgany requested review from a team and hashimoon and removed request for a team May 21, 2024 19:18
@aaabdelgany aaabdelgany marked this pull request as ready for review May 21, 2024 19:38
@aaabdelgany aaabdelgany requested a review from a team as a code owner May 21, 2024 19:38
@aaabdelgany aaabdelgany merged commit 9d49212 into main May 22, 2024
9 checks passed
@aaabdelgany aaabdelgany deleted the abdu/branch_based_module_initial_version branch May 22, 2024 20:50
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.

None yet

2 participants