terraform/builtin/providers
Paul Stack 03e4e00673 provider/aws: Refresh ssm document from state on 404 (#14279)
* provider/aws: Refresh ssm document from state on 404

Originally reported in #13976

When an SSM Document was deleted outside of Terraform, a terraform
refresh would return the following:

```
% terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

aws_ssm_document.foo: Refreshing state... (ID: test_document-stack72)
Error refreshing state: 1 error(s) occurred:

* aws_ssm_document.foo: aws_ssm_document.foo: [ERROR] Error describing SSM document: InvalidDocument:
	status code: 400, request id: 70c9bed1-33bb-11e7-99aa-697e9b0914e9

```

On applying this patch, it now looks as follows:

```
% terraform plan
  [WARN] /Users/stacko/Code/go/bin/terraform-provider-aws overrides an internal plugin for aws-provider.
    If you did not expect to see this message you will need to remove the old plugin.
    See https://www.terraform.io/docs/internals/internal-plugins.html
  Refreshing Terraform state in-memory prior to plan...
  The refreshed state will be used to calculate this plan, but will not be
  persisted to local or remote state storage.

  aws_ssm_document.foo: Refreshing state... (ID: test_document-stack72)
  The Terraform execution plan has been generated and is shown below.
  Resources are shown in alphabetical order for quick scanning. Green resources
  will be created (or destroyed and then created if an existing resource
  exists), yellow resources are being changed in-place, and red resources
  will be destroyed. Cyan entries are data sources to be read.

  Note: You didn't specify an "-out" parameter to save this plan, so when
  "apply" is called, Terraform can't guarantee this is what will execute.

  + aws_ssm_document.foo
      arn:              "<computed>"
      content:          "    {\n      \"schemaVersion\": \"1.2\",\n      \"description\": \"Check ip configuration of a Linux instance.\",\n      \"parameters\": {\n\n      },\n      \"runtimeConfig\": {\n        \"aws:runShellScript\": {\n          \"properties\": [\n            {\n              \"id\": \"0.aws:runShellScript\",\n              \"runCommand\": [\"ifconfig\"]\n            }\n          ]\n        }\n      }\n    }\n"
      created_date:     "<computed>"
      default_version:  "<computed>"
      description:      "<computed>"
      document_type:    "Command"
      hash:             "<computed>"
      hash_type:        "<computed>"
      latest_version:   "<computed>"
      name:             "test_document-stack72"
      owner:            "<computed>"
      parameter.#:      "<computed>"
      platform_types.#: "<computed>"
      schema_version:   "<computed>"
      status:           "<computed>"

  Plan: 1 to add, 0 to change, 0 to destroy.
```

* Update resource_aws_ssm_document.go
2017-05-08 13:50:16 +03:00
..
alicloud
archive
arukas
atlas
aws provider/aws: Refresh ssm document from state on 404 (#14279) 2017-05-08 13:50:16 +03:00
azure
azurerm Improve tests and documentation for azurerm_template_deployment outputs (#13567) 2017-05-05 17:51:59 +01:00
bitbucket
chef
circonus provider/circonus: Remove ValidateFunc from Computed-only field 2017-04-23 12:40:17 +02:00
clc
cloudflare
cloudstack
cobbler
consul provider/consul: Remove ValidateFunc from Computed-only fields 2017-04-23 12:40:58 +02:00
datadog
digitalocean provider/digitalocean: prevent new resources when using ID's of images with slugs (#13879) 2017-04-27 18:48:58 +01:00
dme provider/dme: Save records in lowercase to avoid diffs (#14130) 2017-05-02 06:36:16 +01:00
dns
dnsimple Make dnsimple_records importable (#9130) 2017-04-27 02:07:23 +12:00
docker
dyn Add verbose Dyn provider logs (#14076) 2017-05-06 01:24:14 +02:00
external
fastly Makes cache setting condition optional in fastly service 2017-04-30 17:16:06 -03:00
github Clears branch protection from state only if error is an HTTP 404 (#13887) 2017-04-24 18:19:27 +01:00
gitlab provider/gitlab: Adding default values to gitlab_project_hook resource 2017-05-04 19:59:32 +03:00
google proovider/google: Adding test for google_pubsub_subscription path 2017-05-05 16:57:24 +03:00
grafana
heroku providers/heroku: import heroku_app resource (#14248) 2017-05-05 22:26:04 +03:00
icinga2
ignition ignition: internal cache moved to global, instead per provider instance 2017-04-23 20:32:04 +02:00
influxdb
kubernetes
librato
local
logentries provider/logentries: Refresh from state when resources not found (#13810) 2017-04-20 21:38:37 +03:00
mailgun
mysql
newrelic
nomad provider/nomad: Update Nomad provider tests 2017-05-04 15:52:55 -04:00
ns1 provider/ns1: record documentation improvements (#13786) 2017-04-21 12:38:05 +03:00
null
oneandone Provider Oneandone (#13633) 2017-04-21 17:19:10 +03:00
opc refactor the read 2017-04-26 09:25:10 -06:00
openstack provider/openstack: Handle disassociating FloatingIP's from a server 2017-05-04 20:23:02 +01:00
opsgenie
packet
pagerduty
postgresql Merge pull request #11452 from pbthorste/master 2017-05-02 11:41:26 -04:00
powerdns
profitbricks Private images Fix (#14173) 2017-05-03 22:29:03 +03:00
rabbitmq provider/rabbitmq: Add test for binding properties_key (#13797) 2017-04-21 20:01:46 +03:00
rancher provider/rancher: Remove DiffSuppressFunc from Computed-only fields 2017-04-23 12:41:18 +02:00
random
rundeck
scaleway
softlayer
spotinst
statuscake
template provider/template: template_dir explicitly create dest dir 2017-04-25 10:48:26 -07:00
terraform
test core: Restore CountBoundaryTransformer to apply, add/adjust tests 2017-04-19 22:23:52 -07:00
tls
triton provider/triton: Add `insecure_skip_tls_verify` 2017-04-28 11:56:26 -07:00
ultradns use validation helper 2017-04-25 20:06:33 +00:00
vault provider/vault: vault_auth_backend resource (#10988) 2017-05-03 22:43:10 +03:00
vcd
vsphere