Skip to content

Commit

Permalink
Encryption_type is not required
Browse files Browse the repository at this point in the history
  • Loading branch information
michelledeng30 committed Jan 6, 2025
1 parent 1d97952 commit a9766fa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
30 changes: 17 additions & 13 deletions datadog/resource_datadog_logs_archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func resourceDatadogLogsArchive() *schema.Resource {
ValidateDiagFunc: validators.ValidateAWSAccountID,
},
"role_name": {Description: "Your AWS role name", Type: schema.TypeString, Required: true},
"encryption_type": {Description: "The type of encryption on your archive.", Type: schema.TypeString, Required: true},
"encryption_type": {Description: "The type of encryption on your archive.", Type: schema.TypeString, Required: false},
"encryption_key": {Description: "The AWS KMS encryption key.", Type: schema.TypeString, Required: false},
},
},
Expand Down Expand Up @@ -426,24 +426,28 @@ func buildS3Destination(dest interface{}) (*datadogV2.LogsArchiveDestinationS3,
if !ok {
path = ""
}
encryptionType, ok := d["encryptionType"]
if !ok {
return &datadogV2.LogsArchiveDestinationS3{}, fmt.Errorf("encryption type is not defined")
}
encryptionKey, ok := d["encryptionKey"]
var LogsArchiveEncryptionS3 encryption

var datadogV2.LogsArchiveEncryptionS3 encryption

Check failure on line 430 in datadog/resource_datadog_logs_archive.go

View workflow job for this annotation

GitHub Actions / test-tofu

syntax error: unexpected ., expected type

Check failure on line 430 in datadog/resource_datadog_logs_archive.go

View workflow job for this annotation

GitHub Actions / test-tofu

syntax error: unexpected ., expected type

Check failure on line 430 in datadog/resource_datadog_logs_archive.go

View workflow job for this annotation

GitHub Actions / linter-checks

syntax error: unexpected ., expected type

Check failure on line 430 in datadog/resource_datadog_logs_archive.go

View workflow job for this annotation

GitHub Actions / test (0.14.11, ubuntu-latest)

expected type, found '.'

Check failure on line 430 in datadog/resource_datadog_logs_archive.go

View workflow job for this annotation

GitHub Actions / test (0.14.11, ubuntu-latest)

syntax error: unexpected ., expected type

Check failure on line 430 in datadog/resource_datadog_logs_archive.go

View workflow job for this annotation

GitHub Actions / test (0.14.11, ubuntu-latest)

syntax error: unexpected ., expected type

Check failure on line 430 in datadog/resource_datadog_logs_archive.go

View workflow job for this annotation

GitHub Actions / test (0.15.5, ubuntu-latest)

expected type, found '.'

Check failure on line 430 in datadog/resource_datadog_logs_archive.go

View workflow job for this annotation

GitHub Actions / test (0.15.5, ubuntu-latest)

syntax error: unexpected ., expected type

Check failure on line 430 in datadog/resource_datadog_logs_archive.go

View workflow job for this annotation

GitHub Actions / test (0.15.5, ubuntu-latest)

syntax error: unexpected ., expected type

Check failure on line 430 in datadog/resource_datadog_logs_archive.go

View workflow job for this annotation

GitHub Actions / test (1.1.2, ubuntu-latest)

expected type, found '.'

Check failure on line 430 in datadog/resource_datadog_logs_archive.go

View workflow job for this annotation

GitHub Actions / test (1.1.2, ubuntu-latest)

syntax error: unexpected ., expected type

Check failure on line 430 in datadog/resource_datadog_logs_archive.go

View workflow job for this annotation

GitHub Actions / test (1.1.2, ubuntu-latest)

syntax error: unexpected ., expected type

Check failure on line 430 in datadog/resource_datadog_logs_archive.go

View workflow job for this annotation

GitHub Actions / test (1.5.3, ubuntu-latest)

expected type, found '.'

Check failure on line 430 in datadog/resource_datadog_logs_archive.go

View workflow job for this annotation

GitHub Actions / test (1.5.3, ubuntu-latest)

syntax error: unexpected ., expected type

Check failure on line 430 in datadog/resource_datadog_logs_archive.go

View workflow job for this annotation

GitHub Actions / test (1.5.3, ubuntu-latest)

syntax error: unexpected ., expected type

encryptionType, ok := d["encryption_type"]
if !ok {
encryption = datadogV2.NewLogsArchiveEncryptionS3(
encryptionType.(string),
"NO_OVERRIDE",
)
} else {
encryption = datadogV2.NewLogsArchiveEncryptionS3(
encryptionType.(string),
encryptionKey.(string),
)
encryptionKey, ok := d["encryption_key"]
if !ok {
encryption = datadogV2.NewLogsArchiveEncryptionS3(
encryptionType.(string),
)
} else {
encryption = datadogV2.NewLogsArchiveEncryptionS3(
encryptionType.(string),
encryptionKey.(string),
)
}
}

destination := datadogV2.NewLogsArchiveDestinationS3(
bucket.(string),
*integration,
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/logs_archive.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Required:
Optional:

- `path` (String) Path where the archive is stored.
- `encryption_type` (String) The type of server-side encryption to use when uploading data to your s3 bucket. `NO_OVERRIDE`, `SSE_S3`, and `SSE_KMS` are the possible types. `NO_OVERRIDE` is used most commonly to leave data unencrypted or leave encryption to the default encryption set on s3 bucket settings.
- `encryption_type` (String) The type of server-side encryption to use when uploading data to your S3 bucket. `NO_OVERRIDE`, `SSE_S3`, and `SSE_KMS` are the possible types. `NO_OVERRIDE` is used most commonly, because users can rely on default encryption on their S3 buckets instead of specifically uploading objects with encryption information.
- `encryption_key` (String) The key ARN used to identify your customer managed key for AWS KMS encryption. Only set this value if the `encryption_type` is set to `SSE_KMS`.

## Import
Expand Down

0 comments on commit a9766fa

Please sign in to comment.