Commit Graph

339 Commits

Author SHA1 Message Date
Matthew Frahry 0bbb0dc200 Fix for #27809 2021-03-22 14:20:54 -07:00
Matthew Frahry 3722b1b613 backend/azurerm: support for using azuread authentication for blobs 2021-03-22 10:49:34 -07:00
Matthew Frahry 341479087c backend/azurerm: adding support for azuread authentication 2021-03-22 10:15:41 -07:00
Matthew Frahry b0b0a44a67 backend/azurerm: added a feature flag for using AzureAD to authenticate 2021-03-22 09:33:57 -07:00
Matthew Frahry 05b45ab4f3 backend/azurerm: removing support for the deprecated fields 2021-03-22 09:26:06 -07:00
James Bardin 2e3aa96988
Merge pull request #28099 from jasons42/duplicate-default-workspace
Fix duplicate default state
2021-03-17 14:11:04 -04:00
James Bardin 439bf9a96d
Merge pull request #28097 from jasons42/etcdv3-acceptance-tests
Fix type conversion panic
2021-03-17 14:10:54 -04:00
James Bardin 1338502c7b
Merge pull request #26924 from remilapeyre/concurrent-locks-pg
Use a global sequence to create the IDs for each workspace
2021-03-16 11:28:04 -04:00
Jason Smith 188ea61a12 Fix duplicate default state
The default state is already explicitly added to the result slice. Added
a guard to prevent it being added a second time.

Fixes https://github.com/hashicorp/terraform/issues/28098
2021-03-15 16:33:31 -05:00
Jason Smith 3e8ebd6f40 Fix type conversion panic
etcdv3 acceptance tests fail due to attempting to pass slices of strings
for the endpoints config to HCL2ValueFromConfigValue() which does not
handle that type.

Not a pretty solution but a helper function that converts the endpoints to a slice of
empty interfaces satisfies the requirements of the
HCL2ValueFromConfigValue function.

fixes https://github.com/hashicorp/terraform/issues/28096
2021-03-15 16:09:44 -05:00
Matthew Frahry 85b9bdea96
backend/azure: azure state refreshes outside of grabbing the lock #26561 2021-02-17 15:14:47 -08:00
James Bardin b0094dbf36
Merge pull request #27678 from GreenHedgehog/master
Fix possible nil pointer dereference in azure sdk
2021-02-17 08:49:49 -05:00
Matthew Frahry cb041053e9 Merge with master 2021-02-15 14:37:40 -08:00
Matthew Frahry 2b42445454
Update client.go 2021-02-15 12:09:31 -08:00
Matthew Frahry f52a18b134
Update backend/remote-state/azure/client.go
Co-authored-by: Tom Harvey <tombuildsstuff@users.noreply.github.com>
2021-02-15 12:04:07 -08:00
GreenHedgehog d4db1d1342 fix possible nil pointer dereference in azure sdk 2021-02-03 21:09:05 +03:00
Jonathan Hall 49ee3d3ef8 Grammar nit: "setup" as a verb should be spelled "set up" 2021-01-26 20:39:11 +01:00
Nick Fagerlund ed7f97c34f Update language docs URLs in code and tests 2021-01-22 12:22:21 -08:00
James Bardin 9f2a6d33be move remaining helper packages to internal 2021-01-20 13:54:00 -05:00
James Bardin 2635b3b023 update remote state to use legacy types 2020-12-02 12:16:35 -05:00
Rémi Lapeyre d81d521bcd Use a global sequence to create the IDs for each workspace
Until now the default workspace for every project would have the ID 1,
which would make it impossible to lock them at the same time since we
use the ID to identify the lock. With a global sequence to generate the
IDs, the default workspace will now have a different ID for each project
and it will be possible to lock multiple unrelated projects at the same
time.

If an old version of Terraform tries to get the lock on a project created
with this new version it will work as we continue to use the ID of the
workspace, we just change the way we generate them.

If this version tries to get a lock on a project created by an old
version of Terraform it will work as usual, but we may encounter a
conflict with another unrelated project. This is already the current
behavior so it's not an issue to persist this behavior. As users migrate
to an up-to-date version of Terraform this will stop.

Projects already present in the database will keep their conflicting IDs,
I did not wanted to change them as users may be reading the states
directly in the database for some reason. They can if they want change
them manually to remove conflicts, newly created projects will work
without manual intervention.

Closes https://github.com/hashicorp/terraform/issues/22833
2020-11-15 14:54:57 +01:00
Upo 3b9c5e5bbb
backend/gcs: remove deprecated "path" config argument (#26841) 2020-11-06 16:35:40 -05:00
Upo 4ccc63d79d
backend: Add service account impersonation to GCS Backend and update the docs (#26700) 2020-11-06 09:06:07 -05:00
tombuildsstuff 6f244f97d1 backend/azurerm: updating to handle the field rename 2020-10-27 19:43:22 +01:00
James Bardin 0b31ffa587 use a single log writer
Use a single log writer instance for all std library logging.

Setup the std log writer in the logging package, and remove boilerplate
from test packages.
2020-10-19 14:29:54 -04:00
James Bardin 6ca477f042 move helper/logging to internal
remove a dead code file too
2020-10-19 14:27:53 -04:00
Sean Teeling 8980b6dc9e double check the state wasn't created in the short time prior to grabbing the lock 2020-10-14 20:25:41 -07:00
James Bardin b8df47c9ac add struct field names 2020-10-14 14:05:41 -04:00
Sean Teeling 7d6ec431d2 test locks in non-default workspace 2020-10-13 08:18:54 -07:00
Sean Teeling e1f1b84d67 Refresh state outside of grabbing the lock; only grab the lock on provisioning if the state file doesn't exist; this is similar to the GCS backend 2020-10-12 21:45:25 -07:00
Rémi Lapeyre 12a0a21c0b Add skip_table_creation and skip_index_creation options to the pg backend
Closes https://github.com/hashicorp/terraform/issues/25708
2020-10-12 22:47:19 +02:00
Kristin Laemmert 6f4f6fbc72 helper: deprecate pathorcontents
pathorcontents was solely used by the gcs backend. I moved the function
into the backend package so it could still be used by other backends for
good measure.
2020-10-08 08:42:16 -04:00
Kristin Laemmert d2e999ba1f
remove unused code (#26503)
* remove unused code

I've removed the provider-specific code under registry, and unused nil
backend, and replaced a call to helper from backend/oss (the other
callers of that func are provisioners scheduled to be deprecated).

I also removed the Dockerfile, as our build process uses a different
file.

Finally I removed the examples directory, which had outdated examples
and links. There are better, actively maintained examples available.

* command: remove various unused bits

* test wasn't running

* backend: remove unused err
2020-10-07 11:00:06 -04:00
Pam Selle f84a7c1d57
Merge pull request #26476 from remilapeyre/postgres-backend-escape-schema_name
Properly quote schema_name in the pg backend configuration
2020-10-05 14:57:53 -04:00
James Bardin 70652814e3 add missing Context argument 2020-10-05 14:43:46 -04:00
James Bardin 5e13d57f4e
Merge pull request #26463 from hashicorp/kt/azurerm-secret-backend-fix
AzureRM backend: correctly lookup environment from metadata host
2020-10-05 14:26:32 -04:00
Alisdair McDiarmid 35d4926bf7
Merge pull request #25837 from remilapeyre/consul-force-unlock
Fix `terraform force-unlock <lock_id>` for Consul backend
2020-10-05 13:11:08 -04:00
Rémi Lapeyre 42be5854a2 Properly quote schema_name in the pg backend configuration 2020-10-03 18:02:13 +02:00
kt b66364f7aa
AzureRM backend: correctly lookup environment from metadata host 2020-10-01 16:34:51 -07:00
Rémi Lapeyre 9acfe30ca6 Always have the default workspace in the pg backend
Closes https://github.com/hashicorp/terraform/issues/23121
2020-09-29 23:18:34 +02:00
Rémi Lapeyre 5c7008bd89 Merge remote-tracking branch 'origin/master' into consul-force-unlock 2020-09-29 10:59:36 +02:00
Alisdair McDiarmid e183163739
Merge pull request #25856 from remilapeyre/consul-split-state
Split the state in chunks when they outgrow the limit of Consul KV store
2020-09-15 10:00:25 -04:00
Alisdair McDiarmid 92abaadc02
Merge pull request #25842 from remilapeyre/consul-path-slash
Sanitize lock path for the Consul backend when it ends with a /
2020-09-11 11:14:49 -04:00
Matt Kasa c2e35ae3b5
backend/http: add support for configuration by environment variable (#25439) 2020-09-02 08:35:08 -04:00
James Bardin 0c5430f88d
Merge pull request #25585 from chushenmeshile/master
fix ossbackend only returned 100 workspaces
2020-08-19 16:55:31 -04:00
James Bardin bd5ff98ca7
Merge pull request #25830 from hashicorp/kt/secret-metadata-host
backend/azurerm: support loading environments from a metadata host
2020-08-19 13:57:10 -04:00
James Bardin d46e9a4198
Merge pull request #25770 from hashicorp/f/azure-backend-spcert
backend/azurerm: support for authenticating using a Client Certificate
2020-08-19 13:56:30 -04:00
Angie Pinilla 582fb73a7c deps: Update aws-sdk-go-based to 0.6.0 2020-08-18 12:49:31 -04:00
Rémi Lapeyre e680211bc0 Split the state in chunks when they outgrow the limit of Consul KV store
The Consul KV store limits the size of the values in the KV store to 524288
bytes. Once the state reaches this limit Consul will refuse to save it. It is
currently possible to try to bypass this limitation by enable Gzip but the issue
will manifest itself later. This is particularly inconvenient as it is possible
for the state to reach this limit without changing the Terraform configuration
as datasources or computed attributes can suddenly return more data than they
used to. Several users already had issues with this.

To fix the problem once and for all we now split the payload in chunks of 524288
bytes when they are to large and store them separatly in the KV store. A small
JSON payload that references all the chunks so we can retrieve them later and
concatenate them to reconstruct the payload.

While this has the caveat of requiring multiple calls to Consul that cannot be
done as a single transaction as those have the same size limit, we use unique
paths for the chunks and CAS when setting the last payload so possible issues
during calls to Put() should not result in unreadable states.

Closes https://github.com/hashicorp/terraform/issues/19182
2020-08-14 17:38:18 +02:00
Rémi Lapeyre 032d339915 Sanitize lock path for the Consul backend when it ends with a /
When the path ends with / (e.g. `path = "tfstate/"), the lock
path used will contain two consecutive slashes (e.g. `tfstate//.lock`) which
Consul does not accept.

This change the lock path so it is sanitized to `tfstate/.lock`.

If the user has two different Terraform project, one with `path = "tfstate"` and
the other with `path = "tfstate/"`, the paths for the locks will be the same
which will be confusing as locking one project will lock both. I wish it were
possible to forbid ending slashes altogether but doing so would require all
users currently having an ending slash in the path to manually move their
Terraform state and would be a poor user experience.

Closes https://github.com/hashicorp/terraform/issues/15747
2020-08-13 16:29:43 +02:00