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

new resource: aws_cognito_managed_user_pool_client #30140

Merged
merged 26 commits into from
Mar 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d7a39ac
Cleanup
gdavison Feb 17, 2023
a72500f
Fixes minimum length of `default_redirect_uri`
gdavison Feb 21, 2023
1d5dae6
Adds all fields to `basic` test
gdavison Feb 22, 2023
90f8168
Migrates `aws_cognito_user_pool_client` to terraform-plugin-framework
gdavison Feb 24, 2023
02dca84
Adds expander functions
gdavison Feb 24, 2023
14b2ec2
Reorders fields
gdavison Feb 24, 2023
6fdbdae
Cleans up data types
gdavison Feb 28, 2023
00038a2
Reorders tests
gdavison Feb 28, 2023
0d7cf17
Supports basic acquisition, read, and import
gdavison Feb 28, 2023
ec791b3
Moves translation between `resourceUserPoolClientData` and AWS API to…
gdavison Feb 28, 2023
6da552b
Clean up
gdavison Mar 1, 2023
1c4d08e
Uses `types.List` instead of typed slices
gdavison Mar 1, 2023
a4a3ed5
Adds `aws_opensearch_domain` as dependency to `aws_iam_role`
gdavison Mar 1, 2023
9d6f569
Extends IAM propagation time for OpenSearch domain creation
gdavison Mar 1, 2023
8c832af
Corrects IAM action
gdavison Mar 1, 2023
01337e9
Supports update-on-creation
gdavison Mar 1, 2023
3e7488a
Supports update
gdavison Mar 2, 2023
0ae9468
Adds parameter `name_pattern`
gdavison Mar 2, 2023
5a0c263
`terrafmt`
gdavison Mar 20, 2023
b6e70a6
Adds documentation
gdavison Mar 20, 2023
37758ae
Updates `markdown-link-check.sh`
gdavison Mar 20, 2023
5f04394
Linting fixes
gdavison Mar 21, 2023
85d8f42
Spelling fix
gdavison Mar 21, 2023
69141ec
Reverting file rename
gdavison Mar 21, 2023
02c1a43
Spelling
gdavison Mar 21, 2023
157456c
Removes `compile_tfsdk2fw`
gdavison Mar 22, 2023
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
1 change: 1 addition & 0 deletions .ci/.golangci2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ linters-settings:
# Terraform Plugin Framework
- int64validator.*
- listvalidator.*
- setvalidator.*
- stringvalidator.*
- SetDefaultCreateTimeout
- SetDefaultReadTimeout
Expand Down
6 changes: 3 additions & 3 deletions .ci/scripts/markdown-link-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Local script runner for recursive markdown-link-check
# Based on: https://github.com/gaurav-nelson/github-action-markdown-link-check/blob/master/entrypoint.sh

link_check_container="markdown-link-check"
link_check_container="ghcr.io/tcort/markdown-link-check"

if [ "${LINK_CHECK_CONTAINER}" != "" ]; then
link_check_container="${LINK_CHECK_CONTAINER}"
Expand All @@ -24,15 +24,15 @@ output_file="markdown-link-check-output.txt"
rm -f "$error_file" "$output_file"

docker run --rm -i -t \
-v $(pwd):/github/workspace:ro \
-v "$(pwd):/github/workspace:ro" \
-w /github/workspace \
--entrypoint /usr/bin/find \
"${link_check_container}" \
docs -type f -name "*.md" -exec /src/markdown-link-check --config .ci/.markdownlinkcheck.json --quiet --verbose {} \; \
| tee -a "${output_file}"

docker run --rm -i -t \
-v $(pwd):/github/workspace:ro \
-v "$(pwd):/github/workspace:ro" \
-w /github/workspace \
--entrypoint /usr/bin/find \
"${link_check_container}" \
Expand Down
13 changes: 13 additions & 0 deletions .ci/semgrep/framework/flex.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
rules:
- id: flex-type-from-framework
languages: [go]
message: Prefer `flex.<type>FromFramework` to `aws.<type>(x.Value<type>())`
paths:
include:
- internal/service/cognitoidp
patterns:
- pattern: aws.$TYPE($X.$VALFUNC())
- metavariable-comparison:
metavariable: $VALFUNC
comparison: re.match("\AValue", str($VALFUNC))
severity: WARNING
1 change: 1 addition & 0 deletions .github/labeler-pr-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ service/cognitoidentity:
service/cognitoidp:
- 'internal/service/cognitoidp/**/*'
- 'website/**/cognito_identity_provider*'
- 'website/**/cognito_managed_user*'
- 'website/**/cognito_resource_*'
- 'website/**/cognito_user*'
- 'website/**/cognito_risk*'
Expand Down
44 changes: 0 additions & 44 deletions .github/workflows/tfsdk2fw.yml

This file was deleted.

8 changes: 8 additions & 0 deletions internal/create/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"log"

fwdiag "github.com/hashicorp/terraform-plugin-framework/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-provider-aws/names"
)
Expand Down Expand Up @@ -59,6 +60,13 @@ func DiagError(service, action, resource, id string, gotError error) diag.Diagno
}
}

func DiagErrorFramework(service, action, resource, id string, gotError error) fwdiag.Diagnostic {
return fwdiag.NewErrorDiagnostic(
ProblemStandardMessage(service, action, resource, id, nil),
gotError.Error(),
)
}

func DiagErrorMessage(service, action, resource, id, message string) diag.Diagnostics {
return diag.Diagnostics{
diag.Diagnostic{
Expand Down
8 changes: 8 additions & 0 deletions internal/framework/attrtypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,11 @@ func AttributeTypes[T any](ctx context.Context) (map[string]attr.Type, error) {

return attributeTypes, nil
}

func AttributeTypesMust[T any](ctx context.Context) map[string]attr.Type {
types, err := AttributeTypes[T](ctx)
if err != nil {
panic(fmt.Sprintf("AttributeTypesMust[%T] received error: %s", *new(T), err))
}
return types
}
80 changes: 80 additions & 0 deletions internal/framework/flex/flex.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package flex

import (
"context"
"fmt"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/aws/arn"
"github.com/hashicorp/terraform-plugin-framework/diag"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-provider-aws/internal/flex"
fwtypes "github.com/hashicorp/terraform-provider-aws/internal/framework/types"
)

// Breaking the cycles without changing all files
var (
BoolFromFramework = flex.BoolFromFramework
ExpandFrameworkStringSet = flex.ExpandFrameworkStringSet
Int64FromFramework = flex.Int64FromFramework
StringFromFramework = flex.StringFromFramework
)

var (
BoolToFramework = flex.BoolToFramework
FlattenFrameworkStringSet = flex.FlattenFrameworkStringSet
Int64ToFramework = flex.Int64ToFramework
Int64ToFrameworkLegacy = flex.Int64ToFrameworkLegacy
StringToFramework = flex.StringToFramework
StringToFrameworkLegacy = flex.StringToFrameworkLegacy
)

func ARNStringFromFramework(_ context.Context, v fwtypes.ARN) *string {
if v.IsNull() || v.IsUnknown() {
return nil
}

return aws.String(v.ValueARN().String())
}

func StringToFrameworkARN(ctx context.Context, v *string, diags *diag.Diagnostics) fwtypes.ARN {
if v == nil {
return fwtypes.ARNNull()
}

a, err := arn.Parse(aws.ToString(v))
if err != nil {
diags.AddError(
"Parsing Error",
fmt.Sprintf("String %s cannot be parsed as an ARN.", aws.ToString(v)),
)
}

return fwtypes.ARNValue(a)
}

func Int64FromFrameworkLegacy(_ context.Context, v types.Int64) *int64 {
if v.IsNull() || v.IsUnknown() {
return nil
}

i := v.ValueInt64()
if i == 0 {
return nil
}

return aws.Int64(i)
}

func StringFromFrameworkLegacy(_ context.Context, v types.String) *string {
if v.IsNull() || v.IsUnknown() {
return nil
}

s := v.ValueString()
if s == "" {
return nil
}

return aws.String(s)
}
Loading