From acf4b550ac2b33fbc853f2718627bedc2410c466 Mon Sep 17 00:00:00 2001 From: bill-rich Date: Tue, 15 Jun 2021 16:24:10 -0700 Subject: [PATCH 1/2] Check for nil values --- aws/data_source_aws_directory_service_directory.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aws/data_source_aws_directory_service_directory.go b/aws/data_source_aws_directory_service_directory.go index d4087075d81..8cd92cb946e 100644 --- a/aws/data_source_aws_directory_service_directory.go +++ b/aws/data_source_aws_directory_service_directory.go @@ -182,9 +182,9 @@ func dataSourceAwsDirectoryServiceDirectoryRead(d *schema.ResourceData, meta int d.Set("enable_sso", dir.SsoEnabled) var securityGroupId *string - if aws.StringValue(dir.Type) == directoryservice.DirectoryTypeAdconnector { + if aws.StringValue(dir.Type) == directoryservice.DirectoryTypeAdconnector && dir.ConnectSettings != nil { securityGroupId = dir.ConnectSettings.SecurityGroupId - } else { + } else if dir.VpcSettings != nil { securityGroupId = dir.VpcSettings.SecurityGroupId } d.Set("security_group_id", securityGroupId) From fa883ebe4e93fb116ca0f57be0ce593dbd2cb288 Mon Sep 17 00:00:00 2001 From: bill-rich Date: Thu, 17 Jun 2021 16:07:39 -0700 Subject: [PATCH 2/2] Add CHANGELOG entry --- .changelog/19820.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/19820.txt diff --git a/.changelog/19820.txt b/.changelog/19820.txt new file mode 100644 index 00000000000..2f08ee6f8a2 --- /dev/null +++ b/.changelog/19820.txt @@ -0,0 +1,3 @@ +```release-note:bug +data-source/aws_directory_service_directory: Check VpcSettings and ConnectSettings for nil values +```