-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38574 from madhavvishnubhatta/f-sfn-kms-integration
Added support for "EncryptionConfiguration" in StateMachine and Activity Resources
- Loading branch information
Showing
8 changed files
with
588 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
```release-note:enhancement | ||
resource/aws_sfn_activity: Add `encryption_configuration` configuration block to support the use of Customer Managed Keys with AWS KMS to encrypt Step Functions Activity resources | ||
``` | ||
|
||
```release-note:enhancement | ||
resource/aws_sfn_state_machine: Add `encryption_configuration` configuration block to support the use of Customer Managed Keys with AWS KMS to encrypt Step Functions State Machine resources | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package sfn | ||
|
||
import ( | ||
"github.com/aws/aws-sdk-go-v2/aws" | ||
awstypes "github.com/aws/aws-sdk-go-v2/service/sfn/types" | ||
"github.com/hashicorp/terraform-provider-aws/names" | ||
) | ||
|
||
func expandEncryptionConfiguration(tfMap map[string]interface{}) *awstypes.EncryptionConfiguration { | ||
if tfMap == nil { | ||
return nil | ||
} | ||
|
||
apiObject := &awstypes.EncryptionConfiguration{} | ||
|
||
if v, ok := tfMap["kms_data_key_reuse_period_seconds"].(int); ok && v != 0 { | ||
apiObject.KmsDataKeyReusePeriodSeconds = aws.Int32(int32(v)) | ||
} | ||
|
||
if v, ok := tfMap[names.AttrKMSKeyID].(string); ok && v != "" { | ||
apiObject.KmsKeyId = aws.String(v) | ||
} | ||
|
||
if v, ok := tfMap[names.AttrType].(string); ok && v != "" { | ||
apiObject.Type = awstypes.EncryptionType(v) | ||
} | ||
|
||
return apiObject | ||
} | ||
|
||
func flattenEncryptionConfiguration(apiObject *awstypes.EncryptionConfiguration) map[string]interface{} { | ||
if apiObject == nil { | ||
return nil | ||
} | ||
|
||
tfMap := map[string]interface{}{ | ||
names.AttrKMSKeyID: aws.ToString(apiObject.KmsKeyId), | ||
names.AttrType: apiObject.Type, | ||
} | ||
|
||
if v := apiObject.KmsDataKeyReusePeriodSeconds; v != nil { | ||
tfMap["kms_data_key_reuse_period_seconds"] = aws.ToInt32(v) | ||
} | ||
|
||
return tfMap | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.