github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/builtin/providers/aws/resource_aws_subnet_migrate.go (about) 1 package aws 2 3 import ( 4 "fmt" 5 "log" 6 7 "github.com/hashicorp/terraform/terraform" 8 ) 9 10 func resourceAwsSubnetMigrateState( 11 v int, is *terraform.InstanceState, meta interface{}) (*terraform.InstanceState, error) { 12 switch v { 13 case 0: 14 log.Println("[INFO] Found AWS Subnet State v0; migrating to v1") 15 return migrateSubnetStateV0toV1(is) 16 default: 17 return is, fmt.Errorf("Unexpected schema version: %d", v) 18 } 19 } 20 21 func migrateSubnetStateV0toV1(is *terraform.InstanceState) (*terraform.InstanceState, error) { 22 if is.Empty() || is.Attributes == nil { 23 log.Println("[DEBUG] Empty Subnet State; nothing to migrate.") 24 return is, nil 25 } 26 27 log.Printf("[DEBUG] Attributes before migration: %#v", is.Attributes) 28 29 is.Attributes["assign_ipv6_address_on_creation"] = "false" 30 31 log.Printf("[DEBUG] Attributes after migration: %#v", is.Attributes) 32 return is, nil 33 }