-
Notifications
You must be signed in to change notification settings - Fork 124
/
config.go
86 lines (72 loc) · 3.32 KB
/
config.go
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package glue
import (
"github.com/upbound/upjet/pkg/config"
"github.com/upbound/provider-aws/config/common"
)
// Configure adds configurations for the glue group.
func Configure(p *config.Provider) {
p.AddResourceConfigurator("aws_glue_catalog_database", func(r *config.Resource) {
// Required in ID but optional in schema since TF defaults to Account ID.
// This causes refresh to fail in the first reconcile.
r.TerraformResource.Schema["catalog_id"].Computed = false
r.TerraformResource.Schema["catalog_id"].Optional = false
})
p.AddResourceConfigurator("aws_glue_catalog_table", func(r *config.Resource) {
// Required in ID but optional in schema since TF defaults to Account ID.
// This causes refresh to fail in the first reconcile.
r.TerraformResource.Schema["catalog_id"].Computed = false
r.TerraformResource.Schema["catalog_id"].Optional = false
})
p.AddResourceConfigurator("aws_glue_connection", func(r *config.Resource) {
// Required in ID but optional in schema since TF defaults to Account ID.
// This causes refresh to fail in the first reconcile.
r.TerraformResource.Schema["catalog_id"].Required = true
r.TerraformResource.Schema["catalog_id"].Computed = false
r.TerraformResource.Schema["catalog_id"].Optional = false
})
p.AddResourceConfigurator("aws_glue_user_defined_function", func(r *config.Resource) {
// Required in ID but optional in schema since TF defaults to Account ID.
// This causes refresh to fail in the first reconcile.
r.TerraformResource.Schema["catalog_id"].Computed = false
r.TerraformResource.Schema["catalog_id"].Optional = false
delete(r.References, "catalog_id")
})
p.AddResourceConfigurator("aws_glue_crawler", func(r *config.Resource) {
r.References["role"] = config.Reference{
Type: "github.com/upbound/provider-aws/apis/iam/v1beta1.Role",
Extractor: common.PathARNExtractor,
}
})
p.AddResourceConfigurator("aws_glue_data_catalog_encryption_settings", func(r *config.Resource) {
r.References["data_catalog_encryption_settings.connection_password_encryption.aws_kms_key_id"] = config.Reference{
Type: "github.com/upbound/provider-aws/apis/kms/v1beta1.Key",
Extractor: common.PathARNExtractor,
}
r.References["data_catalog_encryption_settings.encryption_at_rest.sse_aws_kms_key_id"] = config.Reference{
Type: "github.com/upbound/provider-aws/apis/kms/v1beta1.Key",
Extractor: common.PathARNExtractor,
}
})
p.AddResourceConfigurator("aws_glue_job", func(r *config.Resource) {
r.LateInitializer = config.LateInitializer{
//
IgnoredFields: []string{
"max_capacity", "number_of_workers", "worker_type",
},
}
})
p.AddResourceConfigurator("aws_glue_security_configuration", func(r *config.Resource) {
r.References["encryption_configuration.cloudwatch_encryption.kms_key_arn"] = config.Reference{
Type: "github.com/upbound/provider-aws/apis/kms/v1beta1.Key",
Extractor: common.PathARNExtractor,
}
r.References["encryption_configuration.job_bookmarks_encryption.kms_key_arn"] = config.Reference{
Type: "github.com/upbound/provider-aws/apis/kms/v1beta1.Key",
Extractor: common.PathARNExtractor,
}
r.References["encryption_configuration.s3_encryption.kms_key_arn"] = config.Reference{
Type: "github.com/upbound/provider-aws/apis/kms/v1beta1.Key",
Extractor: common.PathARNExtractor,
}
})
}