如何避免Github repo URL中的双斜杠?
我正在尝试使用标记过滤器创建AWS代码管道webhook,并根据 我使用的代码:如何避免Github repo URL中的双斜杠?,github,terraform,terraform-provider-aws,Github,Terraform,Terraform Provider Aws,我正在尝试使用标记过滤器创建AWS代码管道webhook,并根据 我使用的代码: resource "aws_codepipeline_webhook" "pprod_webhook" { name = "${var.client_code}-${var.environment}-pprod-hook" authentication = "GITHUB_HMAC" target_a
resource "aws_codepipeline_webhook" "pprod_webhook" {
name = "${var.client_code}-${var.environment}-pprod-hook"
authentication = "GITHUB_HMAC"
target_action = "Source"
target_pipeline = aws_codepipeline.cd.name
authentication_configuration {
secret_token = data.aws_ssm_parameter.github_token.value
}
filter {
json_path = "$.ref_type"
match_equals = "tag"
}
}
resource "github_repository_webhook" "github_hook" {
repository = "org_name/repo_name"
configuration {
url = aws_codepipeline_webhook.pprod_webhook.url
content_type = "json"
insecure_ssl = false
secret = data.aws_ssm_parameter.webhook_secret.value
}
active = true
events = ["create"]
}
编辑地形平面图:
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
~ update in-place
Terraform will perform the following actions:
# module.codepipeline.github_repository_webhook.github_hook will be created
+ resource "github_repository_webhook" "github_hook" {
+ active = true
+ etag = (known after apply)
+ events = [
+ "create",
]
+ id = (known after apply)
+ repository = "org_name/repo_name"
+ url = (known after apply)
+ configuration {
+ content_type = "json"
+ insecure_ssl = false
+ secret = (sensitive value)
+ url = (sensitive value)
}
}
使用terraform的gh_url
输出进行编辑:我正在获取Github中的有效负载url。似乎我不必创建Github webhook,因为已经有了一个,但不知道创建filter only是否只允许我从标记触发管道
不幸的是,我得到了一个错误:
错误:POST:
404找不到[]
不知道为什么我会在上面的URL中看到
/
。是否有人知道如何使其工作?您缺少配置github提供程序
provider "github" {
token = "secret"
owner = "owner"
}
同样对于存储库,您只需指定项目
resource "github_repository_webhook" "github_hook" {
repository = "repo_name"
...
}
你介意发布
地形图的另一部分吗,也许有什么?我已经添加了该图的其余部分。谢谢,但我指的是地形图
命令的输出。当然,如果这些秘密可见,您可以省略它们。或者,您也可以进行本地调试。在github\u repository\u webhook
之前添加以下内容:output“gh\u url”{value=aws\u codepippeline\u webhook.pprod\u webhook.url}
并运行terraform output gh\u url
。查看更新后的问题,我得到了输出,还有一些附加信息。