Skip to content

Commit

Permalink
Converted resource okta_log_stream implementation from Terraform SDK v2
Browse files Browse the repository at this point in the history
to Terraform Plugin Framework Protocol 5.
  • Loading branch information
monde committed Dec 7, 2023
1 parent b3f8831 commit 0ea729b
Show file tree
Hide file tree
Showing 8 changed files with 534 additions and 32 deletions.
8 changes: 4 additions & 4 deletions examples/resources/okta_log_stream/basic.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource "okta_log_stream" "eventbridge_log_stream_example" {
resource "okta_log_stream" "eventbridge" {
name = "testAcc_replace_with_uuid EventBridge"
type = "aws_eventbridge"
status = "ACTIVE"
Expand All @@ -9,13 +9,13 @@ resource "okta_log_stream" "eventbridge_log_stream_example" {
}
}

resource "okta_log_stream" "splunk_log_stream_example" {
resource "okta_log_stream" "splunk" {
name = "testAcc_replace_with_uuid Splunk"
type = "splunk_cloud_logstreaming"
status = "ACTIVE"
status = "INACTIVE"
settings {
host = "acme.splunkcloud.com"
edition = "aws"
token = "58A7C8D6-4E2F-4C3B-8F5B-D4E2F3A4B5C6"
}
}
}
8 changes: 4 additions & 4 deletions examples/resources/okta_log_stream/basic_updated.tf
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
resource "okta_log_stream" "eventbridge_log_stream_example" {
resource "okta_log_stream" "eventbridge" {
name = "testAcc_replace_with_uuid EventBridge Updated"
type = "aws_eventbridge"
status = "ACTIVE"
status = "INACTIVE"
settings {
account_id = "123456789012"
region = "eu-west-3"
event_source_name = "testAcc_replace_with_uuid"
}
}

resource "okta_log_stream" "splunk_log_stream_example" {
resource "okta_log_stream" "splunk" {
name = "testAcc_replace_with_uuid Splunk Updated"
type = "splunk_cloud_logstreaming"
status = "ACTIVE"
Expand All @@ -18,4 +18,4 @@ resource "okta_log_stream" "splunk_log_stream_example" {
edition = "aws"
token = "58A7C8D6-4E2F-4C3B-8F5B-D4E2F3A4B5C6"
}
}
}
2 changes: 1 addition & 1 deletion okta/data_source_okta_log_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func dataSourceLogStreamRead(ctx context.Context, d *schema.ResourceData, m inte

settings := make(map[string]interface{})
// aws
assignIfNotEmpty(&settings, "account_id", logStream.Settings.AccountId)
assignIfNotEmpty(&settings, "account_id", logStream.Settings.AccountID)
assignIfNotEmpty(&settings, "event_source_name", logStream.Settings.EventSourceName)
assignIfNotEmpty(&settings, "region", logStream.Settings.Region)

Expand Down
6 changes: 3 additions & 3 deletions okta/data_source_okta_log_stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ func TestAccDataSourceOktaLogStream_read(t *testing.T) {
splunkDataSource := fmt.Sprintf("data.%s.test_by_name", logStream)

oktaResourceTest(t, resource.TestCase{
PreCheck: testAccPreCheck(t),
ErrorCheck: testAccErrorChecks(t),
ProviderFactories: testAccProvidersFactories,
PreCheck: testAccPreCheck(t),
ErrorCheck: testAccErrorChecks(t),
ProtoV5ProviderFactories: testAccMergeProvidersFactories,
Steps: []resource.TestStep{
{
Config: config,
Expand Down
1 change: 1 addition & 0 deletions okta/framework_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ func (p *FrameworkProvider) Resources(_ context.Context) []func() resource.Resou
NewAppAccessPolicyAssignmentResource,
NewAppOAuthRoleAssignmentResource,
NewBrandResource,
NewLogStreamResource,
NewPolicyDeviceAssuranceAndroidResource,
NewPolicyDeviceAssuranceChromeOSResource,
NewPolicyDeviceAssuranceIOSResource,
Expand Down
1 change: 0 additions & 1 deletion okta/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ func Provider() *schema.Provider {
inlineHook: resourceInlineHook(),
linkDefinition: resourceLinkDefinition(),
linkValue: resourceLinkValue(),
logStream: resourceLogStream(),
networkZone: resourceNetworkZone(),
orgConfiguration: resourceOrgConfiguration(),
orgSupport: resourceOrgSupport(),
Expand Down
Loading

0 comments on commit 0ea729b

Please sign in to comment.