Skip to content

Commit 689cf97

Browse files
committed
Remove providers definition from root module
1 parent 70d3b59 commit 689cf97

File tree

5 files changed

+136
-23
lines changed

5 files changed

+136
-23
lines changed

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,50 @@ The module has been tested with:
99
- PostgreSQL 15
1010
- Materialize Helm Operator Terraform Module v0.1.1
1111

12+
## Providers Configuration
13+
14+
The module requires the following providers to be configured:
15+
16+
```hcl
17+
provider "aws" {
18+
region = "us-east-1"
19+
# Other AWS provider configuration as needed
20+
}
21+
22+
# Required for EKS authentication
23+
provider "kubernetes" {
24+
host = module.materialize_infrastructure.eks_cluster_endpoint
25+
cluster_ca_certificate = base64decode(module.materialize_infrastructure.cluster_certificate_authority_data)
26+
27+
exec {
28+
api_version = "client.authentication.k8s.io/v1beta1"
29+
args = ["eks", "get-token", "--cluster-name", module.materialize_infrastructure.eks_cluster_name]
30+
command = "aws"
31+
}
32+
}
33+
34+
# Required for Materialize Operator installation
35+
provider "helm" {
36+
kubernetes {
37+
host = module.materialize_infrastructure.eks_cluster_endpoint
38+
cluster_ca_certificate = base64decode(module.materialize_infrastructure.cluster_certificate_authority_data)
39+
40+
exec {
41+
api_version = "client.authentication.k8s.io/v1beta1"
42+
args = ["eks", "get-token", "--cluster-name", module.materialize_infrastructure.eks_cluster_name]
43+
command = "aws"
44+
}
45+
}
46+
}
47+
48+
module "materialize_infrastructure" {
49+
source = "git::https://github.com/MaterializeInc/terraform-aws-materialize.git"
50+
# Other required variables
51+
}
52+
```
53+
54+
> **Note:** The Kubernetes and Helm providers are configured to use the AWS CLI for authentication with the EKS cluster. This requires that you have the AWS CLI installed and configured with access to the AWS account where the EKS cluster is deployed.
55+
1256
## Requirements
1357

1458
| Name | Version |
@@ -103,6 +147,7 @@ The module has been tested with:
103147

104148
| Name | Description |
105149
|------|-------------|
150+
| <a name="output_cluster_certificate_authority_data"></a> [cluster\_certificate\_authority\_data](#output\_cluster\_certificate\_authority\_data) | Base64 encoded certificate data required to communicate with the cluster |
106151
| <a name="output_database_endpoint"></a> [database\_endpoint](#output\_database\_endpoint) | RDS instance endpoint |
107152
| <a name="output_eks_cluster_endpoint"></a> [eks\_cluster\_endpoint](#output\_eks\_cluster\_endpoint) | EKS cluster endpoint |
108153
| <a name="output_eks_cluster_name"></a> [eks\_cluster\_name](#output\_eks\_cluster\_name) | EKS cluster name |

docs/header.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,53 @@ Terraform module for deploying Materialize on AWS Cloud Platform with all requir
77
The module has been tested with:
88
- PostgreSQL 15
99
- Materialize Helm Operator Terraform Module v0.1.1
10+
11+
## Providers Configuration
12+
13+
The module requires the following providers to be configured:
14+
15+
```hcl
16+
provider "aws" {
17+
region = "us-east-1"
18+
# Other AWS provider configuration as needed
19+
}
20+
21+
# Required for EKS authentication
22+
provider "kubernetes" {
23+
host = module.materialize_infrastructure.eks_cluster_endpoint
24+
cluster_ca_certificate = base64decode(module.materialize_infrastructure.cluster_certificate_authority_data)
25+
26+
exec {
27+
api_version = "client.authentication.k8s.io/v1beta1"
28+
args = ["eks", "get-token", "--cluster-name", module.materialize_infrastructure.eks_cluster_name]
29+
command = "aws"
30+
}
31+
}
32+
33+
# Required for Materialize Operator installation
34+
provider "helm" {
35+
kubernetes {
36+
host = module.materialize_infrastructure.eks_cluster_endpoint
37+
cluster_ca_certificate = base64decode(module.materialize_infrastructure.cluster_certificate_authority_data)
38+
39+
exec {
40+
api_version = "client.authentication.k8s.io/v1beta1"
41+
args = ["eks", "get-token", "--cluster-name", module.materialize_infrastructure.eks_cluster_name]
42+
command = "aws"
43+
}
44+
}
45+
}
46+
47+
module "materialize_infrastructure" {
48+
source = "git::https://github.com/MaterializeInc/terraform-aws-materialize.git"
49+
# Other required variables
50+
}
51+
```
52+
53+
> **Note:** The Kubernetes and Helm providers are configured to use the AWS CLI for authentication with the EKS cluster. This requires that you have the AWS CLI installed and configured with access to the AWS account where the EKS cluster is deployed.
54+
55+
You can also set the `AWS_PROFILE` environment variable to the name of the profile you want to use for authentication with the EKS cluster:
56+
57+
```bash
58+
export AWS_PROFILE=your-profile-name
59+
```

examples/simple/main.tf

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,41 @@ provider "aws" {
22
region = "us-east-1"
33
}
44

5+
provider "kubernetes" {
6+
host = module.materialize_infrastructure.eks_cluster_endpoint
7+
cluster_ca_certificate = base64decode(module.materialize_infrastructure.cluster_certificate_authority_data)
8+
9+
exec {
10+
api_version = "client.authentication.k8s.io/v1beta1"
11+
command = "aws"
12+
args = ["eks", "get-token", "--cluster-name", module.materialize_infrastructure.eks_cluster_name]
13+
}
14+
}
15+
16+
provider "helm" {
17+
kubernetes {
18+
host = module.materialize_infrastructure.eks_cluster_endpoint
19+
cluster_ca_certificate = base64decode(module.materialize_infrastructure.cluster_certificate_authority_data)
20+
21+
exec {
22+
api_version = "client.authentication.k8s.io/v1beta1"
23+
command = "aws"
24+
args = ["eks", "get-token", "--cluster-name", module.materialize_infrastructure.eks_cluster_name]
25+
}
26+
}
27+
}
28+
529
module "materialize_infrastructure" {
630
# To pull this from GitHub, use the following:
731
# source = "git::https://github.com/MaterializeInc/terraform-aws-materialize.git"
832
source = "../../"
933

34+
providers = {
35+
aws = aws
36+
kubernetes = kubernetes
37+
helm = helm
38+
}
39+
1040
# The namespace and environment variables are used to construct the names of the resources
1141
# e.g. ${namespace}-${environment}-storage, ${namespace}-${environment}-db etc.
1242
namespace = var.namespace
@@ -140,3 +170,9 @@ output "materialize_s3_role_arn" {
140170
description = "The ARN of the IAM role for Materialize"
141171
value = module.materialize_infrastructure.materialize_s3_role_arn
142172
}
173+
174+
output "cluster_certificate_authority_data" {
175+
description = "The CA certificate for the EKS cluster"
176+
value = module.materialize_infrastructure.cluster_certificate_authority_data
177+
sensitive = true
178+
}

outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ output "eks_cluster_name" {
1313
value = module.eks.cluster_name
1414
}
1515

16+
output "cluster_certificate_authority_data" {
17+
description = "Base64 encoded certificate data required to communicate with the cluster"
18+
value = module.eks.cluster_certificate_authority_data
19+
}
20+
1621
output "database_endpoint" {
1722
description = "RDS instance endpoint"
1823
value = module.database.db_instance_endpoint

providers.tf

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)