Ale*_*son 6 terraform terraform-provider-github
我们升级为使用integrations/github提供程序源,从那时起,当我们尝试使用 Terraform 创建 github_repository_webhook 时,我们就开始收到 404 错误。我相信我们已经拥有基于文档所需的所有必要部分,但日志中的 API uri 缺少 org. 注意:真实的组织和存储库名称已被编辑。
主.tf
resource "aws_codepipeline_webhook" "codepipeline_webhook" {
name = "test-github-webhook"
authentication = "GITHUB_HMAC"
target_action = "CC"
target_pipeline = aws_codepipeline.pipeline.name
authentication_configuration {
secret_token = data.aws_secretsmanager_secret_version.github_token.secret_string
}
filter {
json_path = "$.ref"
match_equals = "refs/heads/{Branch}"
}
tags = merge(var.tags, {
Name = "test-github-webhook"
})
}
# Wire the CodePipeline webhook into a GitHub repository.
resource "github_repository_webhook" "github_webhook" {
repository = "my_repo"
configuration {
url = aws_codepipeline_webhook.codepipeline_webhook.url
content_type = "json"
insecure_ssl = true
secret = data.aws_secretsmanager_secret_version.github_token.secret_string
}
events = ["push"]
}
Run Code Online (Sandbox Code Playgroud)
后端.tf
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "3.65.0"
}
github = {
source = "integrations/github"
version = "~> 4.0"
}
}
}
provider "github" {
token = data.aws_secretsmanager_secret_version.github_token.secret_string
owner = "my_org"
base_url = "https://github.com/my_org/" # we have github enterprise
}
Run Code Online (Sandbox Code Playgroud)
创建时出错:
Error: POST https://api.github.com/repos//my_repo/hooks: 404 Not Found []
Run Code Online (Sandbox Code Playgroud)
请注意,URL 中完全缺少组织。我还尝试在 github_repository_webhook 资源中包含组织名称,但 url 仍然带有双斜杠和 404:
Error: POST https://api.github.com/repos//my_org/my_repo/hooks: 404 Not Found []
Run Code Online (Sandbox Code Playgroud)
当我完全删除提供程序源和版本时,terraform 会回退到源hashicorp/terraform,并且 webhook 创建时不会出现任何问题。还有其他人遇到过这个问题吗?
的输出是什么terraform providers?我怀疑您所在的州拥有两个版本的 github 提供商。如果你这样做,
terraform state replace-provider hashicorp/github integrations/github
应该把你修好。
| 归档时间: |
|
| 查看次数: |
2550 次 |
| 最近记录: |