Skip to content

Commit

Permalink
Merge pull request #34667 from chasse-code/f/shield-advanced-proactiv…
Browse files Browse the repository at this point in the history
…e-engagement

Add support for Shield ProactiveEngagement
  • Loading branch information
ewbankkit authored Feb 29, 2024
2 parents 028bdb9 + caf15c8 commit b1ff3a0
Show file tree
Hide file tree
Showing 55 changed files with 1,914 additions and 1,209 deletions.
15 changes: 15 additions & 0 deletions .changelog/34667.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```release-note:new-resource
aws_shield_proactive_engagement
```

```release-note:bug
resource/aws_shield_drt_access_log_bucket_association: Change `log_bucket` and `role_arn_association_id` to [ForceNew](https://developer.hashicorp.com/terraform/plugin/sdkv2/schemas/schema-behaviors#forcenew)
```

```release-note:enhancement
resource/aws_shield_drt_access_log_bucket_association: Support resource import
```

```release-note:enhancement
resource/aws_shield_drt_access_role_arn_association: Support resource import
```
56 changes: 28 additions & 28 deletions internal/framework/flex/auto_expand_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,13 @@ func TestExpand(t *testing.T) {
},
{
TestName: "single ARN Source and single string Target",
Source: &TestFlexTF17{Field1: fwtypes.ARNValue(testARN)},
Source: &TestFlexTF17{Field1: fwtypes.ARNValueMust(testARN)},
Target: &TestFlexAWS01{},
WantTarget: &TestFlexAWS01{Field1: testARN},
},
{
TestName: "single ARN Source and single *string Target",
Source: &TestFlexTF17{Field1: fwtypes.ARNValue(testARN)},
Source: &TestFlexTF17{Field1: fwtypes.ARNValueMust(testARN)},
Target: &TestFlexAWS02{},
WantTarget: &TestFlexAWS02{Field1: aws.String(testARN)},
},
Expand Down Expand Up @@ -301,25 +301,25 @@ func TestExpandGeneric(t *testing.T) {
testCases := autoFlexTestCases{
{
TestName: "single list Source and *struct Target",
Source: &TestFlexTF05{Field1: fwtypes.NewListNestedObjectValueOfPtr(ctx, &TestFlexTF01{Field1: types.StringValue("a")})},
Source: &TestFlexTF05{Field1: fwtypes.NewListNestedObjectValueOfPtrMust(ctx, &TestFlexTF01{Field1: types.StringValue("a")})},
Target: &TestFlexAWS06{},
WantTarget: &TestFlexAWS06{Field1: &TestFlexAWS01{Field1: "a"}},
},
{
TestName: "single set Source and *struct Target",
Source: &TestFlexTF06{Field1: fwtypes.NewSetNestedObjectValueOfPtr(ctx, &TestFlexTF01{Field1: types.StringValue("a")})},
Source: &TestFlexTF06{Field1: fwtypes.NewSetNestedObjectValueOfPtrMust(ctx, &TestFlexTF01{Field1: types.StringValue("a")})},
Target: &TestFlexAWS06{},
WantTarget: &TestFlexAWS06{Field1: &TestFlexAWS01{Field1: "a"}},
},
{
TestName: "empty list Source and empty []struct Target",
Source: &TestFlexTF05{Field1: fwtypes.NewListNestedObjectValueOfValueSlice(ctx, []TestFlexTF01{})},
Source: &TestFlexTF05{Field1: fwtypes.NewListNestedObjectValueOfValueSliceMust(ctx, []TestFlexTF01{})},
Target: &TestFlexAWS08{},
WantTarget: &TestFlexAWS08{Field1: []TestFlexAWS01{}},
},
{
TestName: "non-empty list Source and non-empty []struct Target",
Source: &TestFlexTF05{Field1: fwtypes.NewListNestedObjectValueOfValueSlice(ctx, []TestFlexTF01{
Source: &TestFlexTF05{Field1: fwtypes.NewListNestedObjectValueOfValueSliceMust(ctx, []TestFlexTF01{
{Field1: types.StringValue("a")},
{Field1: types.StringValue("b")},
})},
Expand All @@ -331,13 +331,13 @@ func TestExpandGeneric(t *testing.T) {
},
{
TestName: "empty list Source and empty []*struct Target",
Source: &TestFlexTF05{Field1: fwtypes.NewListNestedObjectValueOfSlice(ctx, []*TestFlexTF01{})},
Source: &TestFlexTF05{Field1: fwtypes.NewListNestedObjectValueOfSliceMust(ctx, []*TestFlexTF01{})},
Target: &TestFlexAWS07{},
WantTarget: &TestFlexAWS07{Field1: []*TestFlexAWS01{}},
},
{
TestName: "non-empty list Source and non-empty []*struct Target",
Source: &TestFlexTF05{Field1: fwtypes.NewListNestedObjectValueOfSlice(ctx, []*TestFlexTF01{
Source: &TestFlexTF05{Field1: fwtypes.NewListNestedObjectValueOfSliceMust(ctx, []*TestFlexTF01{
{Field1: types.StringValue("a")},
{Field1: types.StringValue("b")},
})},
Expand All @@ -349,13 +349,13 @@ func TestExpandGeneric(t *testing.T) {
},
{
TestName: "empty list Source and empty []struct Target",
Source: &TestFlexTF05{Field1: fwtypes.NewListNestedObjectValueOfValueSlice(ctx, []TestFlexTF01{})},
Source: &TestFlexTF05{Field1: fwtypes.NewListNestedObjectValueOfValueSliceMust(ctx, []TestFlexTF01{})},
Target: &TestFlexAWS08{},
WantTarget: &TestFlexAWS08{Field1: []TestFlexAWS01{}},
},
{
TestName: "non-empty list Source and non-empty []struct Target",
Source: &TestFlexTF05{Field1: fwtypes.NewListNestedObjectValueOfValueSlice(ctx, []TestFlexTF01{
Source: &TestFlexTF05{Field1: fwtypes.NewListNestedObjectValueOfValueSliceMust(ctx, []TestFlexTF01{
{Field1: types.StringValue("a")},
{Field1: types.StringValue("b")},
})},
Expand All @@ -367,13 +367,13 @@ func TestExpandGeneric(t *testing.T) {
},
{
TestName: "empty set Source and empty []*struct Target",
Source: &TestFlexTF06{Field1: fwtypes.NewSetNestedObjectValueOfSlice(ctx, []*TestFlexTF01{})},
Source: &TestFlexTF06{Field1: fwtypes.NewSetNestedObjectValueOfSliceMust(ctx, []*TestFlexTF01{})},
Target: &TestFlexAWS07{},
WantTarget: &TestFlexAWS07{Field1: []*TestFlexAWS01{}},
},
{
TestName: "non-empty set Source and non-empty []*struct Target",
Source: &TestFlexTF06{Field1: fwtypes.NewSetNestedObjectValueOfSlice(ctx, []*TestFlexTF01{
Source: &TestFlexTF06{Field1: fwtypes.NewSetNestedObjectValueOfSliceMust(ctx, []*TestFlexTF01{
{Field1: types.StringValue("a")},
{Field1: types.StringValue("b")},
})},
Expand All @@ -385,7 +385,7 @@ func TestExpandGeneric(t *testing.T) {
},
{
TestName: "non-empty set Source and non-empty []struct Target",
Source: &TestFlexTF06{Field1: fwtypes.NewSetNestedObjectValueOfValueSlice(ctx, []TestFlexTF01{
Source: &TestFlexTF06{Field1: fwtypes.NewSetNestedObjectValueOfValueSliceMust(ctx, []TestFlexTF01{
{Field1: types.StringValue("a")},
{Field1: types.StringValue("b")},
})},
Expand All @@ -399,16 +399,16 @@ func TestExpandGeneric(t *testing.T) {
TestName: "complex Source and complex Target",
Source: &TestFlexTF07{
Field1: types.StringValue("m"),
Field2: fwtypes.NewListNestedObjectValueOfPtr(ctx, &TestFlexTF05{
Field1: fwtypes.NewListNestedObjectValueOfPtr(ctx, &TestFlexTF01{
Field2: fwtypes.NewListNestedObjectValueOfPtrMust(ctx, &TestFlexTF05{
Field1: fwtypes.NewListNestedObjectValueOfPtrMust(ctx, &TestFlexTF01{
Field1: types.StringValue("n"),
}),
}),
Field3: types.MapValueMust(types.StringType, map[string]attr.Value{
"X": types.StringValue("x"),
"Y": types.StringValue("y"),
}),
Field4: fwtypes.NewSetNestedObjectValueOfValueSlice(ctx, []TestFlexTF02{
Field4: fwtypes.NewSetNestedObjectValueOfValueSliceMust(ctx, []TestFlexTF02{
{Field1: types.Int64Value(100)},
{Field1: types.Int64Value(2000)},
{Field1: types.Int64Value(30000)},
Expand Down Expand Up @@ -439,7 +439,7 @@ func TestExpandGeneric(t *testing.T) {
{
TestName: "nested string map",
Source: &TestFlexTF14{
FieldOuter: fwtypes.NewListNestedObjectValueOfPtr(ctx, &TestFlexTF11{
FieldOuter: fwtypes.NewListNestedObjectValueOfPtrMust(ctx, &TestFlexTF11{
FieldInner: fwtypes.NewMapValueOfMust[basetypes.StringValue](ctx, map[string]attr.Value{
"x": types.StringValue("y"),
}),
Expand All @@ -457,7 +457,7 @@ func TestExpandGeneric(t *testing.T) {
{
TestName: "map block key list",
Source: &TestFlexMapBlockKeyTF01{
MapBlock: fwtypes.NewListNestedObjectValueOfValueSlice[TestFlexMapBlockKeyTF02](ctx, []TestFlexMapBlockKeyTF02{
MapBlock: fwtypes.NewListNestedObjectValueOfValueSliceMust[TestFlexMapBlockKeyTF02](ctx, []TestFlexMapBlockKeyTF02{
{
MapBlockKey: types.StringValue("x"),
Attr1: types.StringValue("a"),
Expand Down Expand Up @@ -487,7 +487,7 @@ func TestExpandGeneric(t *testing.T) {
{
TestName: "map block key set",
Source: &TestFlexMapBlockKeyTF03{
MapBlock: fwtypes.NewSetNestedObjectValueOfValueSlice[TestFlexMapBlockKeyTF02](ctx, []TestFlexMapBlockKeyTF02{
MapBlock: fwtypes.NewSetNestedObjectValueOfValueSliceMust[TestFlexMapBlockKeyTF02](ctx, []TestFlexMapBlockKeyTF02{
{
MapBlockKey: types.StringValue("x"),
Attr1: types.StringValue("a"),
Expand Down Expand Up @@ -517,7 +517,7 @@ func TestExpandGeneric(t *testing.T) {
{
TestName: "map block key ptr source",
Source: &TestFlexMapBlockKeyTF01{
MapBlock: fwtypes.NewListNestedObjectValueOfSlice(ctx, []*TestFlexMapBlockKeyTF02{
MapBlock: fwtypes.NewListNestedObjectValueOfSliceMust(ctx, []*TestFlexMapBlockKeyTF02{
{
MapBlockKey: types.StringValue("x"),
Attr1: types.StringValue("a"),
Expand Down Expand Up @@ -547,7 +547,7 @@ func TestExpandGeneric(t *testing.T) {
{
TestName: "map block key ptr both",
Source: &TestFlexMapBlockKeyTF01{
MapBlock: fwtypes.NewListNestedObjectValueOfSlice(ctx, []*TestFlexMapBlockKeyTF02{
MapBlock: fwtypes.NewListNestedObjectValueOfSliceMust(ctx, []*TestFlexMapBlockKeyTF02{
{
MapBlockKey: types.StringValue("x"),
Attr1: types.StringValue("a"),
Expand Down Expand Up @@ -577,7 +577,7 @@ func TestExpandGeneric(t *testing.T) {
{
TestName: "map block enum key",
Source: &TestFlexMapBlockKeyTF04{
MapBlock: fwtypes.NewListNestedObjectValueOfValueSlice[TestFlexMapBlockKeyTF05](ctx, []TestFlexMapBlockKeyTF05{
MapBlock: fwtypes.NewListNestedObjectValueOfValueSliceMust[TestFlexMapBlockKeyTF05](ctx, []TestFlexMapBlockKeyTF05{
{
MapBlockKey: fwtypes.StringEnumValue(TestEnumList),
Attr1: types.StringValue("a"),
Expand Down Expand Up @@ -635,7 +635,7 @@ func TestExpandSimpleSingleNestedBlock(t *testing.T) {
testCases := autoFlexTestCases{
{
TestName: "single nested block pointer",
Source: &tf02{Field1: fwtypes.NewObjectValueOf[tf01](ctx, &tf01{Field1: types.StringValue("a"), Field2: types.Int64Value(1)})},
Source: &tf02{Field1: fwtypes.NewObjectValueOfMust[tf01](ctx, &tf01{Field1: types.StringValue("a"), Field2: types.Int64Value(1)})},
Target: &aws02{},
WantTarget: &aws02{Field1: &aws01{Field1: aws.String("a"), Field2: 1}},
},
Expand All @@ -647,7 +647,7 @@ func TestExpandSimpleSingleNestedBlock(t *testing.T) {
},
{
TestName: "single nested block value",
Source: &tf02{Field1: fwtypes.NewObjectValueOf[tf01](ctx, &tf01{Field1: types.StringValue("a"), Field2: types.Int64Value(1)})},
Source: &tf02{Field1: fwtypes.NewObjectValueOfMust[tf01](ctx, &tf01{Field1: types.StringValue("a"), Field2: types.Int64Value(1)})},
Target: &aws03{},
WantTarget: &aws03{Field1: aws01{Field1: aws.String("a"), Field2: 1}},
},
Expand Down Expand Up @@ -686,10 +686,10 @@ func TestExpandComplexSingleNestedBlock(t *testing.T) {
{
TestName: "single nested block pointer",
Source: &tf03{
Field1: fwtypes.NewObjectValueOf[tf02](
Field1: fwtypes.NewObjectValueOfMust[tf02](
ctx,
&tf02{
Field1: fwtypes.NewObjectValueOf[tf01](
Field1: fwtypes.NewObjectValueOfMust[tf01](
ctx,
&tf01{
Field1: types.BoolValue(true),
Expand Down Expand Up @@ -782,13 +782,13 @@ func TestExpandComplexNestedBlockWithStringEnum(t *testing.T) {
testCases := autoFlexTestCases{
{
TestName: "single nested valid value",
Source: &tf02{Field1: types.Int64Value(1), Field2: fwtypes.NewListNestedObjectValueOfPtr(ctx, &tf01{Field2: fwtypes.StringEnumValue(TestEnumList)})},
Source: &tf02{Field1: types.Int64Value(1), Field2: fwtypes.NewListNestedObjectValueOfPtrMust(ctx, &tf01{Field2: fwtypes.StringEnumValue(TestEnumList)})},
Target: &aws01{},
WantTarget: &aws01{Field1: 1, Field2: &aws02{Field2: TestEnumList}},
},
{
TestName: "single nested empty value",
Source: &tf02{Field1: types.Int64Value(1), Field2: fwtypes.NewListNestedObjectValueOfPtr(ctx, &tf01{Field2: fwtypes.StringEnumNull[TestEnum]()})},
Source: &tf02{Field1: types.Int64Value(1), Field2: fwtypes.NewListNestedObjectValueOfPtrMust(ctx, &tf01{Field2: fwtypes.StringEnumNull[TestEnum]()})},
Target: &aws01{},
WantTarget: &aws01{Field1: 1, Field2: &aws02{Field2: ""}},
},
Expand Down
Loading

0 comments on commit b1ff3a0

Please sign in to comment.