Commit Graph

20008 Commits

Author SHA1 Message Date
Martin Atkins
0f9af4dfa9 build: configuration for building "release" docker images
These are different than our "full" images because they include a binary
already released to releases.hashicorp.com, whereas the root Dockerfile
directly builds from the current work tree.

This particular Dockerfile is not intended to be run manually, but rather
exists only to drive the dockerhub automated build.
2017-07-19 12:59:13 -07:00
Martin Atkins
909c45488f build: Move the "full" Dockerfile into the root of our main repo
Previously this lived in a separate repo docker-hub-images, shared with
other products. Having multiple products sharing a repo complicates
release processes and works against some assumptions made by the Dockerhub
build system.

The "full" Dockerfile contains a Terraform binary built from source, and
so it can be used with any arbitrary Terraform source tree. This doesn't
yet include the "light" Dockerfile, which instead makes an image from
official binaries already on releases.hashicorp.com. That will follow in
a subsequent commit.
2017-07-19 12:40:21 -07:00
James Bardin
cb5739f1a0 update CHANGELOG.md 2017-07-19 12:57:07 -04:00
Martin Atkins
f6dace3476 website: document the Checkpoint service and how to disable it
This is documented for all other Hashicorp products using this service but
was missed for Terraform. This serves as a disclosure of the fact that
Terraform reaches out to a Hashicorp service, an explanation of the
purpose of that request, and instructions on how to disable it in
environments where it is inappropriate or cannot be supported due to a
firewall or other connectivity restrictions.
2017-07-18 16:48:16 -07:00
Martin Atkins
da0aec1b32 website: attempt to clarify "terraform import" usage docs
Based on feedback from #15569 that the previous example was too abstract
and did not give enough context about what each of the different arguments
mean and how they generalize to other resource types.
2017-07-18 16:35:14 -07:00
James Bardin
9a7ffbfb1b Merge pull request #15566 from hashicorp/jbardin/state-serial
Add warning to mismatched plan state
2017-07-18 18:09:00 -04:00
James Bardin
dd9a54c661 Merge pull request #15435 from hashicorp/jbardin/state-path-message
only show state path help if state is local
2017-07-18 18:08:18 -04:00
Martin Atkins
c57dbebe84 documentation: explain provider dev environment setup
The intent here is just to introduce some initial docs on our recommended
way to develop plugins in the same GOPATH as Terraform itself. The
documentation in this area needs some more fundamental rework as it is
rather outdated and mis-organized, but that's outside the scope of what
this change is trying to achieve.
2017-07-18 14:36:01 -07:00
James Bardin
eb02467298 Merge pull request #15588 from hashicorp/jbardin/no-graph-config
graph should not panic with no config
2017-07-18 13:10:00 -04:00
James Bardin
f10163ecc7 graph should not panic with no config
The backends replace a nil module tree with an empty one before building
the graph, so the graph command needs to do the same.
2017-07-18 13:03:57 -04:00
Martin Atkins
a2ef0ce9a3 Update CHANGELOG.md 2017-07-18 10:02:41 -07:00
Martin Atkins
ac250d2792 plugin/discovery: trim off .exe suffix when parsing filenames
On Windows systems the plugin binaries use a .exe suffix, which we were
misparsing as part of either the "v" or "x" parts of the filename.

This fixes #15578.
2017-07-18 10:00:23 -07:00
Dhananjay Balan
fd4a2fa262 website: Correct usage for force-unlock command 2017-07-18 09:02:29 -07:00
Martin Atkins
8e0fefda1f Merge #15509: End-to-end test harness and some initial tests 2017-07-17 14:33:41 -07:00
Martin Atkins
23f9c8785e command/e2etest: an initial test for the primary workflow
This e2etest runs an init, plan, apply, destroy sequence against a test
configuration using the real template and null providers downloaded from
the official repository.

This test _does_ trample a bit on the scope of some already-existing
tests, but this is mainly just to check our assumptions about how
Terraform behaves to ensure that we can reach our main conclusion here:
that the main Terraform workflow commands interact correctly with each
other in real use and we can complete the full workflow.
2017-07-17 14:25:33 -07:00
Martin Atkins
52df81ee49 command/e2etest: test that we can install provider plugins
We already have good tests for the business logic around provider
installation, but the existing tests all stub out the main repository
server. This test completes that coverage by verifying that the installer
is able to run against the real repository and install an official release
of the template provider.
2017-07-17 14:25:33 -07:00
Martin Atkins
0e0b0d125a command/e2etest: "terraform version" test
This basic test is here primarily because it's one of the few that can
run without reaching out to external services, and so it means our usual
test runs will catch situations where the main executable build is
somehow broken.

The version command itself is not very interesting to test, but it's
convenient in that its behavior is very predictable and self-contained.
2017-07-17 14:25:33 -07:00
Martin Atkins
fee61a44b4 command/e2etest: end-to-end testing harness
Previously we had no automated testing of whether we can produce a
Terraform executable that actually works. Our various functional tests
have good coverage of specific Terraform features and whole operations,
but we lacked end-to-end testing of actual usage of the generated binary,
without any stubbing.

This package is intended as a vehicle for such end-to-end testing. When
run normally under "go test" it will produce a build of the main Terraform
binary and make it available for tests to execute. The harness exposes
a flag for whether tests are allowed to reach out to external network
services, controlled with our standard TF_ACC environment variable, so
that basic local tests can be safely run as part of "make test" while
more elaborate tests can be run easily when desired.

It also provides a separate mode of operation where the included script
make-archive.sh can be used to produce a self-contained test archive that
can be copied to another system to run the tests there. This is intended
to allow testing of cross-compiled binaries, by shipping them over to
the target OS and architecture to run without requiring a full Go compiler
installation on the target system.

The goal here is not to test again functionality that's already
well-covered by our existing tests, but rather to test chains of normal
operations against the build binary that are not otherwise tested
together.
2017-07-17 14:25:33 -07:00
James Bardin
50f412bff4 Merge pull request #15557 from hashicorp/jbardin/consul-lock-sessions
have the consul client manage the lock session
2017-07-17 10:56:30 -04:00
James Bardin
bb13786663 Merge pull request #15559 from hashicorp/jbardin/protocol-version
allow missing x-terraform-protocol-version
2017-07-17 10:54:34 -04:00
James Bardin
a1727ec4c2 Add warning to mismatched plan state
Forward-port the plan state check from the 0.9 series.
0.10 has improved the serial handling for the state, so this adds
relevant comments and some more test coverage for the case of an
incrementing serial during apply.
2017-07-17 10:41:29 -04:00
Radek Simko
004f6cc9e2 Update CHANGELOG.md 2017-07-17 08:38:23 +01:00
Radek Simko
f979b8feef Enforce field names to be alphanum lowercase + underscores (#15562) 2017-07-17 08:37:46 +01:00
James Bardin
2b84e786e9 allow missing x-terraform-protocol-version
If the release site is missing the "x-terraform-protocol-version"
header, we should fetch the latest spec'ed release. Downloading the
wrong protocol version can't do any damage, and the version present is
more than likely compatible.
2017-07-14 15:52:41 -04:00
James Bardin
87b2c0cf8f Merge pull request #15556 from hashicorp/jbardin/backend-tests
backend state tests must honor lineage
2017-07-14 14:56:54 -04:00
James Bardin
bcb11f6d89 have the consul client manage the lock session
When a consul lock is lost, there is a possibility that the associated
session is still active. Most commonly, the long request to watch the
lock key may error out, while the session is continually refreshed at a
rate of TTL/2.

First have the lock monitor retry the lock internally for at least 10
seconds (5 attempts with the default 2 second wait time). In most cases
this will reconnect on the first try, keeping the lock channel open.

If the consul lock can't recover itself, then cancel the session as soon
as possible (terminating the PreiodicRenew will call Session.Destroy),
and start over. In the worse case, the consul agents were split, and the
session still exists on the leader so we may need to wait for the old
session TTL, plus the LockWait time to renew the lock.

We use a Context for the cancellation channels here, because that
removes the need to worry about double-closes and nil channels. It
requires an awkward adapter goroutine for now to convert the Done()
`<-chan` to a `chan` for PeriodicRenew, but makes the rest of the code
safer in the long run.
2017-07-14 14:42:42 -04:00
James Bardin
193d4b868c backend state tests must honor lineage
Remote state implementations may initialize a lineage when creating a
new named state (i.e. "workspace"). The tests were ignoring that initial
lineage to write a new state to the backend.
2017-07-14 13:50:26 -04:00
James Nugent
aa1e5e996a README: Add link to provider repos to "Developing" (#15546)
This commit adds a link to the GitHub organization which contains the
formerly-built-in providers, and modifies the `plugin-dev` target
documentation to use a provider which is unlikely to be moved out of the
core repository.
2017-07-13 20:59:20 +03:00
Jake Champlin
dd056ccf38 Merge pull request #15547 from hashicorp/b-fix-travis
fix travis for unit tests
2017-07-13 10:38:11 -07:00
Jake Champlin
3d396e108a
fix travis for unit tests 2017-07-13 13:19:24 -04:00
Radek Simko
a12daf5aba Update CHANGELOG.md 2017-07-10 21:52:49 -07:00
Radek Simko
07cbd54fbc Actively disallow reserved field names in schema (#15522) 2017-07-10 21:51:55 -07:00
James Bardin
a4ee13b8c2 Merge pull request #15506 from hashicorp/jbardin/helper-testing
Automatically insert providers for import acceptance tests
2017-07-07 17:06:46 -04:00
James Bardin
60ea42cd1c Add testProviderConfig to import tests
Provider import tests previously didn't have to supply a config, but
terraform now requires the provider to be declared for discovery.

testProviderConfig returns a stub config with provider blocks based
on the TestCase Providers. This allows basic import tests in providers
to remain unchanged.
2017-07-07 16:16:35 -04:00
James Bardin
8e2ee53ed3 Merge pull request #15501 from hashicorp/jbardin/race
Make sure shadow.closeWalker doesn't copy Mutexes
2017-07-07 12:39:46 -04:00
James Bardin
657932261b Make sure shadow.closeWalker doesn't copy Mutexes
The Close methods on shadow.Values require pointer receivers because
they contain a sync.Mutex, but that value was being copied through
Value.Interface by the closeWalker.  Because reflectwalk passes the
struct fields to the StructField method as they are defined in the
struct, and they may have been read as a value, we can't immediately
call Interface() to check the method set without possibly copying the
internal mutex values. Use the Implements method to first check if we
need to call Interface, and if it's not, then we can check if the value
is addressable.

Because of this use of reflection, we can't vet for the copying of these
locks. The minimal amount of code in the Close method left us only with
a race detected within the mutex itself, which leads to a stacktrace
pointing to the runtime rather than our code.
2017-07-07 11:20:54 -04:00
James Bardin
ac9abf579f Merge pull request #15497 from hashicorp/jbardin/race
Fix a couple races
2017-07-07 08:53:29 -04:00
James Bardin
c66dd48b6e make shadow.Value a Locker
This way it's correctly handled by CopyStructure
2017-07-06 16:58:29 -04:00
James Bardin
583cc350a9 fix minor races in workspace tests
The improved err scanner loop in meta causes these to race. There's no
need to write back to the same commands struct, so just use a new
instance in each iteration.
2017-07-06 13:49:32 -04:00
Jake Champlin
b7166905fa
v0.10.0-beta2 2017-07-06 12:43:01 -04:00
James Bardin
6ba049470e Merge pull request #15490 from hashicorp/jbardin/meta-process-order
meta process order
2017-07-06 11:41:49 -04:00
James Bardin
f7f1e8e406 Sort arguments in Meta.process
Meta.process was relying on the system readdir to order the arguments,
but readdir doesn't guarantee any ordering. Read the directory contents
as a whole and sort them in place before adding the tfvars files.
2017-07-06 11:34:47 -04:00
James Bardin
0fdcf2c01e properly cleanup and print correct error messages
Some Meta tests were not cleaning up their temp directories.

The process test wasn't printing the correct arguments in the error
messages.
2017-07-06 11:33:32 -04:00
Paul Stack
ccf27a631f Update CHANGELOG.md 2017-07-06 16:53:17 +03:00
Martin Atkins
0543574383 website: update upgrade-guide for plugin filename convention
This changed close to the release of beta1 to use underscores as the
separator and to use a lower-case "v" to avoid any issues on
case-insensitive filesystems.
2017-07-05 17:36:32 -07:00
Martin Atkins
b16f94611d Update CHANGELOG.md 2017-07-05 17:34:23 -07:00
Martin Atkins
1f1f898695 Merge #13306: automatically load variables from .auto.tfvars files 2017-07-05 17:32:12 -07:00
Robert Liebowitz
4bf2269784 Add test case for autoloading tfvars 2017-07-05 17:24:17 -07:00
Robert Liebowitz
e67ecb5ce2 Restructure Meta.process to logically group code 2017-07-05 17:24:17 -07:00
Robert Liebowitz
8d98fdecac Autoload only .auto.tfvars files 2017-07-05 17:24:17 -07:00