Skip to content

Commit b81d242

Browse files
authored
Merge pull request #1 from getindata/initial_commit
feat: Snowflake AWS PrivateLInk initial commit
2 parents 5d2a924 + 4f29b69 commit b81d242

25 files changed

+634
-81
lines changed

.github/workflows/pre-commit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
env:
1010
TERRAFORM_DOCS_VERSION: v0.16.0
11-
# TFLINT_VERSION: v0.41.0 # use this version with "Invicton-Labs/deepmerge/null" module
11+
TFLINT_VERSION: v0.41.0
1212

1313
jobs:
1414
collectInputs:
@@ -80,4 +80,4 @@ jobs:
8080
with:
8181
terraform-version: ${{ steps.minMax.outputs.maxVersion }}
8282
terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}
83-
# tflint-version: ${{ env.TFLINT_VERSION }} # use this version with "Invicton-Labs/deepmerge/null" module
83+
tflint-version: ${{ env.TFLINT_VERSION }}

.terraform-docs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ formatter: "md tbl" # this is required
22

33
version: ">= 0.14"
44

5+
recursive:
6+
enabled: true
7+
path: ./examples
8+
59
sections:
610
hide: []
711
show: [all]

README.md

Lines changed: 50 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
1-
# Terraform Module Template
2-
3-
4-
> **Warning**:
5-
> This is a template document. Remember to **remove** all text in _italics_ and **update** Module name, Repo name and links/badges to the acual name of your GitHub repository/module!!!
1+
# Snowflake AWS PrivateLink Terraform Module
62

73
<!--- Pick Cloud provider Badge -->
84
<!---![Azure](https://img.shields.io/badge/azure-%230072C6.svg?style=for-the-badge&logo=microsoftazure&logoColor=white) -->
95
<!---![Google Cloud](https://img.shields.io/badge/GoogleCloud-%234285F4.svg?style=for-the-badge&logo=google-cloud&logoColor=white) -->
10-
![AWS](https://img.shields.io/badge/AWS-%23FF9900.svg?style=for-the-badge&logo=amazon-aws&logoColor=white)
11-
<!---![Snowflake](https://img.shields.io/badge/-SNOWFLAKE-249edc?style=for-the-badge&logo=snowflake&logoColor=white) -->
6+
![Snowflake](https://img.shields.io/badge/-SNOWFLAKE-249edc?style=for-the-badge&logo=snowflake&logoColor=white)
127
![Terraform](https://img.shields.io/badge/terraform-%235835CC.svg?style=for-the-badge&logo=terraform&logoColor=white)
138

149
<!--- Replace repository name -->
15-
![License](https://badgen.net/github/license/getindata/terraform-module-template/)
16-
![Release](https://badgen.net/github/release/getindata/terraform-module-template/)
10+
![License](https://badgen.net/github/license/getindata/terraform-snowflake-privatelink-aws/)
11+
![Release](https://badgen.net/github/release/getindata/terraform-snowflake-privatelink-aws/)
1712

1813
<p align="center">
1914
<img height="150" src="https://getindata.com/img/logo.svg">
@@ -22,33 +17,43 @@
2217

2318
---
2419

25-
_Brief Description of MODULE:_
20+
Terraform module that can create and manage AWS PrivateLink for Snowflake.
2621

27-
* _What it does_
28-
* _What techonlogies it uses_
22+
This module creates:
2923

30-
> **Warning**:
31-
> _When using "Invicton-Labs/deepmerge/null" module - pin `tflint` version to `v0.41.0` in [pre-commit.yaml](.github/workflows/pre-commit.yml) to avoid failing `tflint` checks_
24+
* AWS VPC Endpoint
25+
* Security group and assigns it to the endpoint
26+
* AWS Route53 private zone and adds needed records inside
3227

3328
## USAGE
3429

35-
_Example usage of the module - terraform code snippet_
36-
3730
```terraform
38-
module "template" {
39-
source = "github.com/getindata/terraform-module-template"
4031
41-
example_var = "foo"
32+
module "snowflake_privatelink_aws" {
33+
source = "../../"
34+
35+
name = "snowflake"
36+
37+
vpc_id = "vpc-01234567890abcdef
38+
subnet_ids = ["subnet-01234567890abcdef", "subnet-01234567890abcdeg"]
39+
40+
tags = {
41+
"example" = "tag"
42+
}
4243
}
44+
4345
```
4446

4547
## NOTES
4648

47-
_Additional information that should be made public, for ex. how to solve known issues, additional descriptions/suggestions_
49+
In order to successfully setup a PrivateLink in AWS - manual authorization of PrivateLink requests is needed,
50+
more information can be found in Snowflake Documentation -
51+
<https://docs.snowflake.com/en/user-guide/admin-security-privatelink.html#enabling-aws-privatelink>.
4852

4953
## EXAMPLES
5054

51-
- [Full example](examples/full-example)
55+
* [Complete example](examples/complete/)
56+
* [Simple example](examples/simple/)
5257

5358
<!-- BEGIN_TF_DOCS -->
5459

@@ -60,13 +65,15 @@ _Additional information that should be made public, for ex. how to solve known i
6065
| Name | Description | Type | Default | Required |
6166
|------|-------------|------|---------|:--------:|
6267
| <a name="input_additional_tag_map"></a> [additional\_tag\_map](#input\_additional\_tag\_map) | Additional key-value pairs to add to each map in `tags_as_list_of_maps`. Not added to `tags` or `id`.<br>This is for some rare cases where resources want additional configuration of tags<br>and therefore take a list of maps with tag key, value, and additional configuration. | `map(string)` | `{}` | no |
68+
| <a name="input_allow_vpc_cidr"></a> [allow\_vpc\_cidr](#input\_allow\_vpc\_cidr) | Whether allow access to the Snowflake PrivateLink endpoint from the whole VPC | `bool` | `true` | no |
69+
| <a name="input_allowed_cidrs"></a> [allowed\_cidrs](#input\_allowed\_cidrs) | List of subnet CIDRs that will be allowed to access Snowflake endpoint via PrivateLink | `list(string)` | `[]` | no |
6370
| <a name="input_attributes"></a> [attributes](#input\_attributes) | ID element. Additional attributes (e.g. `workers` or `cluster`) to add to `id`,<br>in the order they appear in the list. New attributes are appended to the<br>end of the list. The elements of the list are joined by the `delimiter`<br>and treated as a single ID element. | `list(string)` | `[]` | no |
6471
| <a name="input_context"></a> [context](#input\_context) | Single object for setting entire context at once.<br>See description of individual variables for details.<br>Leave string and numeric variables as `null` to use default value.<br>Individual variable settings (non-null) override settings in context object,<br>except for attributes, tags, and additional\_tag\_map, which are merged. | `any` | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": null,<br> "descriptor_formats": {},<br> "enabled": true,<br> "environment": null,<br> "id_length_limit": null,<br> "label_key_case": null,<br> "label_order": [],<br> "label_value_case": null,<br> "labels_as_tags": [<br> "unset"<br> ],<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "stage": null,<br> "tags": {},<br> "tenant": null<br>}</pre> | no |
6572
| <a name="input_delimiter"></a> [delimiter](#input\_delimiter) | Delimiter to be used between ID elements.<br>Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no |
6673
| <a name="input_descriptor_formats"></a> [descriptor\_formats](#input\_descriptor\_formats) | Describe additional descriptors to be output in the `descriptors` output map.<br>Map of maps. Keys are names of descriptors. Values are maps of the form<br>`{<br> format = string<br> labels = list(string)<br>}`<br>(Type is `any` so the map values can later be enhanced to provide additional options.)<br>`format` is a Terraform format string to be passed to the `format()` function.<br>`labels` is a list of labels, in order, to pass to `format()` function.<br>Label values will be normalized before being passed to `format()` so they will be<br>identical to how they appear in `id`.<br>Default is `{}` (`descriptors` output will be empty). | `any` | `{}` | no |
74+
| <a name="input_descriptor_name"></a> [descriptor\_name](#input\_descriptor\_name) | Name of the descriptor used to form a resource name | `string` | `"snowflake-privatelink"` | no |
6775
| <a name="input_enabled"></a> [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
6876
| <a name="input_environment"></a> [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
69-
| <a name="input_example_var"></a> [example\_var](#input\_example\_var) | Example varible passed into the module | `string` | n/a | yes |
7077
| <a name="input_id_length_limit"></a> [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).<br>Set to `0` for unlimited length.<br>Set to `null` for keep the existing setting, which defaults to `0`.<br>Does not affect `id_full`. | `number` | `null` | no |
7178
| <a name="input_label_key_case"></a> [label\_key\_case](#input\_label\_key\_case) | Controls the letter case of the `tags` keys (label names) for tags generated by this module.<br>Does not affect keys of tags passed in via the `tags` input.<br>Possible values: `lower`, `title`, `upper`.<br>Default value: `title`. | `string` | `null` | no |
7279
| <a name="input_label_order"></a> [label\_order](#input\_label\_order) | The order in which the labels (ID elements) appear in the `id`.<br>Defaults to ["namespace", "environment", "stage", "name", "attributes"].<br>You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present. | `list(string)` | `null` | no |
@@ -76,8 +83,10 @@ _Additional information that should be made public, for ex. how to solve known i
7683
| <a name="input_namespace"></a> [namespace](#input\_namespace) | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | `string` | `null` | no |
7784
| <a name="input_regex_replace_chars"></a> [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.<br>Characters matching the regex will be removed from the ID elements.<br>If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
7885
| <a name="input_stage"></a> [stage](#input\_stage) | ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no |
86+
| <a name="input_subnet_ids"></a> [subnet\_ids](#input\_subnet\_ids) | List of AWS Subnet IDs where Snowflake AWS PrivateLink Endpoint interfaces will be created | `list(string)` | n/a | yes |
7987
| <a name="input_tags"></a> [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).<br>Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no |
8088
| <a name="input_tenant"></a> [tenant](#input\_tenant) | ID element \_(Rarely used, not included by default)\_. A customer identifier, indicating who this instance of a resource is for | `string` | `null` | no |
89+
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | VPC ID where the AWS PrivateLink VPC Endpoint will be created | `string` | n/a | yes |
8190

8291
## Modules
8392

@@ -89,26 +98,38 @@ _Additional information that should be made public, for ex. how to solve known i
8998

9099
| Name | Description |
91100
|------|-------------|
92-
| <a name="output_example_output"></a> [example\_output](#output\_example\_output) | Example output of the module |
101+
| <a name="output_dns_private_zone"></a> [dns\_private\_zone](#output\_dns\_private\_zone) | Details of Route53 private hosted zone created for Snowflake PrivateLink |
102+
| <a name="output_security_group"></a> [security\_group](#output\_security\_group) | Details of security group assigned to Snowflake AWS PrivateLink VPC Endpoint |
103+
| <a name="output_snowflake_privatelink_ocsp_url"></a> [snowflake\_privatelink\_ocsp\_url](#output\_snowflake\_privatelink\_ocsp\_url) | URL to access Snowflake OCSP endpont using AWS PrivateLink |
104+
| <a name="output_snowflake_privatelink_url"></a> [snowflake\_privatelink\_url](#output\_snowflake\_privatelink\_url) | URL to access Snowflake using AWS PrivateLink |
105+
| <a name="output_vpc_endpoint"></a> [vpc\_endpoint](#output\_vpc\_endpoint) | Details created Snowflake AWS PrivateLink VPC Endpoint |
93106

94107
## Providers
95108

96109
| Name | Version |
97110
|------|---------|
98-
| <a name="provider_null"></a> [null](#provider\_null) | 3.1.1 |
111+
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 4.0 |
112+
| <a name="provider_snowflake"></a> [snowflake](#provider\_snowflake) | ~> 0.47 |
99113

100114
## Requirements
101115

102116
| Name | Version |
103117
|------|---------|
104-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.0 |
105-
| <a name="requirement_null"></a> [null](#requirement\_null) | 3.1.1 |
118+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
119+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 4.0 |
120+
| <a name="requirement_snowflake"></a> [snowflake](#requirement\_snowflake) | ~> 0.47 |
106121

107122
## Resources
108123

109124
| Name | Type |
110125
|------|------|
111-
| [null_resource.output_input](https://registry.terraform.io/providers/hashicorp/null/3.1.1/docs/resources/resource) | resource |
126+
| [aws_route53_record.snowflake_private_link_ocsp_url](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource |
127+
| [aws_route53_record.snowflake_private_link_url](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource |
128+
| [aws_route53_zone.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_zone) | resource |
129+
| [aws_security_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource |
130+
| [aws_vpc_endpoint.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint) | resource |
131+
| [aws_vpc.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) | data source |
132+
| [snowflake_system_get_privatelink_config.this](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/data-sources/system_get_privatelink_config) | data source |
112133
<!-- END_TF_DOCS -->
113134

114135
## CONTRIBUTING
@@ -124,8 +145,8 @@ Apache 2 Licensed. See [LICENSE](LICENSE) for full details.
124145
## AUTHORS
125146

126147
<!--- Replace repository name -->
127-
<a href="https://github.com/getindata/REPO_NAME/graphs/contributors">
128-
<img src="https://contrib.rocks/image?repo=getindata/terraform-module-template" />
148+
<a href="https://github.com/getindata/snowflake-privatelink-aws/graphs/contributors">
149+
<img src="https://contrib.rocks/image?repo=getindata/terraform-snowflake-privatelink-aws" />
129150
</a>
130151

131152
Made with [contrib.rocks](https://contrib.rocks).
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
formatter: "md tbl" # this is required
2+
3+
version: ">= 0.14"
4+
5+
header-from: main.tf
6+
7+
sections:
8+
hide: []
9+
show: [all]
10+
11+
content: |-
12+
{{ .Header }}
13+
14+
{{ .Footer }}
15+
16+
{{ .Inputs }}
17+
18+
{{ .Modules }}
19+
20+
{{ .Outputs }}
21+
22+
{{ .Providers }}
23+
24+
{{ .Requirements }}
25+
26+
{{ .Resources }}
27+
28+
output:
29+
file: "README.md"
30+
mode: inject
31+
template: |-
32+
<!-- BEGIN_TF_DOCS -->
33+
{{ .Content }}
34+
<!-- END_TF_DOCS -->
35+
36+
output-values:
37+
enabled: false
38+
from: ""
39+
40+
sort:
41+
enabled: true
42+
by: name
43+
44+
settings:
45+
anchor: true
46+
color: true
47+
default: true
48+
description: false
49+
escape: true
50+
hide-empty: false
51+
html: true
52+
indent: 2
53+
lockfile: false
54+
read-comments: true
55+
required: true
56+
sensitive: true
57+
type: true

0 commit comments

Comments
 (0)