我正在测试使用正确的子网和规则创建多个AWS实例,方法是使用下面的地形测试代码激发多个IP地址来测试AWS基础设施,但它只使用第一个IP并命中4次。一旦它收到超时消息,它就会退出,并不会转到下一个IP。我希望它能同时命中main.tf地形文件中的两个IP地址并命中服务器。这是一个新手,所以我想知道我缺少了什么?如果有人能帮我的话。
list - ["52.205.87.202","54.89.179.76"] which is coming from main.tf ** Code :** `func TestTerraformHelloWorldExample(t *testing.T) { // Construct the terraform options with default retryable errors to handle the most common // retryable errors in terraform testing. terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ // Set the path to the Terraform code that will be tested. TerraformDir: "/Users/prernaprakash/Desktop/Terraform multiple/dev", }) defer terraform.Destroy(t, terraformOptions) terraform.InitAndApply(t, terraformOptions) //defer terraform.Destory(t, terraformOptions) publicIp := terraform.OutputList(t, terraformOptions, "public_ipv4_address") fmt.Print(publicIp) //var index int = 0 for i := 0; i < len(publicIp); i++ { url := fmt.Sprintf("http://%s:8080", publicIp[i]) http_helper.HttpGetWithRetry(t, url, nil, 200, "I have made a Terraform module", 2, 2*time.Second) fmt.Println(err) } }` **output**
http://52.205.87.202:8080TestTerraformHelloWorldExample2023-02-07T20:43:25Z重试。go:91:HTTP GET到URLhttp://52.205.87.202:8080TestTerraformHelloWorldExample2023-02-07T20:43:25Z http_helper.go:59:对URL进行http GET调用http://52.205.87.202:8080TestTerraformHelloWorldExample2023-02-07T20:43:35Z重试。go:103:HTTP GET到URLhttp://52.205.87.202:8080返回错误:Get“http://52.205.87.202:8080“:超过了上下文截止时间(等待标头时超过了Client.Timeout)。休眠2s后将重试。TestTerraformHelloWorldExample2023-02-07T20:43:37Z重试。go:91:HTTP GET到URLhttp://52.205.87.202:8080TestTerraformHelloWorldExample2023-02-07T20:43:37Z http_helper.go:59:对URL进行http GET调用http://52.205.87.202:8080TestTerraformHelloWorldExample2023-02-07T20:43:47Z重试。go:103:HTTP GET到URLhttp://52.205.87.202:8080返回错误:Get“http://52.205.87.202:8080“:超过了上下文截止时间(等待标头时超过了Client.Timeout)。休眠2s后将重试。TestTerraformHelloWorldExample2023-02-07T20:43:49Z重试。go:91:HTTP GET到URLhttp://52.205.87.202:8080TestTerraformHelloWorldExample2023-02-07T20:43:49Z http_helper.go:59:对URL进行http GET调用http://52.205.87.202:8080TestTerraformHelloWorldExample2023-02-07T20:43:59Z重试。go:103:HTTP GET到URLhttp://52.205.87.202:8080返回错误:Get“http://52.205.87.202:8080“:超过了上下文截止时间(等待标头时超过了Client.Timeout)。休眠2秒后将重试。
did go through few stack overflow sites and couple of documents.