Skip to content

Commit

Permalink
Merge pull request #20065 from DrFaust92/r/sagemaker_workforce
Browse files Browse the repository at this point in the history
r/sagemaker_workforce - new resource
  • Loading branch information
ewbankkit authored Jul 28, 2021
2 parents d31ea4b + 464661a commit ee27cf9
Show file tree
Hide file tree
Showing 7 changed files with 866 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .changelog/20065.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```release-note:new-resource
aws_sagemaker_workforce
```

```release-note:enhancement
resource/aws_cognito_user_pool_client: Set `callback_urls` and `logout_urls` as computed.
```
30 changes: 30 additions & 0 deletions aws/internal/service/sagemaker/finder/finder.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package finder
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/sagemaker"
"github.com/hashicorp/aws-sdk-go-base/tfawserr"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

// CodeRepositoryByName returns the code repository corresponding to the specified name.
Expand Down Expand Up @@ -179,3 +181,31 @@ func AppByName(conn *sagemaker.SageMaker, domainID, userProfileName, appType, ap

return output, nil
}

func WorkforceByName(conn *sagemaker.SageMaker, name string) (*sagemaker.Workforce, error) {
input := &sagemaker.DescribeWorkforceInput{
WorkforceName: aws.String(name),
}

output, err := conn.DescribeWorkforce(input)

if tfawserr.ErrMessageContains(err, "ValidationException", "No workforce") {
return nil, &resource.NotFoundError{
LastError: err,
LastRequest: input,
}
}

if err != nil {
return nil, err
}

if output == nil || output.Workforce == nil {
return nil, &resource.NotFoundError{
Message: "Empty result",
LastRequest: input,
}
}

return output.Workforce, nil
}
1 change: 1 addition & 0 deletions aws/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,7 @@ func Provider() *schema.Provider {
"aws_sagemaker_notebook_instance_lifecycle_configuration": resourceAwsSagemakerNotebookInstanceLifeCycleConfiguration(),
"aws_sagemaker_notebook_instance": resourceAwsSagemakerNotebookInstance(),
"aws_sagemaker_user_profile": resourceAwsSagemakerUserProfile(),
"aws_sagemaker_workforce": resourceAwsSagemakerWorkforce(),
"aws_schemas_discoverer": resourceAwsSchemasDiscoverer(),
"aws_schemas_registry": resourceAwsSchemasRegistry(),
"aws_schemas_schema": resourceAwsSchemasSchema(),
Expand Down
2 changes: 2 additions & 0 deletions aws/resource_aws_cognito_user_pool_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func resourceAwsCognitoUserPoolClient() *schema.Resource {
"callback_urls": {
Type: schema.TypeSet,
Optional: true,
Computed: true,
MaxItems: 100,
Elem: &schema.Schema{
Type: schema.TypeString,
Expand Down Expand Up @@ -147,6 +148,7 @@ func resourceAwsCognitoUserPoolClient() *schema.Resource {
"logout_urls": {
Type: schema.TypeSet,
Optional: true,
Computed: true,
MaxItems: 100,
Elem: &schema.Schema{
Type: schema.TypeString,
Expand Down
Loading

0 comments on commit ee27cf9

Please sign in to comment.