小编Tho*_*ley的帖子

创建 CloudFront 分配时出错:NoSuchOrigin:

我正在尝试使用 Terraform 部署 Cloudfront 发行版,但在指定 origin_id 时出现错误

Cloudfront 通过 Route53 查找指向负载均衡器。

resource "aws_cloudfront_distribution" "my-app" {
  origin {
    custom_origin_config {
      http_port              = 443
      https_port             = 443
      origin_protocol_policy = "https-only"
      origin_ssl_protocols   = ["TLSv1.2"]
    }

    domain_name = "${var.domain_name}"
    origin_id   = "Custom-${var.domain_name}"
  }

...

  default_cache_behavior {
    allowed_methods  = ["GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "DELETE"]
    cached_methods   = ["GET", "HEAD"]
    target_origin_id = "${local.origin_id}"

...
Run Code Online (Sandbox Code Playgroud)

其中var.domain_name是 route53 记录,local.origin_id是唯一 ID。

执行 terraform apply 时,出现此错误:

aws_cloudfront_distribution.my-app: error creating CloudFront Distribution: NoSuchOrigin: One or more …

amazon-web-services terraform terraform-provider-aws

11
推荐指数
1
解决办法
4573
查看次数

zsh:找不到命令:flake8 但已安装 flake8

我正在尝试在我的 python 代码上运行 flake8 linter,但我遇到了一些问题。

运行 pip install 给了我这个响应:

~ pip install flake8                                                                                                                                                                                                                                  
Requirement already satisfied: flake8 in ./Library/Python/2.7/lib/python/site-packages
Requirement already satisfied: enum34; python_version < "3.4" in ./Library/Python/2.7/lib/python/site-packages (from flake8)
Requirement already satisfied: configparser; python_version < "3.2" in ./Library/Python/2.7/lib/python/site-packages (from flake8)
Requirement already satisfied: mccabe<0.7.0,>=0.6.0 in ./Library/Python/2.7/lib/python/site-packages (from flake8)
Requirement already satisfied: pycodestyle<2.4.0,>=2.0.0 in ./Library/Python/2.7/lib/python/site-packages (from flake8)
Requirement already satisfied: pyflakes<1.6.0,>=1.5.0 in ./Library/Python/2.7/lib/python/site-packages (from flake8)
Run Code Online (Sandbox Code Playgroud)

但是当我尝试运行它时,我收到了这个错误。

~ flake8 --version                                                                                                                                                                                                                                    
zsh: command not found: flake8
Run Code Online (Sandbox Code Playgroud)

如果这有什么不同,我也在使用 mac。

请任何人都可以帮忙。

python zsh

4
推荐指数
2
解决办法
1万
查看次数

文字"1"中没有(Num Nat)的实例

我正在尝试使用自然数创建一些函数.

import Prelude
data Nat = Zero | Succ Nat

add:: Nat -> Nat -> Nat
add Zero n = n
add (Succ m) n = Succ (add m n)

mult :: Nat -> Nat -> Nat
mult x Zero = Zero
mult x (Succ y) = add x (mult x y)
Run Code Online (Sandbox Code Playgroud)

然后当我跑

mult 3 5
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

<interactive>:38:6: error:
• No instance for (Num Nat) arising from the literal ‘3’
• In the first argument of ‘mult’, namely ‘3’
  In …
Run Code Online (Sandbox Code Playgroud)

haskell numbers instance

0
推荐指数
1
解决办法
614
查看次数