github.com/mohanarpit/terraform@v0.6.16-0.20160909104007-291f29853544/builtin/providers/consul/test-fixtures/README.md (about)

     1  # Running Consul for Terraform Acceptance Tests
     2  
     3  ## TLS
     4  
     5  Some of the acceptance tests for the `consul` provider use
     6  TLS. To service these tests, a Consul server must be started
     7  with HTTPS enabled with TLS certificates.
     8  
     9  ### Test fixtures
    10  
    11  File | Description
    12  --- | ---
    13  `agent.json.example` | Configures the Consul agent to respond to HTTPS requests, and verifies the authenticity of HTTPS requests
    14  `agentcert.pem` | A PEM-encoded certificate used by the Consul agent, valid only for 127.0.0.1 signed by `cacert.pem`, expires 2026
    15  `agentkey.pem` | A PEM-encoded private key used by the Consul agent
    16  `cacert.pem` | A PEM-encoded Certificate Authority, expires 2036
    17  `usercert.pem` | A PEM-encoded certificate used by the Terraform acceptance tests, signed by `cacert.pem`, expires 2026
    18  `userkey.pem` | A PEM-encoded private key used by the Terraform acceptance tests
    19  
    20  ### Start
    21  
    22  Start a Consul server configured to serve HTTP traffic, and validate incoming
    23  HTTPS requests.
    24  
    25      ~/.go/src/github.com/hashicorp/terraform> consul agent \
    26          -bind 127.0.0.1 \
    27          -data-dir=/tmp \
    28          -dev \
    29          -config-file=builtin/providers/consul/text-fixtures/agent.json.example \
    30          -server
    31  
    32  ### Test
    33  
    34  With TLS, `CONSUL_HTTP_ADDR` must match the Common Name of the agent certificate.
    35  
    36      ~/.go/src/github.com/hashicorp/terraform> CONSUL_CERT_FILE=test-fixtures/usercert.pem \
    37          CONSUL_KEY_FILE=test-fixtures/userkey.pem \
    38          CONSUL_CA_FILE=test-fixtures/cacert.pem \
    39          CONSUL_SCHEME=https \
    40          CONSUL_HTTP_ADDR=127.0.0.1:8943  \
    41          make testacc TEST=./builtin/providers/consul/