Skip to content

Commit ad94254

Browse files
authored
Merge pull request #43817 from hashicorp/f-r/aws_cognito_managed_login_branding
r/aws_cognito_managed_login_branding: New resource.
2 parents a64b6dd + e3f229a commit ad94254

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+2738
-756
lines changed

.changelog/43817.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:new-resource
2+
aws_cognito_managed_login_branding
3+
```

.github/labeler-issue-triage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ service/codestarnotifications:
174174
service/cognitoidentity:
175175
- '((\*|-)\s*`?|(data|resource)\s+"?)aws_cognito_identity_(?!provider)'
176176
service/cognitoidp:
177-
- '((\*|-)\s*`?|(data|resource)\s+"?)aws_cognito_(identity_provider|resource|user|risk|log)'
177+
- '((\*|-)\s*`?|(data|resource)\s+"?)aws_cognito_(identity_provider|log|managed_login_branding|managed_user|resource|risk|user)'
178178
service/cognitosync:
179179
- '((\*|-)\s*`?|(data|resource)\s+"?)aws_cognitosync_'
180180
service/comprehend:

.github/labeler-pr-triage.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,11 +568,12 @@ service/cognitoidp:
568568
- any-glob-to-any-file:
569569
- 'internal/service/cognitoidp/**/*'
570570
- 'website/**/cognito_identity_provider*'
571+
- 'website/**/cognito_log*'
572+
- 'website/**/cognito_managed_login_branding*'
571573
- 'website/**/cognito_managed_user*'
572574
- 'website/**/cognito_resource_*'
573-
- 'website/**/cognito_user*'
574575
- 'website/**/cognito_risk*'
575-
- 'website/**/cognito_log*'
576+
- 'website/**/cognito_user*'
576577
service/cognitosync:
577578
- any:
578579
- changed-files:

.teamcity/scripts/provider_tests/acceptance_tests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ TF_ACC=1 go test \
6060
./internal/semver/... \
6161
./internal/slices/... \
6262
./internal/smerr/... \
63+
./internal/smithy/... \
6364
./internal/sweep/... \
6465
./internal/tags/... \
6566
./internal/tfresource/... \

.teamcity/scripts/provider_tests/unit_tests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ go test \
3232
./internal/semver/... \
3333
./internal/slices/... \
3434
./internal/smerr/... \
35+
./internal/smithy/... \
3536
./internal/sweep/... \
3637
./internal/tags/... \
3738
./internal/tfresource/... \

internal/flex/flex.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,11 @@ func StringValueToInt64Value(v string) int64 {
413413
return i
414414
}
415415

416+
// Int64ToRFC3339StringValue converts an int64 timestamp pointer to an RFC3339 Go string value.
417+
func Int64ToRFC3339StringValue(v *int64) string {
418+
return time.UnixMilli(aws.ToInt64(v)).Format(time.RFC3339)
419+
}
420+
416421
// Takes a string of resource attributes separated by the ResourceIdSeparator constant
417422
// returns the number of parts
418423
func ResourceIdPartCount(id string) int {

internal/framework/flex/auto_expand.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
1717
"github.com/hashicorp/terraform-plugin-log/tflog"
1818
fwtypes "github.com/hashicorp/terraform-provider-aws/internal/framework/types"
19-
smithyjson "github.com/hashicorp/terraform-provider-aws/internal/json"
2019
tfreflect "github.com/hashicorp/terraform-provider-aws/internal/reflect"
2120
)
2221

@@ -487,8 +486,8 @@ func (expander autoExpander) string(ctx context.Context, vFrom basetypes.StringV
487486
}
488487

489488
case reflect.Interface:
490-
if s, ok := vFrom.(fwtypes.SmithyJSON[smithyjson.JSONStringer]); ok {
491-
v, d := s.ValueInterface()
489+
if s, ok := vFrom.(fwtypes.SmithyDocumentValue); ok {
490+
v, d := s.ToSmithyObjectDocument(ctx)
492491
diags.Append(d...)
493492
if diags.HasError() {
494493
return diags

internal/framework/flex/auto_expand_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"github.com/hashicorp/terraform-plugin-log/tflogtest"
2020
"github.com/hashicorp/terraform-provider-aws/internal/errs"
2121
fwtypes "github.com/hashicorp/terraform-provider-aws/internal/framework/types"
22-
smithyjson "github.com/hashicorp/terraform-provider-aws/internal/json"
22+
tfsmithy "github.com/hashicorp/terraform-provider-aws/internal/smithy"
2323
)
2424

2525
func TestExpand(t *testing.T) {
@@ -546,7 +546,7 @@ func TestExpand(t *testing.T) {
546546
},
547547
},
548548
"JSONValue Source to json interface Target": {
549-
Source: &tfJSONStringer{Field1: fwtypes.SmithyJSONValue(`{"field1": "a"}`, newTestJSONDocument)},
549+
Source: &tfJSONStringer{Field1: fwtypes.NewSmithyJSONValue(`{"field1": "a"}`, newTestJSONDocument)},
550550
Target: &awsJSONStringer{},
551551
WantTarget: &awsJSONStringer{
552552
Field1: &testJSONDocument{
@@ -559,7 +559,7 @@ func TestExpand(t *testing.T) {
559559
infoExpanding(reflect.TypeFor[*tfJSONStringer](), reflect.TypeFor[*awsJSONStringer]()),
560560
infoConverting(reflect.TypeFor[tfJSONStringer](), reflect.TypeFor[*awsJSONStringer]()),
561561
traceMatchedFields("Field1", reflect.TypeFor[tfJSONStringer](), "Field1", reflect.TypeFor[*awsJSONStringer]()),
562-
infoConvertingWithPath("Field1", reflect.TypeFor[fwtypes.SmithyJSON[smithyjson.JSONStringer]](), "Field1", reflect.TypeFor[smithyjson.JSONStringer]()),
562+
infoConvertingWithPath("Field1", reflect.TypeFor[fwtypes.SmithyJSON[tfsmithy.JSONStringer]](), "Field1", reflect.TypeFor[tfsmithy.JSONStringer]()),
563563
},
564564
},
565565
}

internal/framework/flex/auto_flatten.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"strings"
1212
"time"
1313

14+
smithydocument "github.com/aws/smithy-go/document"
1415
"github.com/hashicorp/terraform-plugin-framework-timetypes/timetypes"
1516
"github.com/hashicorp/terraform-plugin-framework/attr"
1617
"github.com/hashicorp/terraform-plugin-framework/diag"
@@ -19,8 +20,8 @@ import (
1920
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
2021
"github.com/hashicorp/terraform-plugin-log/tflog"
2122
fwtypes "github.com/hashicorp/terraform-provider-aws/internal/framework/types"
22-
smithyjson "github.com/hashicorp/terraform-provider-aws/internal/json"
2323
tfreflect "github.com/hashicorp/terraform-provider-aws/internal/reflect"
24+
tfsmithy "github.com/hashicorp/terraform-provider-aws/internal/smithy"
2425
"github.com/shopspring/decimal"
2526
)
2627

@@ -619,27 +620,24 @@ func (flattener autoFlattener) interface_(ctx context.Context, vFrom reflect.Val
619620
//
620621
// JSONStringer -> types.String-ish.
621622
//
622-
if vFrom.Type().Implements(reflect.TypeFor[smithyjson.JSONStringer]()) {
623-
tflog.SubsystemInfo(ctx, subsystemName, "Source implements json.JSONStringer")
623+
if vFrom.Type().Implements(reflect.TypeFor[smithydocument.Marshaler]()) {
624+
tflog.SubsystemInfo(ctx, subsystemName, "Source implements smithydocument.Marshaler")
624625

625626
stringValue := types.StringNull()
626627

627628
if vFrom.IsNil() {
628629
tflog.SubsystemTrace(ctx, subsystemName, "Flattening null value")
629630
} else {
630-
doc := vFrom.Interface().(smithyjson.JSONStringer)
631-
b, err := doc.MarshalSmithyDocument()
631+
doc := vFrom.Interface().(smithydocument.Marshaler)
632+
s, err := tfsmithy.DocumentToJSONString(doc)
632633
if err != nil {
633-
// An error here would be an upstream error in the AWS SDK, because errors in json.Marshal
634-
// are caused by conditions such as cyclic structures
635-
// See https://pkg.go.dev/encoding/json#Marshal
636634
tflog.SubsystemError(ctx, subsystemName, "Marshalling JSON document", map[string]any{
637635
logAttrKeyError: err.Error(),
638636
})
639637
diags.Append(diagFlatteningMarshalSmithyDocument(reflect.TypeOf(doc), err))
640638
return diags
641639
}
642-
stringValue = types.StringValue(string(b))
640+
stringValue = types.StringValue(s)
643641
}
644642
v, d := tTo.ValueFromString(ctx, stringValue)
645643
diags.Append(d...)

internal/framework/flex/auto_flatten_test.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"github.com/hashicorp/terraform-provider-aws/internal/errs"
2323
"github.com/hashicorp/terraform-provider-aws/internal/errs/fwdiag"
2424
fwtypes "github.com/hashicorp/terraform-provider-aws/internal/framework/types"
25-
smithyjson "github.com/hashicorp/terraform-provider-aws/internal/json"
25+
tfsmithy "github.com/hashicorp/terraform-provider-aws/internal/smithy"
2626
)
2727

2828
func TestFlatten(t *testing.T) {
@@ -4357,9 +4357,9 @@ func TestFlattenInterfaceToStringTypable(t *testing.T) {
43574357
infoFlattening(reflect.TypeFor[*awsJSONStringer](), reflect.TypeFor[*tfSingleStringField]()),
43584358
infoConverting(reflect.TypeFor[awsJSONStringer](), reflect.TypeFor[*tfSingleStringField]()),
43594359
traceMatchedFields("Field1", reflect.TypeFor[awsJSONStringer](), "Field1", reflect.TypeFor[*tfSingleStringField]()),
4360-
infoConvertingWithPath("Field1", reflect.TypeFor[smithyjson.JSONStringer](), "Field1", reflect.TypeFor[types.String]()),
4360+
infoConvertingWithPath("Field1", reflect.TypeFor[tfsmithy.JSONStringer](), "Field1", reflect.TypeFor[types.String]()),
43614361
// infoSourceImplementsJSONStringer("Field1", reflect.TypeFor[testJSONDocument](), "Field1", reflect.TypeFor[types.String]()),
4362-
infoSourceImplementsJSONStringer("Field1", reflect.TypeFor[smithyjson.JSONStringer](), "Field1", reflect.TypeFor[types.String]()), // TODO: fix source type
4362+
infoSourceImplementsJSONStringer("Field1", reflect.TypeFor[tfsmithy.JSONStringer](), "Field1", reflect.TypeFor[types.String]()), // TODO: fix source type
43634363
},
43644364
},
43654365
"null json interface Source string Target": {
@@ -4374,10 +4374,10 @@ func TestFlattenInterfaceToStringTypable(t *testing.T) {
43744374
infoFlattening(reflect.TypeFor[*awsJSONStringer](), reflect.TypeFor[*tfSingleStringField]()),
43754375
infoConverting(reflect.TypeFor[awsJSONStringer](), reflect.TypeFor[*tfSingleStringField]()),
43764376
traceMatchedFields("Field1", reflect.TypeFor[awsJSONStringer](), "Field1", reflect.TypeFor[*tfSingleStringField]()),
4377-
infoConvertingWithPath("Field1", reflect.TypeFor[smithyjson.JSONStringer](), "Field1", reflect.TypeFor[types.String]()),
4377+
infoConvertingWithPath("Field1", reflect.TypeFor[tfsmithy.JSONStringer](), "Field1", reflect.TypeFor[types.String]()),
43784378
// infoSourceImplementsJSONStringer("Field1", reflect.TypeFor[testJSONDocument](), "Field1", reflect.TypeFor[types.String]()),
4379-
infoSourceImplementsJSONStringer("Field1", reflect.TypeFor[smithyjson.JSONStringer](), "Field1", reflect.TypeFor[types.String]()), // TODO: fix source type
4380-
traceFlatteningNullValue("Field1", reflect.TypeFor[smithyjson.JSONStringer](), "Field1", reflect.TypeFor[types.String]()),
4379+
infoSourceImplementsJSONStringer("Field1", reflect.TypeFor[tfsmithy.JSONStringer](), "Field1", reflect.TypeFor[types.String]()), // TODO: fix source type
4380+
traceFlatteningNullValue("Field1", reflect.TypeFor[tfsmithy.JSONStringer](), "Field1", reflect.TypeFor[types.String]()),
43814381
},
43824382
},
43834383

@@ -4393,15 +4393,15 @@ func TestFlattenInterfaceToStringTypable(t *testing.T) {
43934393
},
43944394
Target: &tfJSONStringer{},
43954395
WantTarget: &tfJSONStringer{
4396-
Field1: fwtypes.SmithyJSONValue(`{"test":"a"}`, newTestJSONDocument),
4396+
Field1: fwtypes.NewSmithyJSONValue(`{"test":"a"}`, newTestJSONDocument),
43974397
},
43984398
expectedLogLines: []map[string]any{
43994399
infoFlattening(reflect.TypeFor[*awsJSONStringer](), reflect.TypeFor[*tfJSONStringer]()),
44004400
infoConverting(reflect.TypeFor[awsJSONStringer](), reflect.TypeFor[*tfJSONStringer]()),
44014401
traceMatchedFields("Field1", reflect.TypeFor[awsJSONStringer](), "Field1", reflect.TypeFor[*tfJSONStringer]()),
4402-
infoConvertingWithPath("Field1", reflect.TypeFor[smithyjson.JSONStringer](), "Field1", reflect.TypeFor[fwtypes.SmithyJSON[smithyjson.JSONStringer]]()),
4402+
infoConvertingWithPath("Field1", reflect.TypeFor[tfsmithy.JSONStringer](), "Field1", reflect.TypeFor[fwtypes.SmithyJSON[tfsmithy.JSONStringer]]()),
44034403
// infoSourceImplementsJSONStringer("Field1", reflect.TypeFor[testJSONDocument](), "Field1", reflect.TypeFor[fwtypes.SmithyJSON[smithyjson.JSONStringer]]()),
4404-
infoSourceImplementsJSONStringer("Field1", reflect.TypeFor[smithyjson.JSONStringer](), "Field1", reflect.TypeFor[fwtypes.SmithyJSON[smithyjson.JSONStringer]]()), // TODO: fix source type
4404+
infoSourceImplementsJSONStringer("Field1", reflect.TypeFor[tfsmithy.JSONStringer](), "Field1", reflect.TypeFor[fwtypes.SmithyJSON[tfsmithy.JSONStringer]]()), // TODO: fix source type
44054405
},
44064406
},
44074407
"null json interface Source JSONValue Target": {
@@ -4410,16 +4410,16 @@ func TestFlattenInterfaceToStringTypable(t *testing.T) {
44104410
},
44114411
Target: &tfJSONStringer{},
44124412
WantTarget: &tfJSONStringer{
4413-
Field1: fwtypes.SmithyJSONNull[smithyjson.JSONStringer](),
4413+
Field1: fwtypes.NewSmithyJSONNull[tfsmithy.JSONStringer](),
44144414
},
44154415
expectedLogLines: []map[string]any{
44164416
infoFlattening(reflect.TypeFor[*awsJSONStringer](), reflect.TypeFor[*tfJSONStringer]()),
44174417
infoConverting(reflect.TypeFor[awsJSONStringer](), reflect.TypeFor[*tfJSONStringer]()),
44184418
traceMatchedFields("Field1", reflect.TypeFor[awsJSONStringer](), "Field1", reflect.TypeFor[*tfJSONStringer]()),
4419-
infoConvertingWithPath("Field1", reflect.TypeFor[smithyjson.JSONStringer](), "Field1", reflect.TypeFor[fwtypes.SmithyJSON[smithyjson.JSONStringer]]()),
4419+
infoConvertingWithPath("Field1", reflect.TypeFor[tfsmithy.JSONStringer](), "Field1", reflect.TypeFor[fwtypes.SmithyJSON[tfsmithy.JSONStringer]]()),
44204420
// infoSourceImplementsJSONStringer("Field1", reflect.TypeFor[testJSONDocument](), "Field1", reflect.TypeFor[fwtypes.SmithyJSON[smithyjson.JSONStringer]]()),
4421-
infoSourceImplementsJSONStringer("Field1", reflect.TypeFor[smithyjson.JSONStringer](), "Field1", reflect.TypeFor[fwtypes.SmithyJSON[smithyjson.JSONStringer]]()), // TODO: fix source type
4422-
traceFlatteningNullValue("Field1", reflect.TypeFor[smithyjson.JSONStringer](), "Field1", reflect.TypeFor[fwtypes.SmithyJSON[smithyjson.JSONStringer]]()),
4421+
infoSourceImplementsJSONStringer("Field1", reflect.TypeFor[tfsmithy.JSONStringer](), "Field1", reflect.TypeFor[fwtypes.SmithyJSON[tfsmithy.JSONStringer]]()), // TODO: fix source type
4422+
traceFlatteningNullValue("Field1", reflect.TypeFor[tfsmithy.JSONStringer](), "Field1", reflect.TypeFor[fwtypes.SmithyJSON[tfsmithy.JSONStringer]]()),
44234423
},
44244424
},
44254425

@@ -4435,10 +4435,10 @@ func TestFlattenInterfaceToStringTypable(t *testing.T) {
44354435
infoFlattening(reflect.TypeFor[*awsJSONStringer](), reflect.TypeFor[*tfSingleStringField]()),
44364436
infoConverting(reflect.TypeFor[awsJSONStringer](), reflect.TypeFor[*tfSingleStringField]()),
44374437
traceMatchedFields("Field1", reflect.TypeFor[awsJSONStringer](), "Field1", reflect.TypeFor[*tfSingleStringField]()),
4438-
infoConvertingWithPath("Field1", reflect.TypeFor[smithyjson.JSONStringer](), "Field1", reflect.TypeFor[types.String]()),
4438+
infoConvertingWithPath("Field1", reflect.TypeFor[tfsmithy.JSONStringer](), "Field1", reflect.TypeFor[types.String]()),
44394439
// infoSourceImplementsJSONStringer("Field1", reflect.TypeFor[testJSONDocument](), "Field1", reflect.TypeFor[types.String]()),
4440-
infoSourceImplementsJSONStringer("Field1", reflect.TypeFor[smithyjson.JSONStringer](), "Field1", reflect.TypeFor[types.String]()), // TODO: fix source type
4441-
errorMarshallingJSONDocument("Field1", reflect.TypeFor[smithyjson.JSONStringer](), "Field1", reflect.TypeFor[types.String](), errMarshallSmithyDocument),
4440+
infoSourceImplementsJSONStringer("Field1", reflect.TypeFor[tfsmithy.JSONStringer](), "Field1", reflect.TypeFor[types.String]()), // TODO: fix source type
4441+
errorMarshallingJSONDocument("Field1", reflect.TypeFor[tfsmithy.JSONStringer](), "Field1", reflect.TypeFor[types.String](), errMarshallSmithyDocument),
44424442
},
44434443
},
44444444

0 commit comments

Comments
 (0)