Skip to content

Commit

Permalink
chore: Couple of fixes
Browse files Browse the repository at this point in the history
1. Ensure that query_language is handled identically for policy and policy_compliance resources
2. Add query_language to variable and output in main.tf
  • Loading branch information
gspofford-lw committed Apr 23, 2024
1 parent f5f0bd5 commit b6465f8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
9 changes: 9 additions & 0 deletions examples/resource_lacework_query/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ variable "query_id" {
default = "Lql_Terraform_Query"
}

variable "query_id" {
type = string
default = ""
}

variable "query" {
type = string
default = <<EOT
Expand All @@ -40,6 +45,10 @@ output "query_id" {
value = lacework_query.example.id
}

output "query_language" {
value = lacework_query.example.query_language
}

output "query" {
value = lacework_query.example.query
}
8 changes: 6 additions & 2 deletions lacework/resource_lacework_policy_compliance.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ func resourceLaceworkPolicyComplianceCreate(d *schema.ResourceData, meta interfa
}

d.SetId(response.Data.PolicyID)
d.Set("query_language", response.Data.QueryLanguage)
if response.Data.QueryLanguage != nil {
d.Set("query_language", response.Data.QueryLanguage)
}
d.Set("owner", response.Data.Owner)
d.Set("updated_time", response.Data.LastUpdateTime)
d.Set("updated_by", response.Data.LastUpdateUser)
Expand All @@ -159,7 +161,9 @@ func resourceLaceworkPolicyComplianceRead(d *schema.ResourceData, meta interface
d.SetId(response.Data.PolicyID)
d.Set("title", response.Data.Title)
d.Set("query_id", response.Data.QueryID)
d.Set("query_language", response.Data.QueryLanguage)
if response.Data.QueryLanguage != nil {
d.Set("query_language", response.Data.QueryLanguage)
}
d.Set("enabled", response.Data.Enabled)
d.Set("description", response.Data.Description)
d.Set("severity", response.Data.Severity)
Expand Down

0 comments on commit b6465f8

Please sign in to comment.