Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r/sagemaker_workforce - new resource #20065

Merged
merged 9 commits into from
Jul 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1000,6 +1000,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 @@ -142,6 +143,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