Skip to content

Commit

Permalink
update import ID pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
anGie44 committed Jul 21, 2020
1 parent 969a889 commit 9cbd77b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions aws/resource_aws_api_gateway_method_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ func resourceAwsApiGatewayMethodSettingsDelete(d *schema.ResourceData, meta inte
}

func resourceAwsApiGatewayMethodSettingsImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
idParts := strings.Split(d.Id(), ":")
idParts := strings.SplitN(d.Id(), "/", 3)
if len(idParts) != 3 || idParts[0] == "" || idParts[1] == "" || idParts[2] == "" {
return nil, fmt.Errorf("Unexpected format of ID (%q), expected REST-API-ID:STAGE-NAME:METHOD-PATH", d.Id())
return nil, fmt.Errorf("Unexpected format of ID (%q), expected REST-API-ID/STAGE-NAME/METHOD-PATH", d.Id())
}
restApiID := idParts[0]
stageName := idParts[1]
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_api_gateway_method_settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ func testAccAWSAPIGatewayMethodSettingsImportStateIdFunc(resourceName string) re
stageName := rs.Primary.Attributes["stage_name"]
methodPath := rs.Primary.Attributes["method_path"]

return fmt.Sprintf("%s:%s:%s", restApiID, stageName, methodPath), nil
return fmt.Sprintf("%s/%s/%s", restApiID, stageName, methodPath), nil
}
}

Expand Down
4 changes: 2 additions & 2 deletions website/docs/r/api_gateway_method_settings.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ The following arguments are supported:

## Import

`aws_api_gateway_method_settings` can be imported using `REST-API-ID:STAGE-NAME:METHOD-PATH`, e.g.
`aws_api_gateway_method_settings` can be imported using `REST-API-ID/STAGE-NAME/METHOD-PATH`, e.g.

```
$ terraform import aws_api_gateway_method_settings.example 12345abcde:example:test/GET
$ terraform import aws_api_gateway_method_settings.example 12345abcde/example/test/GET
```

0 comments on commit 9cbd77b

Please sign in to comment.