{"action":"created","comment":{"url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls/comments/137643793","pull_request_review_id":61337669,"id":137643793,"diff_hunk":"@@ -0,0 +1,496 @@\n+package aws\n+\n+import (\n+\t\"fmt\"\n+\t\"log\"\n+\t\"regexp\"\n+\t\"time\"\n+\n+\t\"github.com/aws/aws-sdk-go/aws\"\n+\t\"github.com/aws/aws-sdk-go/service/batch\"\n+\t\"github.com/hashicorp/terraform/helper/resource\"\n+\t\"github.com/hashicorp/terraform/helper/schema\"\n+\t\"github.com/hashicorp/terraform/helper/validation\"\n+)\n+\n+const (\n+\tMANAGED   = \"MANAGED\"\n+\tUNMANAGED = \"UNMANAGED\"\n+\tEC2       = \"EC2\"\n+\tSPOT      = \"SPOT\"\n+\tENABLED   = \"ENABLED\"\n+\tDISABLED  = \"DISABLED\"\n+\tCREATING  = \"CREATING\"\n+\tDELETING  = \"DELETING\"\n+\tUPDATING  = \"UPDATING\"\n+\tDELETED   = \"DELETED\"\n+\tVALID     = \"VALID\"\n+\tFAILED    = \"FAILED\"\n+)\n+\n+var reComputeEnvironmentName = regexp.MustCompile(`^[A-Za-z0-9_]*$`)\n+var reArnOfIamRole = regexp.MustCompile(`^arn:aws:iam::[0-9]{12}:role/.*$`)\n+var reArnOfIamInstanceProfile = regexp.MustCompile(`^arn:aws:iam::[0-9]{12}:instance-profile/.*$`)\n+\n+func resourceAwsBatchComputeEnvironment() *schema.Resource {\n+\treturn &schema.Resource{\n+\t\tCreate: resourceAwsBatchComputeEnvironmentCreate,\n+\t\tRead:   resourceAwsBatchComputeEnvironmentRead,\n+\t\tUpdate: resourceAwsBatchComputeEnvironmentUpdate,\n+\t\tDelete: resourceAwsBatchComputeEnvironmentDelete,\n+\n+\t\tSchema: map[string]*schema.Schema{\n+\t\t\t\"compute_environment_name\": {\n+\t\t\t\tType:         schema.TypeString,\n+\t\t\t\tRequired:     true,\n+\t\t\t\tForceNew:     true,\n+\t\t\t\tValidateFunc: isCorrentComputeEnvironmentName,\n+\t\t\t},\n+\t\t\t\"compute_resources\": {\n+\t\t\t\tType:     schema.TypeList,\n+\t\t\t\tOptional: true,\n+\t\t\t\tMinItems: 0,\n+\t\t\t\tMaxItems: 1,\n+\t\t\t\tElem: &schema.Resource{\n+\t\t\t\t\tSchema: map[string]*schema.Schema{\n+\t\t\t\t\t\t\"bid_percentage\": {\n+\t\t\t\t\t\t\tType:     schema.TypeInt,\n+\t\t\t\t\t\t\tOptional: true,\n+\t\t\t\t\t\t\tForceNew: true,\n+\t\t\t\t\t\t},\n+\t\t\t\t\t\t\"desired_vcpus\": {\n+\t\t\t\t\t\t\tType:     schema.TypeInt,\n+\t\t\t\t\t\t\tOptional: true,\n+\t\t\t\t\t\t},\n+\t\t\t\t\t\t\"ec2_key_pair\": {\n+\t\t\t\t\t\t\tType:     schema.TypeString,\n+\t\t\t\t\t\t\tOptional: true,\n+\t\t\t\t\t\t\tForceNew: true,\n+\t\t\t\t\t\t},\n+\t\t\t\t\t\t\"image_id\": {\n+\t\t\t\t\t\t\tType:     schema.TypeString,\n+\t\t\t\t\t\t\tOptional: true,\n+\t\t\t\t\t\t\tForceNew: true,\n+\t\t\t\t\t\t},\n+\t\t\t\t\t\t\"instance_role\": {\n+\t\t\t\t\t\t\tType:         schema.TypeString,\n+\t\t\t\t\t\t\tRequired:     true,\n+\t\t\t\t\t\t\tForceNew:     true,\n+\t\t\t\t\t\t\tValidateFunc: isArnOfIamInstanceProfile,\n+\t\t\t\t\t\t},\n+\t\t\t\t\t\t\"instance_type\": {\n+\t\t\t\t\t\t\tType:     schema.TypeSet,\n+\t\t\t\t\t\t\tRequired: true,\n+\t\t\t\t\t\t\tForceNew: true,\n+\t\t\t\t\t\t\tElem:     &schema.Schema{Type: schema.TypeString},\n+\t\t\t\t\t\t},\n+\t\t\t\t\t\t\"max_vcpus\": {\n+\t\t\t\t\t\t\tType:     schema.TypeInt,\n+\t\t\t\t\t\t\tRequired: true,\n+\t\t\t\t\t\t},\n+\t\t\t\t\t\t\"min_vcpus\": {\n+\t\t\t\t\t\t\tType:     schema.TypeInt,\n+\t\t\t\t\t\t\tRequired: true,\n+\t\t\t\t\t\t},\n+\t\t\t\t\t\t\"security_group_ids\": {\n+\t\t\t\t\t\t\tType:     schema.TypeSet,\n+\t\t\t\t\t\t\tRequired: true,\n+\t\t\t\t\t\t\tForceNew: true,\n+\t\t\t\t\t\t\tElem:     &schema.Schema{Type: schema.TypeString},\n+\t\t\t\t\t\t},\n+\t\t\t\t\t\t\"spot_iam_fleet_role\": {\n+\t\t\t\t\t\t\tType:         schema.TypeString,\n+\t\t\t\t\t\t\tOptional:     true,\n+\t\t\t\t\t\t\tForceNew:     true,\n+\t\t\t\t\t\t\tValidateFunc: isArnOfIamRole,\n+\t\t\t\t\t\t},\n+\t\t\t\t\t\t\"subnets\": {\n+\t\t\t\t\t\t\tType:     schema.TypeSet,\n+\t\t\t\t\t\t\tRequired: true,\n+\t\t\t\t\t\t\tForceNew: true,\n+\t\t\t\t\t\t\tElem:     &schema.Schema{Type: schema.TypeString},\n+\t\t\t\t\t\t},\n+\t\t\t\t\t\t\"tags\": tagsSchema(),\n+\t\t\t\t\t\t\"type\": {\n+\t\t\t\t\t\t\tType:         schema.TypeString,\n+\t\t\t\t\t\t\tRequired:     true,\n+\t\t\t\t\t\t\tForceNew:     true,\n+\t\t\t\t\t\t\tValidateFunc: validation.StringInSlice([]string{EC2, SPOT}, true),\n+\t\t\t\t\t\t},\n+\t\t\t\t\t},\n+\t\t\t\t},\n+\t\t\t},\n+\t\t\t\"service_role\": {\n+\t\t\t\tType:         schema.TypeString,\n+\t\t\t\tRequired:     true,\n+\t\t\t\tValidateFunc: isArnOfIamRole,\n+\t\t\t},\n+\t\t\t\"state\": {\n+\t\t\t\tType:         schema.TypeString,\n+\t\t\t\tOptional:     true,\n+\t\t\t\tValidateFunc: validation.StringInSlice([]string{ENABLED, DISABLED}, true),\n+\t\t\t\tDefault:      \"ENABLED\",\n+\t\t\t},\n+\t\t\t\"type\": {\n+\t\t\t\tType:         schema.TypeString,\n+\t\t\t\tRequired:     true,\n+\t\t\t\tForceNew:     true,\n+\t\t\t\tValidateFunc: validation.StringInSlice([]string{MANAGED, UNMANAGED}, true),\n+\t\t\t},\n+\t\t\t\"arn\": {\n+\t\t\t\tType:     schema.TypeString,\n+\t\t\t\tComputed: true,\n+\t\t\t},\n+\t\t\t\"ecc_cluster_arn\": {\n+\t\t\t\tType:     schema.TypeString,\n+\t\t\t\tComputed: true,\n+\t\t\t},\n+\t\t\t\"status\": {\n+\t\t\t\tType:     schema.TypeString,\n+\t\t\t\tComputed: true,\n+\t\t\t},\n+\t\t\t\"status_reason\": {\n+\t\t\t\tType:     schema.TypeString,\n+\t\t\t\tComputed: true,\n+\t\t\t},\n+\t\t},\n+\t}\n+}\n+\n+func resourceAwsBatchComputeEnvironmentCreate(d *schema.ResourceData, meta interface{}) error {\n+\tconn := meta.(*AWSClient).batchconn\n+\n+\tcomputeEnvironmentName := d.Get(\"compute_environment_name\").(string)\n+\n+\tserviceRole := d.Get(\"service_role\").(string)\n+\tcomputeEnvironmentType := d.Get(\"type\").(string)\n+\n+\tinput := &batch.CreateComputeEnvironmentInput{\n+\t\tComputeEnvironmentName: aws.String(computeEnvironmentName),\n+\t\tServiceRole:            aws.String(serviceRole),\n+\t\tType:                   aws.String(computeEnvironmentType),\n+\t}\n+\n+\tif v, ok := d.GetOk(\"state\"); ok {\n+\t\tinput.State = aws.String(v.(string))\n+\t}\n+\n+\tif computeEnvironmentType == MANAGED {\n+\t\tcomputeResources := d.Get(\"compute_resources\").([]interface{})\n+\t\tif len(computeResources) == 0 {\n+\t\t\treturn fmt.Errorf(\"One compute environment is expected, but no compute environments are set\")\n+\t\t}\n+\t\tcomputeResource := computeResources[0].(map[string]interface{})\n+\n+\t\tinstanceRole := computeResource[\"instance_role\"].(string)\n+\t\tmaxvCpus := int64(computeResource[\"max_vcpus\"].(int))\n+\t\tminvCpus := int64(computeResource[\"min_vcpus\"].(int))\n+\t\tcomputeResourceType := computeResource[\"type\"].(string)\n+\n+\t\tvar instanceTypes []*string\n+\t\tfor _, v := range computeResource[\"instance_type\"].(*schema.Set).List() {\n+\t\t\tinstanceTypes = append(instanceTypes, aws.String(v.(string)))\n+\t\t}\n+\n+\t\tvar securityGroupIds []*string\n+\t\tfor _, v := range computeResource[\"security_group_ids\"].(*schema.Set).List() {\n+\t\t\tsecurityGroupIds = append(securityGroupIds, aws.String(v.(string)))\n+\t\t}\n+\n+\t\tvar subnets []*string\n+\t\tfor _, v := range computeResource[\"subnets\"].(*schema.Set).List() {\n+\t\t\tsubnets = append(subnets, aws.String(v.(string)))\n+\t\t}\n+\n+\t\tinput.ComputeResources = &batch.ComputeResource{\n+\t\t\tInstanceRole:     aws.String(instanceRole),\n+\t\t\tInstanceTypes:    instanceTypes,\n+\t\t\tMaxvCpus:         aws.Int64(maxvCpus),\n+\t\t\tMinvCpus:         aws.Int64(minvCpus),\n+\t\t\tSecurityGroupIds: securityGroupIds,\n+\t\t\tSubnets:          subnets,\n+\t\t\tType:             aws.String(computeResourceType),\n+\t\t}\n+\n+\t\tif v, ok := computeResource[\"bid_percentage\"]; ok {\n+\t\t\tinput.ComputeResources.BidPercentage = aws.Int64(int64(v.(int)))\n+\t\t}\n+\t\tif v, ok := computeResource[\"desired_vcpus\"]; ok {\n+\t\t\tinput.ComputeResources.DesiredvCpus = aws.Int64(int64(v.(int)))\n+\t\t}\n+\t\tif v, ok := computeResource[\"ec2_key_pair\"]; ok {\n+\t\t\tinput.ComputeResources.Ec2KeyPair = aws.String(v.(string))\n+\t\t}\n+\t\tif v, ok := computeResource[\"image_id\"]; ok {\n+\t\t\tinput.ComputeResources.ImageId = aws.String(v.(string))\n+\t\t}\n+\t\tif v, ok := computeResource[\"spot_iam_fleet_role\"]; ok {\n+\t\t\tinput.ComputeResources.SpotIamFleetRole = aws.String(v.(string))\n+\t\t}\n+\t\tif v, ok := computeResource[\"tags\"]; ok {\n+\t\t\tinput.ComputeResources.Tags = tagsFromMapGeneric(v.(map[string]interface{}))\n+\t\t}\n+\t}\n+\n+\tlog.Printf(\"[DEBUG] Create compute environment %s.\\n\", input)\n+\n+\tif _, err := conn.CreateComputeEnvironment(input); err != nil {\n+\t\treturn err\n+\t}\n+\n+\td.SetId(computeEnvironmentName)\n+\n+\tstateConf := &resource.StateChangeConf{\n+\t\tPending:    []string{CREATING},\n+\t\tTarget:     []string{VALID},\n+\t\tRefresh:    resourceAwsBatchComputeEnvironmentStatusRefreshFunc(d, meta),\n+\t\tTimeout:    d.Timeout(schema.TimeoutCreate),\n+\t\tMinTimeout: 5 * time.Second,\n+\t}\n+\tif _, err := stateConf.WaitForState(); err != nil {\n+\t\treturn err\n+\t}\n+\n+\treturn resourceAwsBatchComputeEnvironmentRead(d, meta)\n+}\n+\n+func resourceAwsBatchComputeEnvironmentRead(d *schema.ResourceData, meta interface{}) error {\n+\tconn := meta.(*AWSClient).batchconn\n+\n+\tcomputeEnvironmentName := d.Get(\"compute_environment_name\").(string)\n+\n+\tinput := &batch.DescribeComputeEnvironmentsInput{\n+\t\tComputeEnvironments: []*string{\n+\t\t\taws.String(computeEnvironmentName),\n+\t\t},\n+\t}\n+\n+\tlog.Printf(\"[DEBUG] Read compute environment %s.\\n\", input)\n+\n+\tresult, err := conn.DescribeComputeEnvironments(input)\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\n+\tif len(result.ComputeEnvironments) == 0 {\n+\t\treturn fmt.Errorf(\"One compute environment is expected, but AWS return no compute environment\")\n+\t}\n+\tcomputeEnvironment := result.ComputeEnvironments[0]\n+\n+\td.Set(\"service_role\", computeEnvironment.ServiceRole)\n+\td.Set(\"state\", computeEnvironment.State)\n+\td.Set(\"type\", computeEnvironment.Type)\n+\n+\tif *(computeEnvironment.Type) == \"MANAGED\" {\n+\t\tcomputeResource := computeEnvironment.ComputeResources\n+\n+\t\td.Set(\"compute_resources\", []interface{}{\n+\t\t\tmap[string]interface{}{\n+\t\t\t\t\"bid_percentage\":      computeResource.BidPercentage,\n+\t\t\t\t\"desired_vcpus\":       computeResource.DesiredvCpus,\n+\t\t\t\t\"ec2_key_pair\":        computeResource.Ec2KeyPair,\n+\t\t\t\t\"image_id\":            computeResource.ImageId,\n+\t\t\t\t\"instance_role\":       computeResource.InstanceRole,\n+\t\t\t\t\"instance_type\":       schema.NewSet(schema.HashString, flattenStringList(computeResource.InstanceTypes)),\n+\t\t\t\t\"max_vcpus\":           computeResource.MaxvCpus,\n+\t\t\t\t\"min_vcpus\":           computeResource.MinvCpus,\n+\t\t\t\t\"security_group_ids\":  schema.NewSet(schema.HashString, flattenStringList(computeResource.SecurityGroupIds)),\n+\t\t\t\t\"spot_iam_fleet_role\": computeResource.SpotIamFleetRole,\n+\t\t\t\t\"subnets\":             schema.NewSet(schema.HashString, flattenStringList(computeResource.Subnets)),\n+\t\t\t\t\"tags\":                tagsToMapGeneric(computeResource.Tags),\n+\t\t\t\t\"type\":                computeResource.Type,\n+\t\t\t},\n+\t\t})\n+\t}\n+\n+\td.Set(\"arn\", computeEnvironment.ComputeEnvironmentArn)\n+\td.Set(\"ecc_cluster_arn\", computeEnvironment.ComputeEnvironmentArn)\n+\td.Set(\"status\", computeEnvironment.Status)\n+\td.Set(\"status_reason\", computeEnvironment.StatusReason)\n+\n+\treturn nil\n+}\n+\n+func resourceAwsBatchComputeEnvironmentDelete(d *schema.ResourceData, meta interface{}) error {\n+\tconn := meta.(*AWSClient).batchconn\n+\n+\tcomputeEnvironmentName := d.Get(\"compute_environment_name\").(string)\n+\n+\tupdateInput := &batch.UpdateComputeEnvironmentInput{\n+\t\tComputeEnvironment: aws.String(computeEnvironmentName),\n+\t\tState:              aws.String(DISABLED),\n+\t}\n+\n+\tlog.Printf(\"[DEBUG] Delete compute environment %s.\\n\", updateInput)\n+\n+\tif _, err := conn.UpdateComputeEnvironment(updateInput); err != nil {\n+\t\treturn err\n+\t}\n+\n+\tstateConf := &resource.StateChangeConf{\n+\t\tPending:    []string{UPDATING},\n+\t\tTarget:     []string{VALID},\n+\t\tRefresh:    resourceAwsBatchComputeEnvironmentStatusRefreshFunc(d, meta),\n+\t\tTimeout:    d.Timeout(schema.TimeoutDelete),\n+\t\tMinTimeout: 5 * time.Second,\n+\t}\n+\tif _, err := stateConf.WaitForState(); err != nil {\n+\t\treturn err\n+\t}\n+\n+\tinput := &batch.DeleteComputeEnvironmentInput{\n+\t\tComputeEnvironment: aws.String(computeEnvironmentName),\n+\t}\n+\n+\tif _, err := conn.DeleteComputeEnvironment(input); err != nil {\n+\t\treturn err\n+\t}\n+\n+\tstateConfForDelete := &resource.StateChangeConf{\n+\t\tPending:    []string{DELETING},\n+\t\tTarget:     []string{DELETED},\n+\t\tRefresh:    resourceAwsBatchComputeEnvironmentDeleteRefreshFunc(d, meta),\n+\t\tTimeout:    d.Timeout(schema.TimeoutDelete),\n+\t\tMinTimeout: 5 * time.Second,\n+\t}\n+\tif _, err := stateConfForDelete.WaitForState(); err != nil {\n+\t\treturn err\n+\t}\n+\n+\td.SetId(\"\")\n+\n+\treturn nil\n+}\n+\n+func resourceAwsBatchComputeEnvironmentUpdate(d *schema.ResourceData, meta interface{}) error {\n+\tconn := meta.(*AWSClient).batchconn\n+\n+\tcomputeEnvironmentName := d.Get(\"compute_environment_name\").(string)\n+\n+\tinput := &batch.UpdateComputeEnvironmentInput{\n+\t\tComputeEnvironment: aws.String(computeEnvironmentName),\n+\t\tComputeResources:   &batch.ComputeResourceUpdate{},\n+\t}\n+\n+\tif d.HasChange(\"service_role\") {\n+\t\tinput.ServiceRole = aws.String(d.Get(\"service_role\").(string))\n+\t}\n+\tif d.HasChange(\"state\") {\n+\t\tinput.ServiceRole = aws.String(d.Get(\"state\").(string))\n+\t}\n+\n+\tif d.HasChange(\"compute_resources\") {\n+\t\tcomputeResources := d.Get(\"compute_resources\").([]interface{})\n+\t\tif len(computeResources) == 0 {\n+\t\t\treturn fmt.Errorf(\"One compute environment is expected, but no compute environments are set\")\n+\t\t}\n+\t\tcomputeResource := computeResources[0].(map[string]interface{})\n+\n+\t\tinput.ComputeResources.DesiredvCpus = aws.Int64(int64(computeResource[\"desired_vcpus\"].(int)))\n+\t\tinput.ComputeResources.MaxvCpus = aws.Int64(int64(computeResource[\"max_vcpus\"].(int)))\n+\t\tinput.ComputeResources.MinvCpus = aws.Int64(int64(computeResource[\"min_vcpus\"].(int)))\n+\t}\n+\n+\tlog.Printf(\"[DEBUG] Update compute environment %s.\\n\", input)\n+\n+\tif _, err := conn.UpdateComputeEnvironment(input); err != nil {\n+\t\treturn err\n+\t}\n+\n+\treturn resourceAwsBatchComputeEnvironmentRead(d, meta)\n+}\n+\n+func resourceAwsBatchComputeEnvironmentStatusRefreshFunc(d *schema.ResourceData, meta interface{}) resource.StateRefreshFunc {\n+\treturn func() (interface{}, string, error) {\n+\t\tconn := meta.(*AWSClient).batchconn\n+\n+\t\tcomputeEnvironmentName := d.Get(\"compute_environment_name\").(string)\n+\n+\t\tresult, err := conn.DescribeComputeEnvironments(&batch.DescribeComputeEnvironmentsInput{\n+\t\t\tComputeEnvironments: []*string{\n+\t\t\t\taws.String(computeEnvironmentName),\n+\t\t\t},\n+\t\t})\n+\t\tif err != nil {\n+\t\t\treturn nil, FAILED, err\n+\t\t}\n+\n+\t\tif len(result.ComputeEnvironments) == 0 {\n+\t\t\treturn nil, FAILED, fmt.Errorf(\"One compute environment is expected, but AWS return no compute environment\")\n+\t\t}\n+\n+\t\tcomputeEnvironment := result.ComputeEnvironments[0]\n+\t\treturn result, *(computeEnvironment.Status), nil\n+\t}\n+}\n+\n+func resourceAwsBatchComputeEnvironmentDeleteRefreshFunc(d *schema.ResourceData, meta interface{}) resource.StateRefreshFunc {\n+\treturn func() (interface{}, string, error) {\n+\t\tconn := meta.(*AWSClient).batchconn\n+\n+\t\tcomputeEnvironmentName := d.Get(\"compute_environment_name\").(string)\n+\n+\t\tresult, err := conn.DescribeComputeEnvironments(&batch.DescribeComputeEnvironmentsInput{\n+\t\t\tComputeEnvironments: []*string{\n+\t\t\t\taws.String(computeEnvironmentName),\n+\t\t\t},\n+\t\t})\n+\t\tif err != nil {\n+\t\t\treturn nil, FAILED, err\n+\t\t}\n+\n+\t\tif len(result.ComputeEnvironments) == 0 {\n+\t\t\treturn result, DELETED, nil\n+\t\t}\n+\n+\t\tcomputeEnvironment := result.ComputeEnvironments[0]\n+\t\treturn result, *(computeEnvironment.Status), nil\n+\t}\n+}\n+\n+func isCorrentComputeEnvironmentName(i interface{}, k string) (s []string, es []error) {\n+\tv, ok := i.(string)\n+\tif !ok {\n+\t\tes = append(es, fmt.Errorf(\"expected type of %s to be string\", k))\n+\t\treturn\n+\t}\n+\n+\tif !(reComputeEnvironmentName.MatchString(v) && len(v) <= 128) {\n+\t\tes = append(es, fmt.Errorf(\"computeEnvironmentName must be up to 128 letters (uppercase and lowercase), numbers, and underscores.\"))\n+\t\treturn\n+\t}\n+\n+\treturn\n+}\n+\n+func isArnOfIamRole(i interface{}, k string) (s []string, es []error) {","path":"aws/resource_aws_batch_compute_environment.go","position":466,"original_position":466,"commit_id":"b7e9f87130034b3991162841c5e85c84b9808f5d","original_commit_id":"b7e9f87130034b3991162841c5e85c84b9808f5d","user":{"login":"Ninir","id":855022,"avatar_url":"https://avatars3.githubusercontent.com/u/855022?v=4","gravatar_id":"","url":"https://api.github.com/users/Ninir","html_url":"https://github.com/Ninir","followers_url":"https://api.github.com/users/Ninir/followers","following_url":"https://api.github.com/users/Ninir/following{/other_user}","gists_url":"https://api.github.com/users/Ninir/gists{/gist_id}","starred_url":"https://api.github.com/users/Ninir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ninir/subscriptions","organizations_url":"https://api.github.com/users/Ninir/orgs","repos_url":"https://api.github.com/users/Ninir/repos","events_url":"https://api.github.com/users/Ninir/events{/privacy}","received_events_url":"https://api.github.com/users/Ninir/received_events","type":"User","site_admin":false},"body":"Same as above, it would be better to put this function in validators.go, and rename it to `validateBatchComputeEnvironmentIamRole`","created_at":"2017-09-07T20:13:54Z","updated_at":"2017-09-07T20:19:47Z","html_url":"https://github.com/terraform-providers/terraform-provider-aws/pull/1048#discussion_r137643793","pull_request_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls/1048","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls/comments/137643793"},"html":{"href":"https://github.com/terraform-providers/terraform-provider-aws/pull/1048#discussion_r137643793"},"pull_request":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls/1048"}}},"pull_request":{"url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls/1048","id":128740747,"html_url":"https://github.com/terraform-providers/terraform-provider-aws/pull/1048","diff_url":"https://github.com/terraform-providers/terraform-provider-aws/pull/1048.diff","patch_url":"https://github.com/terraform-providers/terraform-provider-aws/pull/1048.patch","issue_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues/1048","number":1048,"state":"open","locked":false,"title":"Add support for aws_batch_compute_environment","user":{"login":"shibataka000","id":1219666,"avatar_url":"https://avatars1.githubusercontent.com/u/1219666?v=4","gravatar_id":"","url":"https://api.github.com/users/shibataka000","html_url":"https://github.com/shibataka000","followers_url":"https://api.github.com/users/shibataka000/followers","following_url":"https://api.github.com/users/shibataka000/following{/other_user}","gists_url":"https://api.github.com/users/shibataka000/gists{/gist_id}","starred_url":"https://api.github.com/users/shibataka000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shibataka000/subscriptions","organizations_url":"https://api.github.com/users/shibataka000/orgs","repos_url":"https://api.github.com/users/shibataka000/repos","events_url":"https://api.github.com/users/shibataka000/events{/privacy}","received_events_url":"https://api.github.com/users/shibataka000/received_events","type":"User","site_admin":false},"body":"## Description\r\nAdd support for `aws_batch_compute_environment` to creates a AWS Batch compute environment.\r\n\r\n## Tests\r\n```\r\n$ make testacc TESTARGS='-run=TestAccAWSBatchComputeEnvironment'\r\n==> Checking that code complies with gofmt requirements...\r\nTF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run=TestAccAWSBatchComputeEnvironment -timeout 120m\r\n?   \tgithub.com/terraform-providers/terraform-provider-aws\t[no test files]\r\n=== RUN   TestAccAWSBatchComputeEnvironment_createEc2\r\n--- PASS: TestAccAWSBatchComputeEnvironment_createEc2 (53.54s)\r\n=== RUN   TestAccAWSBatchComputeEnvironment_createEc2WithTags\r\n--- PASS: TestAccAWSBatchComputeEnvironment_createEc2WithTags (40.32s)\r\n=== RUN   TestAccAWSBatchComputeEnvironment_createSpot\r\n--- PASS: TestAccAWSBatchComputeEnvironment_createSpot (44.21s)\r\n=== RUN   TestAccAWSBatchComputeEnvironment_createUnmanaged\r\n--- PASS: TestAccAWSBatchComputeEnvironment_createUnmanaged (51.36s)\r\n=== RUN   TestAccAWSBatchComputeEnvironment_updateMaxvCpus\r\n--- PASS: TestAccAWSBatchComputeEnvironment_updateMaxvCpus (74.04s)\r\n=== RUN   TestAccAWSBatchComputeEnvironment_updateInstanceType\r\n--- PASS: TestAccAWSBatchComputeEnvironment_updateInstanceType (91.76s)\r\n=== RUN   TestAccAWSBatchComputeEnvironment_updateComputeEnvironmentName\r\n--- PASS: TestAccAWSBatchComputeEnvironment_updateComputeEnvironmentName (78.01s)\r\n=== RUN   TestAccAWSBatchComputeEnvironment_createEc2WithoutComputeResources\r\n--- PASS: TestAccAWSBatchComputeEnvironment_createEc2WithoutComputeResources (22.59s)\r\n=== RUN   TestAccAWSBatchComputeEnvironment_createUnmanagedWithComputeResources\r\n--- PASS: TestAccAWSBatchComputeEnvironment_createUnmanagedWithComputeResources (49.45s)\r\n=== RUN   TestAccAWSBatchComputeEnvironment_createSpotWithoutBidPercentage\r\n--- PASS: TestAccAWSBatchComputeEnvironment_createSpotWithoutBidPercentage (25.54s)\r\nPASS\r\nok  \tgithub.com/terraform-providers/terraform-provider-aws/aws\t530.836s\r\n```\r\n","created_at":"2017-07-04T07:30:09Z","updated_at":"2017-09-07T20:19:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"abd029c9ae70d549b47f2e5b6fff9577d71e9775","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls/1048/commits","review_comments_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls/1048/comments","review_comment_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls/comments{/number}","comments_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues/1048/comments","statuses_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/statuses/b7e9f87130034b3991162841c5e85c84b9808f5d","head":{"label":"shibataka000:resource_batch_compute_environment","ref":"resource_batch_compute_environment","sha":"b7e9f87130034b3991162841c5e85c84b9808f5d","user":{"login":"shibataka000","id":1219666,"avatar_url":"https://avatars1.githubusercontent.com/u/1219666?v=4","gravatar_id":"","url":"https://api.github.com/users/shibataka000","html_url":"https://github.com/shibataka000","followers_url":"https://api.github.com/users/shibataka000/followers","following_url":"https://api.github.com/users/shibataka000/following{/other_user}","gists_url":"https://api.github.com/users/shibataka000/gists{/gist_id}","starred_url":"https://api.github.com/users/shibataka000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shibataka000/subscriptions","organizations_url":"https://api.github.com/users/shibataka000/orgs","repos_url":"https://api.github.com/users/shibataka000/repos","events_url":"https://api.github.com/users/shibataka000/events{/privacy}","received_events_url":"https://api.github.com/users/shibataka000/received_events","type":"User","site_admin":false},"repo":{"id":94669251,"name":"terraform-provider-aws","full_name":"shibataka000/terraform-provider-aws","owner":{"login":"shibataka000","id":1219666,"avatar_url":"https://avatars1.githubusercontent.com/u/1219666?v=4","gravatar_id":"","url":"https://api.github.com/users/shibataka000","html_url":"https://github.com/shibataka000","followers_url":"https://api.github.com/users/shibataka000/followers","following_url":"https://api.github.com/users/shibataka000/following{/other_user}","gists_url":"https://api.github.com/users/shibataka000/gists{/gist_id}","starred_url":"https://api.github.com/users/shibataka000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shibataka000/subscriptions","organizations_url":"https://api.github.com/users/shibataka000/orgs","repos_url":"https://api.github.com/users/shibataka000/repos","events_url":"https://api.github.com/users/shibataka000/events{/privacy}","received_events_url":"https://api.github.com/users/shibataka000/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/shibataka000/terraform-provider-aws","description":"Terraform aws provider","fork":true,"url":"https://api.github.com/repos/shibataka000/terraform-provider-aws","forks_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/forks","keys_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/teams","hooks_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/hooks","issue_events_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/issues/events{/number}","events_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/events","assignees_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/assignees{/user}","branches_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/branches{/branch}","tags_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/tags","blobs_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/git/refs{/sha}","trees_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/statuses/{sha}","languages_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/languages","stargazers_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/stargazers","contributors_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/contributors","subscribers_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/subscribers","subscription_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/subscription","commits_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/commits{/sha}","git_commits_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/git/commits{/sha}","comments_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/comments{/number}","issue_comment_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/issues/comments{/number}","contents_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/contents/{+path}","compare_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/merges","archive_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/downloads","issues_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/issues{/number}","pulls_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/pulls{/number}","milestones_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/milestones{/number}","notifications_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/labels{/name}","releases_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/releases{/id}","deployments_url":"https://api.github.com/repos/shibataka000/terraform-provider-aws/deployments","created_at":"2017-06-18T06:23:45Z","updated_at":"2017-06-18T06:23:49Z","pushed_at":"2017-08-29T13:53:53Z","git_url":"git://github.com/shibataka000/terraform-provider-aws.git","ssh_url":"git@github.com:shibataka000/terraform-provider-aws.git","clone_url":"https://github.com/shibataka000/terraform-provider-aws.git","svn_url":"https://github.com/shibataka000/terraform-provider-aws","homepage":"","size":17581,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"terraform-providers:master","ref":"master","sha":"b7b20d63edc8bc34f631f939f19d57b6650bb669","user":{"login":"terraform-providers","id":29154831,"avatar_url":"https://avatars0.githubusercontent.com/u/29154831?v=4","gravatar_id":"","url":"https://api.github.com/users/terraform-providers","html_url":"https://github.com/terraform-providers","followers_url":"https://api.github.com/users/terraform-providers/followers","following_url":"https://api.github.com/users/terraform-providers/following{/other_user}","gists_url":"https://api.github.com/users/terraform-providers/gists{/gist_id}","starred_url":"https://api.github.com/users/terraform-providers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terraform-providers/subscriptions","organizations_url":"https://api.github.com/users/terraform-providers/orgs","repos_url":"https://api.github.com/users/terraform-providers/repos","events_url":"https://api.github.com/users/terraform-providers/events{/privacy}","received_events_url":"https://api.github.com/users/terraform-providers/received_events","type":"Organization","site_admin":false},"repo":{"id":93444615,"name":"terraform-provider-aws","full_name":"terraform-providers/terraform-provider-aws","owner":{"login":"terraform-providers","id":29154831,"avatar_url":"https://avatars0.githubusercontent.com/u/29154831?v=4","gravatar_id":"","url":"https://api.github.com/users/terraform-providers","html_url":"https://github.com/terraform-providers","followers_url":"https://api.github.com/users/terraform-providers/followers","following_url":"https://api.github.com/users/terraform-providers/following{/other_user}","gists_url":"https://api.github.com/users/terraform-providers/gists{/gist_id}","starred_url":"https://api.github.com/users/terraform-providers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terraform-providers/subscriptions","organizations_url":"https://api.github.com/users/terraform-providers/orgs","repos_url":"https://api.github.com/users/terraform-providers/repos","events_url":"https://api.github.com/users/terraform-providers/events{/privacy}","received_events_url":"https://api.github.com/users/terraform-providers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/terraform-providers/terraform-provider-aws","description":"Terraform aws provider","fork":false,"url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws","forks_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/forks","keys_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/keys{/key_id}","collaborators_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/teams","hooks_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/hooks","issue_events_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues/events{/number}","events_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/events","assignees_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/assignees{/user}","branches_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/branches{/branch}","tags_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/tags","blobs_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/git/refs{/sha}","trees_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/git/trees{/sha}","statuses_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/statuses/{sha}","languages_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/languages","stargazers_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/stargazers","contributors_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/contributors","subscribers_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/subscribers","subscription_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/subscription","commits_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/commits{/sha}","git_commits_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/git/commits{/sha}","comments_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/comments{/number}","issue_comment_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues/comments{/number}","contents_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/contents/{+path}","compare_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/compare/{base}...{head}","merges_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/merges","archive_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/downloads","issues_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues{/number}","pulls_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls{/number}","milestones_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/milestones{/number}","notifications_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/labels{/name}","releases_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/releases{/id}","deployments_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/deployments","created_at":"2017-06-05T20:37:52Z","updated_at":"2017-09-07T09:58:33Z","pushed_at":"2017-09-07T20:03:06Z","git_url":"git://github.com/terraform-providers/terraform-provider-aws.git","ssh_url":"git@github.com:terraform-providers/terraform-provider-aws.git","clone_url":"https://github.com/terraform-providers/terraform-provider-aws.git","svn_url":"https://github.com/terraform-providers/terraform-provider-aws","homepage":"","size":17961,"stargazers_count":252,"watchers_count":252,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":234,"mirror_url":null,"open_issues_count":1088,"forks":234,"open_issues":1088,"watchers":252,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls/1048"},"html":{"href":"https://github.com/terraform-providers/terraform-provider-aws/pull/1048"},"issue":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues/1048"},"comments":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues/1048/comments"},"review_comments":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls/1048/comments"},"review_comment":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls/1048/commits"},"statuses":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/statuses/b7e9f87130034b3991162841c5e85c84b9808f5d"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"Ninir"}}