Merge branch 'master' of github.com:hashicorp/terraform
This commit is contained in:
commit
6276352b5d
|
@ -194,6 +194,11 @@ func resource_digitalocean_droplet_destroy(
|
|||
// Destroy the droplet
|
||||
err := client.DestroyDroplet(s.ID)
|
||||
|
||||
// Handle remotely destroyed droplets
|
||||
if err != nil && strings.Contains(err.Error(), "404 Not Found") {
|
||||
return nil
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error deleting Droplet: %s", err)
|
||||
}
|
||||
|
@ -208,6 +213,12 @@ func resource_digitalocean_droplet_refresh(
|
|||
client := p.client
|
||||
|
||||
droplet, err := resource_digitalocean_droplet_retrieve(s.ID, client)
|
||||
|
||||
// Handle remotely destroyed droplets
|
||||
if err != nil && strings.Contains(err.Error(), "404 Not Found") {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -149,11 +149,10 @@ func resource_digitalocean_record_update_state(
|
|||
s.Attributes["priority"] = rec.StringPriority()
|
||||
s.Attributes["port"] = rec.StringPort()
|
||||
|
||||
|
||||
// We belong to a Domain
|
||||
s.Dependencies = []terraform.ResourceDependency{
|
||||
terraform.ResourceDependency{ID: s.Attributes["domain"]},
|
||||
}
|
||||
// We belong to a Domain
|
||||
s.Dependencies = []terraform.ResourceDependency{
|
||||
terraform.ResourceDependency{ID: s.Attributes["domain"]},
|
||||
}
|
||||
|
||||
return s, nil
|
||||
}
|
||||
|
|
|
@ -820,7 +820,11 @@ func (c *Context) refreshWalkFn() depgraph.WalkFunc {
|
|||
rs.Type = r.State.Type
|
||||
|
||||
c.sl.Lock()
|
||||
c.state.Resources[r.Id] = rs
|
||||
if rs.ID == "" {
|
||||
delete(c.state.Resources, r.Id)
|
||||
} else {
|
||||
c.state.Resources[r.Id] = rs
|
||||
}
|
||||
c.sl.Unlock()
|
||||
|
||||
for _, h := range c.hooks {
|
||||
|
|
|
@ -1639,6 +1639,37 @@ func TestContextRefresh(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestContextRefresh_delete(t *testing.T) {
|
||||
p := testProvider("aws")
|
||||
c := testConfig(t, "refresh-basic")
|
||||
ctx := testContext(t, &ContextOpts{
|
||||
Config: c,
|
||||
Providers: map[string]ResourceProviderFactory{
|
||||
"aws": testProviderFuncFixed(p),
|
||||
},
|
||||
State: &State{
|
||||
Resources: map[string]*ResourceState{
|
||||
"aws_instance.web": &ResourceState{
|
||||
ID: "foo",
|
||||
Type: "aws_instance",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
p.RefreshFn = nil
|
||||
p.RefreshReturn = nil
|
||||
|
||||
s, err := ctx.Refresh()
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
if len(s.Resources) > 0 {
|
||||
t.Fatal("resources should be empty")
|
||||
}
|
||||
}
|
||||
|
||||
func TestContextRefresh_ignoreUncreated(t *testing.T) {
|
||||
p := testProvider("aws")
|
||||
c := testConfig(t, "refresh-basic")
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
layout: "docs"
|
||||
page_title: "Configuration"
|
||||
sidebar_current: "docs-config"
|
||||
---
|
||||
|
||||
# Configuration
|
||||
|
||||
Terraform uses text files to describe infrastructure and to set variables.
|
||||
These text files are called Terraform _configurations_ and end in
|
||||
`.tf`. This section talks about the format of these files as well as
|
||||
how they're loaded.
|
||||
|
||||
The format of the configuration files are able to be in two formats:
|
||||
Terraform format and JSON. The Terraform format is more human-readable,
|
||||
supports comments, and is the generally recommended format for most
|
||||
Terraform files. The JSON format is meant for machines to create,
|
||||
modify, and update, but can also be done by Terraform operators if
|
||||
you prefer. Terraform format ends in `.tf` and JSON format ends in
|
||||
`.tf.json`.
|
||||
|
||||
Click a sub-section in the navigation to the left to learn more about
|
||||
Terraform configuration.
|
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
layout: "docs"
|
||||
page_title: "Load Order and Semantics"
|
||||
sidebar_current: "docs-config-load"
|
||||
---
|
||||
|
||||
# Load Order and Semantics
|
||||
|
||||
When invoking any command that loads the Terraform configuration,
|
||||
Terraform loads all configuration files within the directory
|
||||
specified in alphabetical order. The flies loaded must end in
|
||||
either `.tf` or `.tf.json` to specify the format that is in use.
|
||||
Otherwise, the files are ignored.
|
||||
|
||||
[Override](/docs/configuration/override.html)
|
||||
files are the exception, as they're loaded after all non-override
|
||||
files, in alphabetical order.
|
||||
|
||||
The configuration within the loaded files are appended to each
|
||||
other. This is in contrast to being merged. This means that two
|
||||
resources with the same name are not merged, and will instead
|
||||
cause a validation error. This is in contrast to
|
||||
[overrides](/docs/configuration/override.html),
|
||||
which do merge.
|
||||
|
||||
The order of variables, resources, etc. defined within the
|
||||
configuration doesn't matter. Terraform configurations are
|
||||
[declarative](http://en.wikipedia.org/wiki/Declarative_programming),
|
||||
so references to other resources and variables do not depend
|
||||
on the order they're defined.
|
|
@ -8,87 +8,98 @@
|
|||
|
||||
<li<%= sidebar_current("docs-config") %>>
|
||||
<a href="/docs/configuration/index.html">Configuration</a>
|
||||
<ul class="nav">
|
||||
</ul>
|
||||
</li>
|
||||
<ul class="nav">
|
||||
<li<%= sidebar_current("docs-config-load") %>>
|
||||
<a href="/docs/configuration/load.html">Load Order and Semantics</a>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-config-syntax") %>>
|
||||
<a href="/docs/configuration/syntax.html">Configuration Syntax</a>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-config-override") %>>
|
||||
<a href="/docs/configuration/override.html">Overrides</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-commands") %>>
|
||||
<a href="/docs/commands/index.html">Commands (CLI)</a>
|
||||
<ul class="nav">
|
||||
<li<%= sidebar_current("docs-commands-apply") %>>
|
||||
<a href="/docs/commands/apply.html">apply</a>
|
||||
</li>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-commands-graph") %>>
|
||||
<a href="/docs/commands/graph.html">graph</a>
|
||||
</li>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-commands-output") %>>
|
||||
<a href="/docs/commands/output.html">output</a>
|
||||
</li>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-commands-plan") %>>
|
||||
<a href="/docs/commands/plan.html">plan</a>
|
||||
</li>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-commands-refresh") %>>
|
||||
<a href="/docs/commands/refresh.html">refresh</a>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-commands-show") %>>
|
||||
<li<%= sidebar_current("docs-commands-show") %>>
|
||||
<a href="/docs/commands/show.html">show</a>
|
||||
</li>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-providers") %>>
|
||||
<a href="/docs/providers/index.html">Providers</a>
|
||||
<ul class="nav">
|
||||
<ul class="nav">
|
||||
<li<%= sidebar_current("docs-providers-aws") %>>
|
||||
<a href="/docs/providers/aws/index.html">AWS</a>
|
||||
</li>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-providers-do") %>>
|
||||
<a href="/docs/providers/do/index.html">DigitalOcean</a>
|
||||
</li>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-providers-heroku") %>>
|
||||
<a href="/docs/providers/heroku/index.html">Heroku</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-provisioners") %>>
|
||||
<a href="/docs/provisioners/index.html">Provisioners</a>
|
||||
<ul class="nav">
|
||||
<ul class="nav">
|
||||
<li<%= sidebar_current("docs-provisioners-connection") %>>
|
||||
<a href="/docs/provisioners/connection.html">connection</a>
|
||||
</li>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-provisioners-file") %>>
|
||||
<a href="/docs/provisioners/file.html">file</a>
|
||||
</li>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-provisioners-local") %>>
|
||||
<a href="/docs/provisioners/local-exec.html">local-exec</a>
|
||||
</li>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-provisioners-remote") %>>
|
||||
<a href="/docs/provisioners/remote-exec.html">remote-exec</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-guides") %>>
|
||||
<a href="/docs/guides/index.html">Guides</a>
|
||||
<ul class="nav">
|
||||
<ul class="nav">
|
||||
<li<%= sidebar_current("docs-guides-servers") %>>
|
||||
<a href="/docs/guides/servers.html">Adding/Removing Servers</a>
|
||||
</li>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-guides-bootstrapping") %>>
|
||||
<a href="/docs/guides/bootstrapping.html">Bootstrapping</a>
|
||||
</li>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-guides-dns-cache") %>>
|
||||
<a href="/docs/guides/dns-cache.html">DNS Caching</a>
|
||||
|
@ -100,43 +111,43 @@
|
|||
|
||||
<li<%= sidebar_current("docs-guides-external") %>>
|
||||
<a href="/docs/guides/external.html">External Services</a>
|
||||
</li>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-guides-leader") %>>
|
||||
<li<%= sidebar_current("docs-guides-leader") %>>
|
||||
<a href="/docs/guides/leader-election.html">Leader Election</a>
|
||||
</li>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-guides-datacenters") %>>
|
||||
<li<%= sidebar_current("docs-guides-datacenters") %>>
|
||||
<a href="/docs/guides/datacenters.html">Multiple Datacenters</a>
|
||||
</li>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-guides-outage") %>>
|
||||
<li<%= sidebar_current("docs-guides-outage") %>>
|
||||
<a href="/docs/guides/outage.html">Outage Recovery</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<li<%= sidebar_current("docs-internals") %>>
|
||||
<a href="/docs/internals/index.html">Internals</a>
|
||||
<ul class="nav">
|
||||
<ul class="nav">
|
||||
<li<%= sidebar_current("docs-internals-architecture") %>>
|
||||
<a href="/docs/internals/architecture.html">Architecture</a>
|
||||
</li>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-internals-consensus") %>>
|
||||
<a href="/docs/internals/consensus.html">Consensus Protocol</a>
|
||||
</li>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-internals-gossip") %>>
|
||||
<a href="/docs/internals/gossip.html">Gossip Protocol</a>
|
||||
</li>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-internals-sessions") %>>
|
||||
<a href="/docs/internals/sessions.html">Sessions</a>
|
||||
</li>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-internals-security") %>>
|
||||
<a href="/docs/internals/security.html">Security Model</a>
|
||||
</li>
|
||||
</li>
|
||||
|
||||
<li<%= sidebar_current("docs-internals-jepsen") %>>
|
||||
<a href="/docs/internals/jepsen.html">Jepsen Testing</a>
|
||||
|
@ -147,5 +158,5 @@
|
|||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= yield %>
|
||||
<%= yield %>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue