@@ -16,6 +16,17 @@ describe("terraform_handler", function()
1616 )
1717 end )
1818
19+ it (" aws datasources" , function ()
20+ assert .equals (
21+ " https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route" ,
22+ handler .handle (" v" , ' data "aws_route" "example" {' )
23+ )
24+ assert .equals (
25+ " https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region" ,
26+ handler .handle (" v" , ' data "aws_region" "current" {' )
27+ )
28+ end )
29+
1930 it (" azure resources" , function ()
2031 assert .equals (
2132 " https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group" ,
@@ -27,6 +38,17 @@ describe("terraform_handler", function()
2738 )
2839 end )
2940
41+ it (" azure datasources" , function ()
42+ assert .equals (
43+ " https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/location" ,
44+ handler .handle (" v" , ' data "azurerm_location" "example" {' )
45+ )
46+ assert .equals (
47+ " https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/resources" ,
48+ handler .handle (" v" , ' data "azurerm_resources" "spokes" {' )
49+ )
50+ end )
51+
3052 it (" google resources" , function ()
3153 assert .equals (
3254 " https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance" ,
@@ -38,6 +60,13 @@ describe("terraform_handler", function()
3860 )
3961 end )
4062
63+ it (" google datasources" , function ()
64+ assert .equals (
65+ " https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/compute_images" ,
66+ handler .handle (" v" , ' data "google_compute_images" "example" {' )
67+ )
68+ end )
69+
4170 it (" kubernetes resources" , function ()
4271 assert .equals (
4372 " https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/deployment" ,
@@ -49,10 +78,16 @@ describe("terraform_handler", function()
4978 )
5079 end )
5180
81+ it (" kubernetes datasources" , function ()
82+ assert .equals (
83+ " https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/data-sources/mutating_webhook_configuration_v1" ,
84+ handler .handle (" v" , ' data "kubernetes_mutating_webhook_configuration_v1" "example" {' )
85+ )
86+ end )
87+
5288 it (" non-terraform lines" , function ()
5389 assert .is_nil (handler .handle (" v" , " This is not a terraform resource" ))
5490 assert .is_nil (handler .handle (" v" , ' variable "example" {' ))
55- assert .is_nil (handler .handle (" v" , ' data "aws_ami" "example" {' ))
5691 assert .is_nil (handler .handle (" v" , ' resource "unknown_provider_resource" "example" {' ))
5792 end )
5893end )
0 commit comments