-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresource-definition.tf.template
52 lines (47 loc) · 1.29 KB
/
resource-definition.tf.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
variable "region" {}
variable "access_key" {}
variable "secret_key" {}
variable "prefix" {}
terraform {
required_providers {
humanitec = {
source = "humanitec/humanitec"
}
}
}
provider "humanitec" {
# Will read config from env-vars HUMANITEC_ORG & HUMANITEC_TOKEN
}
resource "humanitec_resource_definition" "aws_terraform_resource_s3_bucket" {
driver_type = "humanitec/terraform"
id = "${var.prefix}-aws-terrafom-s3-bucket"
name = "${var.prefix}-aws-terrafom-s3-bucket"
type = "s3"
driver_inputs = {
secrets = {
variables = jsonencode({
access_key = var.access_key
secret_key = var.secret_key
})
},
values = {
"source" = jsonencode(
{
path = "s3/terraform/bucket/"
rev = "refs/heads/main"
url = "https://github.com/jayonthenet/ht-tf-simple.git"
}
)
"variables" = jsonencode(
{
region = var.region,
bucket = "simple-bucket-$${context.app.id}-$${context.env.id}",
}
)
}
}
}
resource "humanitec_resource_definition_criteria" "aws_terraform_resource_s3_bucket" {
resource_definition_id = humanitec_resource_definition.aws_terraform_resource_s3_bucket.id
app_id = humanitec_application.app.id
}