-
Notifications
You must be signed in to change notification settings - Fork 123
/
config.go
62 lines (57 loc) · 2.03 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
/*
Copyright 2022 Upbound Inc.
*/
package acmpca
import (
"github.com/crossplane/upjet/pkg/config"
)
// Configure adds configurations for the acmpca group.
func Configure(p *config.Provider) {
p.AddResourceConfigurator("aws_acmpca_certificate_authority", func(r *config.Resource) {
// NOTE(muvaf): It causes circular dependency. See https://github.com/crossplane/crossplane-runtime/issues/313
delete(r.References, "revocation_configuration.crl_configuration.s3_bucket_name")
r.LateInitializer = config.LateInitializer{
IgnoredFields: []string{"revocation_configuration"},
}
r.Sensitive.AdditionalConnectionDetailsFn = func(attr map[string]interface{}) (map[string][]byte, error) {
conn := map[string][]byte{}
if a, ok := attr["certificate"].(string); ok {
conn["certificate"] = []byte(a)
}
if a, ok := attr["certificate_chain"].(string); ok {
conn["certificate_chain"] = []byte(a)
}
if a, ok := attr["certificate_signing_request"].(string); ok {
conn["certificate_signing_request"] = []byte(a)
}
return conn, nil
}
})
p.AddResourceConfigurator("aws_acmpca_certificate", func(r *config.Resource) {
r.TerraformResource.Schema["certificate_signing_request"].Sensitive = true
r.References = map[string]config.Reference{
"certificate_authority_arn": {
Type: "CertificateAuthority",
},
}
r.Sensitive.AdditionalConnectionDetailsFn = func(attr map[string]interface{}) (map[string][]byte, error) {
conn := map[string][]byte{}
if a, ok := attr["certificate"].(string); ok {
conn["certificate"] = []byte(a)
}
if a, ok := attr["certificate_chain"].(string); ok {
conn["certificate_chain"] = []byte(a)
}
return conn, nil
}
})
p.AddResourceConfigurator("aws_acmpca_certificate_authority_certificate", func(r *config.Resource) {
r.TerraformResource.Schema["certificate"].Sensitive = true
r.TerraformResource.Schema["certificate_chain"].Sensitive = true
r.References = map[string]config.Reference{
"certificate_authority_arn": {
Type: "CertificateAuthority",
},
}
})
}