程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Terraform Enterprise Module Registry:我可以将模块的源代码存储在现有 GitHub 存储库的子目录中吗?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决Terraform Enterprise Module Registry:我可以将模块的源代码存储在现有 GitHub 存储库的子目录中吗??

开发过程中遇到Terraform Enterprise Module Registry:我可以将模块的源代码存储在现有 GitHub 存储库的子目录中吗?的问题如何解决?下面主要结合日常开发的经验,给出你关于Terraform Enterprise Module Registry:我可以将模块的源代码存储在现有 GitHub 存储库的子目录中吗?的解决方法建议,希望对你解决Terraform Enterprise Module Registry:我可以将模块的源代码存储在现有 GitHub 存储库的子目录中吗?有所启发或帮助;

我有 40 多个 terraform 模块要在私有 terraform Enterprise 模块注册表中注册。

为我发布的 40 个模块中的每一个创建 40 个 GitHub 存储库是很困难的。

是否可以有一个 GitHub 存储库,并且每个模块有一个子目录(意味着 40 个模块有 40 个目录)?这样,我只需要管理一个存储库,并将所有模块放在其子目录中。

解决方法

您可以为 40 个模块使用根模块,并通过源参数末尾的 //sub_module_folder 调用子模块。

但更好的解决方案是使用 Terraform 使用 tfe_registry_module

自动添加 40 个模块

基本用法:

resource "tfe_organization" "test-organization" {
  name  = "my-org-name"
  email = "admin@company.com"
}

resource "tfe_oauth_client" "test-oauth-client" {
  organization     = tfe_organization.test-organization.name
  api_url          = "https://api.github.com"
  http_url         = "https://github.com"
  oauth_token      = "my-vcs-provider-token"
  service_provider = "github"
}

resource "tfe_registry_module" "test-registry-module" {
  vcs_repo {
    display_identifier = "gh-org-name/terraform-provider-name"
    identifier         = "gh-org-name/terraform-provider-name"
    oauth_token_id     = tfe_oauth_client.test-oauth-client.oauth_token_id
  }
}
resource "tfe_registry_module" "test-registry-module-2" {
  vcs_repo {
    display_identifier = "gh-org-name/terraform-provider-name-2"
    identifier         = "gh-org-name/terraform-provider-name-2"
    oauth_token_id     = tfe_oauth_client.test-oauth-client.oauth_token_id
  }
}

大佬总结

以上是大佬教程为你收集整理的Terraform Enterprise Module Registry:我可以将模块的源代码存储在现有 GitHub 存储库的子目录中吗?全部内容,希望文章能够帮你解决Terraform Enterprise Module Registry:我可以将模块的源代码存储在现有 GitHub 存储库的子目录中吗?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: