Skip to content

Commit 4830c24

Browse files
authored
Merge pull request #3 from getindata/fix/add-count-to-data
fix: Add count to data to properly disable/enable
2 parents 968b4ce + 6eaff00 commit 4830c24

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

main.tf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
data "snowflake_system_get_privatelink_config" "this" {}
1+
data "snowflake_system_get_privatelink_config" "this" {
2+
count = module.this.enabled ? 1 : 0
3+
}
24

35
data "aws_vpc" "this" {
46
count = local.vpc_cidr_enabled
@@ -35,7 +37,7 @@ resource "aws_vpc_endpoint" "this" {
3537
count = module.this.enabled ? 1 : 0
3638

3739
vpc_id = var.vpc_id
38-
service_name = data.snowflake_system_get_privatelink_config.this.aws_vpce_id
40+
service_name = one(data.snowflake_system_get_privatelink_config.this[*].aws_vpce_id)
3941
vpc_endpoint_type = "Interface"
4042
security_group_ids = [one(aws_security_group.this[*].id)]
4143
subnet_ids = var.subnet_ids
@@ -65,7 +67,7 @@ resource "aws_route53_record" "snowflake_private_link_url" {
6567
count = module.this.enabled ? 1 : 0
6668

6769
zone_id = one(aws_route53_zone.this[*].zone_id)
68-
name = data.snowflake_system_get_privatelink_config.this.account_url
70+
name = one(data.snowflake_system_get_privatelink_config.this[*].account_url)
6971
type = "CNAME"
7072
ttl = "300"
7173
records = [one(aws_vpc_endpoint.this).dns_entry[0]["dns_name"]]
@@ -75,7 +77,7 @@ resource "aws_route53_record" "snowflake_private_link_ocsp_url" {
7577
count = module.this.enabled ? 1 : 0
7678

7779
zone_id = one(aws_route53_zone.this[*].zone_id)
78-
name = data.snowflake_system_get_privatelink_config.this.ocsp_url
80+
name = one(data.snowflake_system_get_privatelink_config.this[*].ocsp_url)
7981
type = "CNAME"
8082
ttl = "300"
8183
records = [one(aws_vpc_endpoint.this).dns_entry[0]["dns_name"]]

0 commit comments

Comments
 (0)