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,7 +149,6 @@ 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"]},
|
||||
|
|
|
@ -820,7 +820,11 @@ func (c *Context) refreshWalkFn() depgraph.WalkFunc {
|
|||
rs.Type = r.State.Type
|
||||
|
||||
c.sl.Lock()
|
||||
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.
|
|
@ -9,6 +9,17 @@
|
|||
<li<%= sidebar_current("docs-config") %>>
|
||||
<a href="/docs/configuration/index.html">Configuration</a>
|
||||
<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>
|
||||
|
||||
|
|
Loading…
Reference in New Issue