provider/google: Set instances to computed in compute_instance_group (#15025)

Fixes: #15024

```
% make testacc TEST=./builtin/providers/google TESTARGS='-run=TestAccComputeInstanceGroup_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/06/02 20:48:54 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/google -v -run=TestAccComputeInstanceGroup_ -timeout 120m
=== RUN   TestAccComputeInstanceGroup_basic
--- PASS: TestAccComputeInstanceGroup_basic (123.64s)
=== RUN   TestAccComputeInstanceGroup_update
--- PASS: TestAccComputeInstanceGroup_update (150.37s)
=== RUN   TestAccComputeInstanceGroup_outOfOrderInstances
--- PASS: TestAccComputeInstanceGroup_outOfOrderInstances (103.71s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/google	377.737s
```
This commit is contained in:
Paul Stack 2017-06-02 22:15:10 +03:00 committed by GitHub
parent bae0a71a11
commit e9aaf58098
2 changed files with 16 additions and 15 deletions

View File

@ -21,42 +21,43 @@ func resourceComputeInstanceGroup() *schema.Resource {
SchemaVersion: 1, SchemaVersion: 1,
Schema: map[string]*schema.Schema{ Schema: map[string]*schema.Schema{
"name": &schema.Schema{ "name": {
Type: schema.TypeString, Type: schema.TypeString,
Required: true, Required: true,
ForceNew: true, ForceNew: true,
}, },
"zone": &schema.Schema{ "zone": {
Type: schema.TypeString, Type: schema.TypeString,
Required: true, Required: true,
ForceNew: true, ForceNew: true,
}, },
"description": &schema.Schema{ "description": {
Type: schema.TypeString, Type: schema.TypeString,
Optional: true, Optional: true,
ForceNew: true, ForceNew: true,
}, },
"instances": &schema.Schema{ "instances": {
Type: schema.TypeSet, Type: schema.TypeSet,
Optional: true, Optional: true,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString}, Elem: &schema.Schema{Type: schema.TypeString},
Set: schema.HashString, Set: schema.HashString,
}, },
"named_port": &schema.Schema{ "named_port": {
Type: schema.TypeList, Type: schema.TypeList,
Optional: true, Optional: true,
Elem: &schema.Resource{ Elem: &schema.Resource{
Schema: map[string]*schema.Schema{ Schema: map[string]*schema.Schema{
"name": &schema.Schema{ "name": {
Type: schema.TypeString, Type: schema.TypeString,
Required: true, Required: true,
}, },
"port": &schema.Schema{ "port": {
Type: schema.TypeInt, Type: schema.TypeInt,
Required: true, Required: true,
}, },
@ -64,23 +65,23 @@ func resourceComputeInstanceGroup() *schema.Resource {
}, },
}, },
"network": &schema.Schema{ "network": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"project": &schema.Schema{ "project": {
Type: schema.TypeString, Type: schema.TypeString,
Optional: true, Optional: true,
ForceNew: true, ForceNew: true,
}, },
"self_link": &schema.Schema{ "self_link": {
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },
"size": &schema.Schema{ "size": {
Type: schema.TypeInt, Type: schema.TypeInt,
Computed: true, Computed: true,
}, },

View File

@ -20,7 +20,7 @@ func TestAccComputeInstanceGroup_basic(t *testing.T) {
Providers: testAccProviders, Providers: testAccProviders,
CheckDestroy: testAccComputeInstanceGroup_destroy, CheckDestroy: testAccComputeInstanceGroup_destroy,
Steps: []resource.TestStep{ Steps: []resource.TestStep{
resource.TestStep{ {
Config: testAccComputeInstanceGroup_basic(instanceName), Config: testAccComputeInstanceGroup_basic(instanceName),
Check: resource.ComposeTestCheckFunc( Check: resource.ComposeTestCheckFunc(
testAccComputeInstanceGroup_exists( testAccComputeInstanceGroup_exists(
@ -42,7 +42,7 @@ func TestAccComputeInstanceGroup_update(t *testing.T) {
Providers: testAccProviders, Providers: testAccProviders,
CheckDestroy: testAccComputeInstanceGroup_destroy, CheckDestroy: testAccComputeInstanceGroup_destroy,
Steps: []resource.TestStep{ Steps: []resource.TestStep{
resource.TestStep{ {
Config: testAccComputeInstanceGroup_update(instanceName), Config: testAccComputeInstanceGroup_update(instanceName),
Check: resource.ComposeTestCheckFunc( Check: resource.ComposeTestCheckFunc(
testAccComputeInstanceGroup_exists( testAccComputeInstanceGroup_exists(
@ -53,7 +53,7 @@ func TestAccComputeInstanceGroup_update(t *testing.T) {
&instanceGroup), &instanceGroup),
), ),
}, },
resource.TestStep{ {
Config: testAccComputeInstanceGroup_update2(instanceName), Config: testAccComputeInstanceGroup_update2(instanceName),
Check: resource.ComposeTestCheckFunc( Check: resource.ComposeTestCheckFunc(
testAccComputeInstanceGroup_exists( testAccComputeInstanceGroup_exists(
@ -79,7 +79,7 @@ func TestAccComputeInstanceGroup_outOfOrderInstances(t *testing.T) {
Providers: testAccProviders, Providers: testAccProviders,
CheckDestroy: testAccComputeInstanceGroup_destroy, CheckDestroy: testAccComputeInstanceGroup_destroy,
Steps: []resource.TestStep{ Steps: []resource.TestStep{
resource.TestStep{ {
Config: testAccComputeInstanceGroup_outOfOrderInstances(instanceName), Config: testAccComputeInstanceGroup_outOfOrderInstances(instanceName),
Check: resource.ComposeTestCheckFunc( Check: resource.ComposeTestCheckFunc(
testAccComputeInstanceGroup_exists( testAccComputeInstanceGroup_exists(