Skip to content

Commit

Permalink
Merge pull request #19820 from hashicorp/b-security_group_id_nil
Browse files Browse the repository at this point in the history
Check VpcSettings and ConnectSettings for nil values
  • Loading branch information
bill-rich authored Jun 17, 2021
2 parents 87cbd86 + fa883eb commit 507aeeb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changelog/19820.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
data-source/aws_directory_service_directory: Check VpcSettings and ConnectSettings for nil values
```
4 changes: 2 additions & 2 deletions aws/data_source_aws_directory_service_directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 507aeeb

Please sign in to comment.