Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MS] Fix crash #7353, and support bool and int outputs #13670

Merged
merged 3 commits into from
May 3, 2017
Merged

[MS] Fix crash #7353, and support bool and int outputs #13670

merged 3 commits into from
May 3, 2017

Conversation

StephenWeatherford
Copy link
Contributor

Fix crash for outputs of type Object (#7353), and support bool and int outputs

Included in this fix:

  1. No crash
  2. Debug log indicates problem, otherwise unsupported outputs are ignored
  3. String, bool and int outputs are supported
  4. Documentation indicates these limitations

What is not included:
5) Array, object, securestring, secureobject still not supported

@StephenWeatherford
Copy link
Contributor Author

StephenWeatherford commented Apr 14, 2017

All tests are passing except TestAccAzureRMVirtualMachineExtension_importBasic, but that tests fails for us even without any changes. Is there a known issue with this test?

        (map[string]string) (len=7) { 
         (string) (len=15) "access_policy.#": (string) (len=1) "1", 
         (string) (len=33) "access_policy.0.key_permissions.#": (string) (len=1) "1", 
         (string) (len=33) "access_policy.0.key_permissions.0": (string) (len=3) "all", 
         (string) (len=25) "access_policy.0.object_id": (string) (len=36) "72a793c6-8ef9-412a-8673-f2c16f6c7060", 
         (string) (len=36) "access_policy.0.secret_permissions.#": (string) (len=1) "1", 
         (string) (len=36) "access_policy.0.secret_permissions.0": (string) (len=3) "all", 
         (string) (len=25) "access_policy.0.tenant_id": (string) (len=36) "72f988bf-86f1-41af-91ab-2d7cd011db47" 
        } 
         
=== RUN   TestAccAzureRMLoadBalancerBackEndAddressPool_importBasic 
--- PASS: TestAccAzureRMLoadBalancerBackEndAddressPool_importBasic (102.31s) 
=== RUN   TestAccAzureRMLoadBalancerNatPool_importBasic 
--- PASS: TestAccAzureRMLoadBalancerNatPool_importBasic (99.70s) 
=== RUN   TestAccAzureRMLoadBalancerNatRule_importBasic 
--- PASS: TestAccAzureRMLoadBalancerNatRule_importBasic (101.22s) 
=== RUN   TestAccAzureRMLoadBalancerProbe_importBasic 
--- PASS: TestAccAzureRMLoadBalancerProbe_importBasic (102.05s) 
=== RUN   TestAccAzureRMLoadBalancerRule_importBasic 
--- PASS: TestAccAzureRMLoadBalancerRule_importBasic (85.24s) 
=== RUN   TestAccAzureRMLoadBalancer_importBasic 
--- PASS: TestAccAzureRMLoadBalancer_importBasic (58.10s) 
=== RUN   TestAccAzureRMLocalNetworkGateway_importBasic 
--- PASS: TestAccAzureRMLocalNetworkGateway_importBasic (93.32s) 
=== RUN   TestAccAzureRMManagedDisk_importEmpty 
--- PASS: TestAccAzureRMManagedDisk_importEmpty (296.58s) 
=== RUN   TestAccAzureRMNetworkSecurityGroup_importBasic 
--- PASS: TestAccAzureRMNetworkSecurityGroup_importBasic (93.83s) 
=== RUN   TestAccAzureRMNetworkSecurityRule_importBasic 
--- PASS: TestAccAzureRMNetworkSecurityRule_importBasic (119.09s) 
=== RUN   TestAccAzureRMPublicIpStatic_importBasic 
--- PASS: TestAccAzureRMPublicIpStatic_importBasic (79.74s) 
=== RUN   TestAccAzureRMResourceGroup_importBasic 
--- PASS: TestAccAzureRMResourceGroup_importBasic (37.57s) 
=== RUN   TestAccAzureRMRouteTable_importBasic 
--- PASS: TestAccAzureRMRouteTable_importBasic (78.10s) 
=== RUN   TestAccAzureRMRoute_importBasic 
--- PASS: TestAccAzureRMRoute_importBasic (133.93s) 
=== RUN   TestAccAzureRMServiceBusNamespace_importBasic 
--- PASS: TestAccAzureRMServiceBusNamespace_importBasic (312.91s) 
=== RUN   TestAccAzureRMServiceBusSubscription_importBasic 
--- PASS: TestAccAzureRMServiceBusSubscription_importBasic (318.48s) 
=== RUN   TestAccAzureRMServiceBusTopic_importBasic 
--- PASS: TestAccAzureRMServiceBusTopic_importBasic (300.95s) 
=== RUN   TestAccAzureRMSqlFirewallRule_importBasic 
--- PASS: TestAccAzureRMSqlFirewallRule_importBasic (83.81s) 
=== RUN   TestAccAzureRMSqlServer_importBasic 
--- PASS: TestAccAzureRMSqlServer_importBasic (69.80s) 
=== RUN   TestAccAzureRMStorageAccount_importBasic 
--- PASS: TestAccAzureRMStorageAccount_importBasic (88.28s) 
=== RUN   TestAccAzureRMSubnet_importBasic 
--- PASS: TestAccAzureRMSubnet_importBasic (105.90s) 
=== RUN   TestAccAzureRMTrafficManagerEndpoint_importBasic 
--- PASS: TestAccAzureRMTrafficManagerEndpoint_importBasic (67.93s) 
=== RUN   TestAccAzureRMTrafficManagerProfile_importBasic 
--- PASS: TestAccAzureRMTrafficManagerProfile_importBasic (54.88s) 
=== RUN   TestAccAzureRMVirtualMachineExtension_importBasic 
panic: test timed out after 2h0m0s 
  
goroutine 36879 [running]: 
testing.startAlarm.func1() 
    /usr/local/go/src/testing/testing.go:1023 +0xf9 
created by time.goFunc 
    /usr/local/go/src/time/sleep.go:170 +0x44 
  
goroutine 1 [chan receive, 9 minutes]: 
testing.(*T).Run(0xc4201d0ea0, 0xcca67c, 0x31, 0xd13738, 0xc420195d01) 
    /usr/local/go/src/testing/testing.go:698 +0x2f4 
testing.runTests.func1(0xc4201d0ea0) 
    /usr/local/go/src/testing/testing.go:882 +0x67 
testing.tRunner(0xc4201d0ea0, 0xc420195de0) 
    /usr/local/go/src/testing/testing.go:657 +0x96 
testing.runTests(0xc420119a80, 0x10b5b80, 0x133, 0x133, 0xc420195f38) 
    /usr/local/go/src/testing/testing.go:888 +0x2c1 
testing.(*M).Run(0xc42004df20, 0xc420195f20) 
    /usr/local/go/src/testing/testing.go:822 +0xfc 
main.main() 
    github.com/hashicorp/terraform/builtin/providers/azurerm/_test/_testmain.go:654 +0xf7 
  
goroutine 17 [syscall, 119 minutes, locked to thread]: 
runtime.goexit() 
    /usr/local/go/src/runtime/asm_amd64.s:2197 +0x1 
  
goroutine 34640 [semacquire, 4 minutes]: 
sync.runtime_Semacquire(0xc42027132c) 
    /usr/local/go/src/runtime/sema.go:47 +0x34 
sync.(*WaitGroup).Wait(0xc420271320) 
    /usr/local/go/src/sync/waitgroup.go:131 +0x7a 
github.com/hashicorp/terraform/dag.(*Walker).Wait(0xc4202712d0, 0x0, 0x0) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/dag/walk.go:110 +0x61 
github.com/hashicorp/terraform/dag.(*AcyclicGraph).Walk(0xc420265f90, 0xc42032bc70, 0x0, 0x0) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/dag/dag.go:171 +0xf9 
github.com/hashicorp/terraform/terraform.(*Graph).walk(0xc420265f90, 0x1089560, 0xc42057f550, 0x0, 0x0) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/terraform/graph.go:171 +0x3b7 
github.com/hashicorp/terraform/terraform.(*Graph).Walk(0xc420265f90, 0x1089560, 0xc42057f550, 0xc42055f3e0, 0x1) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/terraform/graph.go:44 +0x3f 
github.com/hashicorp/terraform/terraform.(*Context).walk(0xc4200a4120, 0xc420265f90, 0x0, 0xc420265f07, 0x0, 0x0, 0xc42055fd40) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/terraform/context.go:799 +0x213 
github.com/hashicorp/terraform/terraform.(*Context).Apply(0xc4200a4120, 0x0, 0x0, 0x0) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/terraform/context.go:477 +0x10d 
github.com/hashicorp/terraform/helper/resource.testStep(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/helper/resource/testing_config.go:73 +0xed7 
github.com/hashicorp/terraform/helper/resource.Test(0x10876c0, 0xc4202009c0, 0x0, 0xc42034a5e0, 0xc4201b5080, 0x0, 0x0, 0xd14220, 0xc4202e0360, 0x2, ...) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/helper/resource/testing.go:337 +0xa4f 
github.com/hashicorp/terraform/builtin/providers/azurerm.TestAccAzureRMVirtualMachineExtension_importBasic(0xc4202009c0) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/builtin/providers/azurerm/import_arm_virtual_machine_extension_test.go:33 +0x4af 
testing.tRunner(0xc4202009c0, 0xd13738) 
    /usr/local/go/src/testing/testing.go:657 +0x96 
created by testing.(*T).Run 
    /usr/local/go/src/testing/testing.go:697 +0x2ca 
  
goroutine 9093 [select, 102 minutes]: 
net/http.(*persistConn).readLoop(0xc420316480) 
    /usr/local/go/src/net/http/transport.go:1599 +0x9ec 
created by net/http.(*Transport).dialConn 
    /usr/local/go/src/net/http/transport.go:1117 +0xa35 
  
goroutine 4662 [select, 108 minutes]: 
net/http.(*persistConn).writeLoop(0xc4202e0b40) 
    /usr/local/go/src/net/http/transport.go:1704 +0x43a 
created by net/http.(*Transport).dialConn 
    /usr/local/go/src/net/http/transport.go:1118 +0xa5a 
  
goroutine 36766 [select]: 
github.com/hashicorp/terraform/dag.(*Walker).waitDeps(0xc4202712d0, 0xc743c0, 0xc4208e8418, 0xc420482ae0, 0xc420092000, 0xc420915140) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/dag/walk.go:414 +0x309 
created by github.com/hashicorp/terraform/dag.(*Walker).Update 
    /home/Stephen/go/src/github.com/hashicorp/terraform/dag/walk.go:303 +0xd8c 
  
goroutine 9094 [select, 102 minutes]: 
net/http.(*persistConn).writeLoop(0xc420316480) 
    /usr/local/go/src/net/http/transport.go:1704 +0x43a 
created by net/http.(*Transport).dialConn 
    /usr/local/go/src/net/http/transport.go:1118 +0xa5a 
  
goroutine 6118 [select, 106 minutes]: 
net/http.(*persistConn).readLoop(0xc420211e60) 
    /usr/local/go/src/net/http/transport.go:1599 +0x9ec 
created by net/http.(*Transport).dialConn 
    /usr/local/go/src/net/http/transport.go:1117 +0xa35 
  
goroutine 5377 [select, 107 minutes]: 
net/http.(*persistConn).writeLoop(0xc420317b00) 
    /usr/local/go/src/net/http/transport.go:1704 +0x43a 
created by net/http.(*Transport).dialConn 
    /usr/local/go/src/net/http/transport.go:1118 +0xa5a 
  
goroutine 36756 [select]: 
github.com/hashicorp/terraform/dag.(*Walker).waitDeps(0xc4202712d0, 0xc743c0, 0xc4208e83c8, 0xc420482600, 0xc420271570, 0xc420914540) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/dag/walk.go:414 +0x309 
created by github.com/hashicorp/terraform/dag.(*Walker).Update 
    /home/Stephen/go/src/github.com/hashicorp/terraform/dag/walk.go:303 +0xd8c 
  
goroutine 4661 [select, 108 minutes]: 
net/http.(*persistConn).readLoop(0xc4202e0b40) 
    /usr/local/go/src/net/http/transport.go:1599 +0x9ec 
created by net/http.(*Transport).dialConn 
    /usr/local/go/src/net/http/transport.go:1117 +0xa35 
  
goroutine 36848 [IO wait]: 
net.runtime_pollWait(0x7fbda5c26ea8, 0x72, 0xe) 
    /usr/local/go/src/runtime/netpoll.go:164 +0x59 
net.(*pollDesc).wait(0xc4201236b8, 0x72, 0x1083b80, 0x107c530) 
    /usr/local/go/src/net/fd_poll_runtime.go:75 +0x38 
net.(*pollDesc).waitRead(0xc4201236b8, 0xc4208fb800, 0x800) 
    /usr/local/go/src/net/fd_poll_runtime.go:80 +0x34 
net.(*netFD).Read(0xc420123650, 0xc4208fb800, 0x800, 0x800, 0x0, 0x1083b80, 0x107c530) 
    /usr/local/go/src/net/fd_unix.go:250 +0x1b7 
net.(*conn).Read(0xc4208e8298, 0xc4208fb800, 0x800, 0x800, 0x0, 0x0, 0x0) 
    /usr/local/go/src/net/net.go:181 +0x70 
crypto/tls.(*block).readFromUntil(0xc4202c6000, 0x7fbda5c27820, 0xc4208e8298, 0x5, 0xc4208e8298, 0x28) 
    /usr/local/go/src/crypto/tls/conn.go:488 +0x98 
crypto/tls.(*Conn).readRecord(0xc420813c00, 0xd15517, 0xc420813d20, 0x456cc0) 
    /usr/local/go/src/crypto/tls/conn.go:590 +0xc4 
crypto/tls.(*Conn).Read(0xc420813c00, 0xc4204d2000, 0x1000, 0x1000, 0x0, 0x0, 0x0) 
    /usr/local/go/src/crypto/tls/conn.go:1134 +0x11d 
net/http.(*persistConn).Read(0xc4201a27e0, 0xc4204d2000, 0x1000, 0x1000, 0x5, 0x454dc0, 0xc420186300) 
    /usr/local/go/src/net/http/transport.go:1316 +0x14b 
bufio.(*Reader).fill(0xc420186180) 
    /usr/local/go/src/bufio/bufio.go:97 +0x117 
bufio.(*Reader).Peek(0xc420186180, 0x1, 0xc42004bbe5, 0xc420452301, 0x4, 0xc4201861e0, 0x0) 
    /usr/local/go/src/bufio/bufio.go:129 +0x67 
net/http.(*persistConn).readLoop(0xc4201a27e0) 
    /usr/local/go/src/net/http/transport.go:1474 +0x196 
created by net/http.(*Transport).dialConn 
    /usr/local/go/src/net/http/transport.go:1117 +0xa35 
  
goroutine 3949 [select, 109 minutes]: 
net/http.(*persistConn).readLoop(0xc4200a5320) 
    /usr/local/go/src/net/http/transport.go:1599 +0x9ec 
created by net/http.(*Transport).dialConn 
    /usr/local/go/src/net/http/transport.go:1117 +0xa35 
  
goroutine 36769 [select, 4 minutes]: 
github.com/hashicorp/terraform/dag.(*Walker).walkVertex(0xc4202712d0, 0xc17580, 0xc4206d2e50, 0xc420556a80) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/dag/walk.go:341 +0x67b 
created by github.com/hashicorp/terraform/dag.(*Walker).Update 
    /home/Stephen/go/src/github.com/hashicorp/terraform/dag/walk.go:310 +0x9ca 
  
goroutine 6888 [select, 105 minutes]: 
net/http.(*persistConn).writeLoop(0xc420210900) 
    /usr/local/go/src/net/http/transport.go:1704 +0x43a 
created by net/http.(*Transport).dialConn 
    /usr/local/go/src/net/http/transport.go:1118 +0xa5a 
  
goroutine 5376 [select, 107 minutes]: 
net/http.(*persistConn).readLoop(0xc420317b00) 
    /usr/local/go/src/net/http/transport.go:1599 +0x9ec 
created by net/http.(*Transport).dialConn 
    /usr/local/go/src/net/http/transport.go:1117 +0xa35 
  
goroutine 36775 [select, 4 minutes]: 
github.com/hashicorp/terraform/dag.(*Walker).walkVertex(0xc4202712d0, 0xc743c0, 0xc4208e8418, 0xc420556bc0) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/dag/walk.go:341 +0x67b 
created by github.com/hashicorp/terraform/dag.(*Walker).Update 
    /home/Stephen/go/src/github.com/hashicorp/terraform/dag/walk.go:310 +0x9ca 
  
goroutine 8449 [select, 103 minutes]: 
net/http.(*persistConn).readLoop(0xc4204eaa20) 
    /usr/local/go/src/net/http/transport.go:1599 +0x9ec 
created by net/http.(*Transport).dialConn 
    /usr/local/go/src/net/http/transport.go:1117 +0xa35 
  
goroutine 3950 [select, 109 minutes]: 
net/http.(*persistConn).writeLoop(0xc4200a5320) 
    /usr/local/go/src/net/http/transport.go:1704 +0x43a 
created by net/http.(*Transport).dialConn 
    /usr/local/go/src/net/http/transport.go:1118 +0xa5a 
  
goroutine 6119 [select, 106 minutes]: 
net/http.(*persistConn).writeLoop(0xc420211e60) 
    /usr/local/go/src/net/http/transport.go:1704 +0x43a 
created by net/http.(*Transport).dialConn 
    /usr/local/go/src/net/http/transport.go:1118 +0xa5a 
  
goroutine 36759 [select]: 
github.com/hashicorp/terraform/dag.(*Walker).waitDeps(0xc4202712d0, 0xc17580, 0xc4206d2e50, 0xc420482750, 0xc4202718f0, 0xc4209148a0) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/dag/walk.go:414 +0x309 
created by github.com/hashicorp/terraform/dag.(*Walker).Update 
    /home/Stephen/go/src/github.com/hashicorp/terraform/dag/walk.go:303 +0xd8c 
  
goroutine 7668 [select, 104 minutes]: 
net/http.(*persistConn).readLoop(0xc4202e0d80) 
    /usr/local/go/src/net/http/transport.go:1599 +0x9ec 
created by net/http.(*Transport).dialConn 
    /usr/local/go/src/net/http/transport.go:1117 +0xa35 
  
goroutine 6887 [select, 105 minutes]: 
net/http.(*persistConn).readLoop(0xc420210900) 
    /usr/local/go/src/net/http/transport.go:1599 +0x9ec 
created by net/http.(*Transport).dialConn 
    /usr/local/go/src/net/http/transport.go:1117 +0xa35 
  
goroutine 8450 [select, 103 minutes]: 
net/http.(*persistConn).writeLoop(0xc4204eaa20) 
    /usr/local/go/src/net/http/transport.go:1704 +0x43a 
created by net/http.(*Transport).dialConn 
    /usr/local/go/src/net/http/transport.go:1118 +0xa5a 
  
goroutine 7669 [select, 104 minutes]: 
net/http.(*persistConn).writeLoop(0xc4202e0d80) 
    /usr/local/go/src/net/http/transport.go:1704 +0x43a 
created by net/http.(*Transport).dialConn 
    /usr/local/go/src/net/http/transport.go:1118 +0xa5a 
  
goroutine 36828 [IO wait]: 
net.runtime_pollWait(0x7fbda5c26de8, 0x72, 0x6) 
    /usr/local/go/src/runtime/netpoll.go:164 +0x59 
net.(*pollDesc).wait(0xc420088068, 0x72, 0x1083b80, 0x107c530) 
    /usr/local/go/src/net/fd_poll_runtime.go:75 +0x38 
net.(*pollDesc).waitRead(0xc420088068, 0xc42083c000, 0x2000) 
    /usr/local/go/src/net/fd_poll_runtime.go:80 +0x34 
net.(*netFD).Read(0xc420088000, 0xc42083c000, 0x2000, 0x2000, 0x0, 0x1083b80, 0x107c530) 
    /usr/local/go/src/net/fd_unix.go:250 +0x1b7 
net.(*conn).Read(0xc4208e8000, 0xc42083c000, 0x2000, 0x2000, 0x0, 0x0, 0x0) 
    /usr/local/go/src/net/net.go:181 +0x70 
crypto/tls.(*block).readFromUntil(0xc4203a8de0, 0x7fbda5c27820, 0xc4208e8000, 0x5, 0xc4208e8000, 0x28) 
    /usr/local/go/src/crypto/tls/conn.go:488 +0x98 
crypto/tls.(*Conn).readRecord(0xc4201fbc00, 0xd15517, 0xc4201fbd20, 0x0) 
    /usr/local/go/src/crypto/tls/conn.go:590 +0xc4 
crypto/tls.(*Conn).Read(0xc4201fbc00, 0xc4203a2000, 0x1000, 0x1000, 0x0, 0x0, 0x0) 
    /usr/local/go/src/crypto/tls/conn.go:1134 +0x11d 
net/http.(*persistConn).Read(0xc4201a25a0, 0xc4203a2000, 0x1000, 0x1000, 0x5, 0xc4203b5b60, 0x18) 
    /usr/local/go/src/net/http/transport.go:1316 +0x14b 
bufio.(*Reader).fill(0xc420697620) 
    /usr/local/go/src/bufio/bufio.go:97 +0x117 
bufio.(*Reader).Peek(0xc420697620, 0x1, 0x0, 0x1, 0x0, 0xc420799e00, 0x0) 
    /usr/local/go/src/bufio/bufio.go:129 +0x67 
net/http.(*persistConn).readLoop(0xc4201a25a0) 
    /usr/local/go/src/net/http/transport.go:1474 +0x196 
created by net/http.(*Transport).dialConn 
    /usr/local/go/src/net/http/transport.go:1117 +0xa35 
  
goroutine 36764 [select]: 
github.com/hashicorp/terraform/dag.(*Walker).waitDeps(0xc4202712d0, 0xbddf40, 0x10d6328, 0xc4204829f0, 0xc420271e30, 0xc420914e40) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/dag/walk.go:414 +0x309 
created by github.com/hashicorp/terraform/dag.(*Walker).Update 
    /home/Stephen/go/src/github.com/hashicorp/terraform/dag/walk.go:303 +0xd8c 
  
goroutine 36755 [select, 4 minutes]: 
github.com/hashicorp/terraform/terraform.(*Context).watchStop.func1(0xc42055f3e0, 0xc420914c60, 0xc42055f320, 0xc42057f550) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/terraform/context.go:912 +0x61c 
created by github.com/hashicorp/terraform/terraform.(*Context).watchStop 
    /home/Stephen/go/src/github.com/hashicorp/terraform/terraform/context.go:957 +0xc4 
  
goroutine 36773 [select, 4 minutes]: 
github.com/hashicorp/terraform/dag.(*Walker).walkVertex(0xc4202712d0, 0xbe80a0, 0x10d6328, 0xc420556940) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/dag/walk.go:341 +0x67b 
created by github.com/hashicorp/terraform/dag.(*Walker).Update 
    /home/Stephen/go/src/github.com/hashicorp/terraform/dag/walk.go:310 +0x9ca 
  
goroutine 36768 [select, 4 minutes]: 
github.com/hashicorp/terraform/dag.(*Walker).walkVertex(0xc4202712d0, 0xbddf40, 0x10d6328, 0xc420556a00) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/dag/walk.go:341 +0x67b 
created by github.com/hashicorp/terraform/dag.(*Walker).Update 
    /home/Stephen/go/src/github.com/hashicorp/terraform/dag/walk.go:310 +0x9ca 
  
goroutine 36829 [select]: 
net/http.(*persistConn).writeLoop(0xc4201a25a0) 
    /usr/local/go/src/net/http/transport.go:1704 +0x43a 
created by net/http.(*Transport).dialConn 
    /usr/local/go/src/net/http/transport.go:1118 +0xa5a 
  
goroutine 36774 [select, 4 minutes]: 
github.com/hashicorp/terraform/dag.(*Walker).walkVertex(0xc4202712d0, 0xc743c0, 0xc4208e83c8, 0xc420556980) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/dag/walk.go:341 +0x67b 
created by github.com/hashicorp/terraform/dag.(*Walker).Update 
    /home/Stephen/go/src/github.com/hashicorp/terraform/dag/walk.go:310 +0x9ca 
  
goroutine 36776 [select]: 
github.com/hashicorp/terraform/vendor/github.com/Azure/go-autorest/autorest.DelayForBackoff(0x2540be400, 0x1, 0xc420799740, 0xc13180) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/vendor/github.com/Azure/go-autorest/autorest/sender.go:261 +0x187 
github.com/hashicorp/terraform/vendor/github.com/Azure/go-autorest/autorest.AfterDelay.func1.1(0xc420215500, 0xc420402bc0, 0x1, 0xc4204eeb60) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/vendor/github.com/Azure/go-autorest/autorest/sender.go:76 +0x5a 
github.com/hashicorp/terraform/vendor/github.com/Azure/go-autorest/autorest.SenderFunc.Do(0xc420402bc0, 0xc420215500, 0xc4204eeb58, 0x1, 0x1) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/vendor/github.com/Azure/go-autorest/autorest/sender.go:25 +0x30 
github.com/hashicorp/terraform/vendor/github.com/Azure/go-autorest/autorest.SendWithSender(0x10829c0, 0xc420894c80, 0xc420215500, 0xc4204eeb58, 0x1, 0x1, 0xa, 0x0, 0x0) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/vendor/github.com/Azure/go-autorest/autorest/sender.go:67 +0x75 
github.com/hashicorp/terraform/vendor/github.com/Azure/go-autorest/autorest/azure.DoPollForAsynchronous.func1.1(0xc420215500, 0xc420402180, 0x1, 0xc420926d80) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/vendor/github.com/Azure/go-autorest/autorest/azure/async.go:67 +0x31c 
github.com/hashicorp/terraform/vendor/github.com/Azure/go-autorest/autorest.SenderFunc.Do(0xc420402180, 0xc420215000, 0xc420926d78, 0x1, 0x1) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/vendor/github.com/Azure/go-autorest/autorest/sender.go:25 +0x30 
github.com/hashicorp/terraform/vendor/github.com/Azure/go-autorest/autorest.SendWithSender(0x10829c0, 0xc420894c80, 0xc420215000, 0xc420926d78, 0x1, 0x1, 0xc42023bcc0, 0xbacfe0, 0xcab7bb) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/vendor/github.com/Azure/go-autorest/autorest/sender.go:67 +0x75 
github.com/hashicorp/terraform/vendor/github.com/Azure/azure-sdk-for-go/arm/network.SubnetsClient.DeleteSender(0x1080000, 0xc42078f900, 0x1082ec0, 0xc420301700, 0x0, 0x0, 0xdf8475800, 0xd18c2e2800, 0x3, 0x6fc23ac00, ...) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/vendor/github.com/Azure/azure-sdk-for-go/arm/network/subnets.go:170 +0xce 
github.com/hashicorp/terraform/vendor/github.com/Azure/azure-sdk-for-go/arm/network.SubnetsClient.Delete(0x1080000, 0xc42078f900, 0x1082ec0, 0xc420301700, 0x0, 0x0, 0xdf8475800, 0xd18c2e2800, 0x3, 0x6fc23ac00, ...) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/vendor/github.com/Azure/azure-sdk-for-go/arm/network/subnets.go:130 +0x11e 
github.com/hashicorp/terraform/builtin/providers/azurerm.resourceArmSubnetDelete(0xc42042c770, 0xc0ea40, 0xc4208ce000, 0x0, 0x0) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/builtin/providers/azurerm/resource_arm_subnet.go:188 +0x2a9 
github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc4201ac9c0, 0xc420265ea0, 0xc420391f20, 0xc0ea40, 0xc4208ce000, 0xc420217101, 0x33, 0x0) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/helper/schema/resource.go:159 +0x57d 
github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc42016cee0, 0xc420481e50, 0xc420265ea0, 0xc420391f20, 0x1, 0x3d, 0x36000) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/helper/schema/provider.go:242 +0x9b 
github.com/hashicorp/terraform/terraform.(*EvalApply).Eval(0xc420217080, 0x108b560, 0xc4203d6460, 0x2, 0x2, 0xca7d2f, 0x4) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/terraform/eval_apply.go:57 +0x232 
github.com/hashicorp/terraform/terraform.EvalRaw(0x107eb40, 0xc420217080, 0x108b560, 0xc4203d6460, 0x0, 0x0, 0x0, 0x25) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/terraform/eval.go:53 +0x175 
github.com/hashicorp/terraform/terraform.(*EvalIf).Eval(0xc42034f170, 0x108b560, 0xc4203d6460, 0x2, 0x2, 0xca7d2f, 0x4) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/terraform/eval_if.go:21 +0x95 
github.com/hashicorp/terraform/terraform.EvalRaw(0x107f080, 0xc42034f170, 0x108b560, 0xc4203d6460, 0x0, 0x0, 0x0, 0x0) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/terraform/eval.go:53 +0x175 
github.com/hashicorp/terraform/terraform.(*EvalSequence).Eval(0xc420391d00, 0x108b560, 0xc4203d6460, 0x2, 0x2, 0xca7d2f, 0x4) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/terraform/eval_sequence.go:14 +0xc1 
github.com/hashicorp/terraform/terraform.EvalRaw(0x107f500, 0xc420391d00, 0x108b560, 0xc4203d6460, 0x2b, 0x0, 0x0, 0x2b) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/terraform/eval.go:53 +0x175 
github.com/hashicorp/terraform/terraform.(*EvalOpFilter).Eval(0xc42034f1d0, 0x108b560, 0xc4203d6460, 0x2, 0x2, 0xca7d2f, 0x4) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/terraform/eval_filter_operation.go:37 +0x4c 
github.com/hashicorp/terraform/terraform.EvalRaw(0x107f2c0, 0xc42034f1d0, 0x108b560, 0xc4203d6460, 0xbc7380, 0xc42023b6ca, 0xbacfe0, 0xc42023ba60) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/terraform/eval.go:53 +0x175 
github.com/hashicorp/terraform/terraform.Eval(0x107f2c0, 0xc42034f1d0, 0x108b560, 0xc4203d6460, 0xc42034f1d0, 0x107f2c0, 0xc42034f1d0, 0x4e) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/terraform/eval.go:34 +0x4d 
github.com/hashicorp/terraform/terraform.(*Graph).walk.func1(0xc743c0, 0xc4208e8408, 0x0, 0x0) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/terraform/graph.go:126 +0xd4d 
github.com/hashicorp/terraform/dag.(*Walker).walkVertex(0xc4202712d0, 0xc743c0, 0xc4208e8408, 0xc420556c00) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/dag/walk.go:387 +0x392 
created by github.com/hashicorp/terraform/dag.(*Walker).Update 
    /home/Stephen/go/src/github.com/hashicorp/terraform/dag/walk.go:310 +0x9ca 
  
goroutine 36760 [select]: 
github.com/hashicorp/terraform/dag.(*Walker).waitDeps(0xc4202712d0, 0xbe80a0, 0x10d6328, 0xc420482780, 0xc420271ab0, 0xc420914a20) 
    /home/Stephen/go/src/github.com/hashicorp/terraform/dag/walk.go:414 +0x309 
created by github.com/hashicorp/terraform/dag.(*Walker).Update 
    /home/Stephen/go/src/github.com/hashicorp/terraform/dag/walk.go:303 +0xd8c 
  
goroutine 36849 [select]: 
net/http.(*persistConn).writeLoop(0xc4201a27e0) 
    /usr/local/go/src/net/http/transport.go:1704 +0x43a 
created by net/http.(*Transport).dialConn 
    /usr/local/go/src/net/http/transport.go:1118 +0xa5a 
exit status 2 
FAIL    github.com/hashicorp/terraform/builtin/providers/azurerm    7200.207s 
Makefile:48: recipe for target 'testacc' failed 
make: *** [testacc] Error 1 
Stephen@stephweu2:~/go/src/github.com/hashicorp/terraform$  

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @StephenWeatherford

Thanks for this contribution :)

I've left a few comments inline, but this is looking good. The tests pass too:

$ envchain azurerm make testacc TEST=./builtin/providers/azurerm TESTARGS='-run=TestAccAzureRMTemplateDe'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/04/20 10:43:26 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/azurerm -v -run=TestAccAzureRMTemplateDe -timeout 120m
=== RUN   TestAccAzureRMTemplateDeployment_basic
--- PASS: TestAccAzureRMTemplateDeployment_basic (276.07s)
=== RUN   TestAccAzureRMTemplateDeployment_disappears
--- PASS: TestAccAzureRMTemplateDeployment_disappears (272.96s)
=== RUN   TestAccAzureRMTemplateDeployment_withParams
--- PASS: TestAccAzureRMTemplateDeployment_withParams (276.59s)
=== RUN   TestAccAzureRMTemplateDeployment_withOutputs
--- PASS: TestAccAzureRMTemplateDeployment_withOutputs (280.15s)
=== RUN   TestAccAzureRMTemplateDeployment_withError
--- PASS: TestAccAzureRMTemplateDeployment_withError (185.68s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/azurerm	1291.473s

Thanks!

outputStringValue = "1"
} else {
return fmt.Errorf("Invalid value %s for boolean output %s", outputValue, key)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be able to use Go's built-in Boolean conversion method here:

boolValue, ok := outputValue.(bool)
if !ok {
  return fmt.Errorf("[ERROR] Output was a Bool, but was not a Boolean Value: '%+v'", outputValue)
}
outputStringValue = strconv.FormatBool(boolValue)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, most of the code I see does not add [ERROR] to error messages, just to logging? What's the standard? Presumably [ERROR]'s not needed since it already shows up as an error?

Copy link
Contributor Author

@StephenWeatherford StephenWeatherford Apr 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding Booleans, the documentation in https://www.terraform.io/docs/configuration/variables.html is a little confusing, but it looked to me like I should be explicitly using "0" and "1" instead of "false" and "true". Is that correct? If I set an output in a .tf file to be based off of a Boolean variable, I get "0" and "1" values. (Also, as far as I can tell, there's no way to configure azurerm_template_deployment.outputs to be a map of interface{}, it has to be a consistent element value.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, most of the code I see does not add [ERROR] to error messages, just to logging? What's the standard? Presumably [ERROR]'s not needed since it already shows up as an error?

Correct - apologies, I should have given a better example. It's needed on Printf statements, but Errors get it automatically

Regarding Booleans, the documentation in https://www.terraform.io/docs/configuration/variables.html is a little confusing, but it looked to me like I should be explicitly using "0" and "1" instead of "false" and "true". Is that correct? If I set an output in a .tf file to be based off of a Boolean variable, I get "0" and "1" values.

Usually, we'd just rely on the d.Set method to handle serializing these objects into State, and not handle that directly. However given these are having to be cast to a string - I think it makes the most sense to serialize them using Go's built in strconv.ParseBool() / strconv.FormatBool() methods, so we can switch it out easily in the future?

outputType := outputMap["type"]
var outputStringValue string

switch outputType {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the Documentation shows the value for type can be in lower-case - it'd be great to make this check ignore the case, e.g.:

switch strings.ToLower(outputType) {
  case "bool":
...

outputMap := output.(map[string]interface{})
outputValue, ok := outputMap["value"]
if !ok {
// No value
continue
}
outputType := outputMap["type"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we check for the existence of the type field as we are for the value field above?

case "Int":
outputStringValue = fmt.Sprint(outputValue)

case "SecureString", "Object", "SecureObject", "Array":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this Case statement seeing as the Type's aren't supported?

case "SecureString", "Object", "SecureObject", "Array":
fallthrough
default:
log.Printf("[WARNING] Ignoring output %s: Outputs of type %s are not currently supported in azurerm_deployment_template.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we update this to use [WARN] rather than [WARNING]?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, is there a way to actual print an actual warning in the main Terraform output (as opposed to just the debugging output)? I originally returned an error here, but that caused problems because the outputs still ended up in the state file and continued causing errors even after the user corrected the problem). Haven't investigated how to fix that and return an actual error.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, is there a way to actual print an actual warning in the main Terraform output (as opposed to just the debugging output)? I originally returned an error here, but that caused problems because the outputs still ended up in the state file and continued causing errors even after the user corrected the problem). Haven't investigated how to fix that and return an actual error.

Unfortunately not from within a CRUD method - that's only possible during Schema Validation.

Potentially we could validate the Template via the ValidateFunc to ensure there's only Output's of supported types - however I believe a warning in the documentation should suffice for now?

@@ -98,6 +98,7 @@ The following arguments are supported:
The following attributes are exported:

* `id` - The Template Deployment ID.
* `outputs` - A map of supported scalar output types returned from the deployment (currently, Azure template outputs of type String, Int and Bool are supported, and are converted to strings - others will be ignored).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently, Azure template outputs of type String, Int and Bool are supported, and are converted to strings - others will be ignored

Is it worth changing Azure template outputs -> AzureRM Template Deployment Outputs of.. for consistency here?

…t outputs

Included in this fix:
1) No crash
2) Debug log indicates problem, otherwise unsupported outputs are ignored
3) String, bool and int outputs are supported
4) Documentation indicates these limitations
What is not included:
5) Array, object, securestring, secureobject still not supported
outputMap := output.(map[string]interface{})
outputValue, ok := outputMap["value"]
if !ok {
// No value
continue
}
outputType := outputMap["type"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since these come straight from Azure, and it does its own type checks, I've removed those checks in my code.

@StephenWeatherford
Copy link
Contributor Author

@tombuildsstuff Fixes made, see comments for some questions.

==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/04/20 23:28:32 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/azurerm -v -test.run TestAccAzureRMTemplateDe -timeout 120m
=== RUN TestAccAzureRMTemplateDeployment_basic
--- PASS: TestAccAzureRMTemplateDeployment_basic (234.90s)
=== RUN TestAccAzureRMTemplateDeployment_disappears
--- PASS: TestAccAzureRMTemplateDeployment_disappears (219.01s)
=== RUN TestAccAzureRMTemplateDeployment_withParams
--- PASS: TestAccAzureRMTemplateDeployment_withParams (218.98s)
=== RUN TestAccAzureRMTemplateDeployment_withOutputs
--- PASS: TestAccAzureRMTemplateDeployment_withOutputs (219.38s)
=== RUN TestAccAzureRMTemplateDeployment_withError
--- PASS: TestAccAzureRMTemplateDeployment_withError (95.32s)
PASS
ok github.com/hashicorp/terraform/builtin/providers/azurerm 987.591s

@tombuildsstuff tombuildsstuff removed the request for review from stack72 April 24, 2017 11:22
@tombuildsstuff
Copy link
Contributor

Hi @StephenWeatherford

Sorry for the delay getting back to this!

I've replied to the questions in-line - the one thing outstanding is the Boolean serialisation; if we can switch it out for strconv.FormatBool() then this looks good to merge :)

Thanks :)

@tombuildsstuff tombuildsstuff added the waiting-response An issue/pull request is waiting for a response from the community label May 2, 2017
@StephenWeatherford
Copy link
Contributor Author

StephenWeatherford commented May 2, 2017

@tombuildsstuff Okay, changed to str.FormatBool(). Thanks.

==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/05/02 19:12:22 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/azurerm -v -test.run TestAccAzureRMTemplateDeployment -timeout 120m
=== RUN TestAccAzureRMTemplateDeployment_basic
--- PASS: TestAccAzureRMTemplateDeployment_basic (219.57s)
=== RUN TestAccAzureRMTemplateDeployment_disappears
--- PASS: TestAccAzureRMTemplateDeployment_disappears (204.40s)
=== RUN TestAccAzureRMTemplateDeployment_withParams
--- PASS: TestAccAzureRMTemplateDeployment_withParams (204.68s)
=== RUN TestAccAzureRMTemplateDeployment_withOutputs
--- PASS: TestAccAzureRMTemplateDeployment_withOutputs (203.99s)
=== RUN TestAccAzureRMTemplateDeployment_withError
--- PASS: TestAccAzureRMTemplateDeployment_withError (111.01s)
PASS
ok github.com/hashicorp/terraform/builtin/providers/azurerm 943.663s

@StephenWeatherford StephenWeatherford changed the title Fix crash #7353, and support bool and int outputs [MS] Fix crash #7353, and support bool and int outputs May 2, 2017
@tombuildsstuff tombuildsstuff removed the waiting-response An issue/pull request is waiting for a response from the community label May 3, 2017
Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @StephenWeatherford

Thanks for the continued effort here. I've taken another look and this looks good to me :)

Thanks!

@tombuildsstuff
Copy link
Contributor

Tests pass:
screen shot 2017-05-03 at 08 04 30

@tombuildsstuff tombuildsstuff merged commit 3383222 into hashicorp:master May 3, 2017
tombuildsstuff added a commit that referenced this pull request May 3, 2017
@StephenWeatherford
Copy link
Contributor Author

StephenWeatherford commented May 3, 2017 via email

@ghost
Copy link

ghost commented Apr 12, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants