-
Notifications
You must be signed in to change notification settings - Fork 123
/
config.go
87 lines (75 loc) · 3.2 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
87
/*
Copyright 2021 Upbound Inc.
*/
package s3
import (
"github.com/upbound/upjet/pkg/config"
"github.com/upbound/upjet/pkg/registry"
)
// Configure adds configurations for s3 group.
func Configure(p *config.Provider) {
p.AddResourceConfigurator("aws_s3_bucket", func(r *config.Resource) {
// Mutually exclusive with:
// aws_s3_bucket_accelerate_configuration
// aws_s3_bucket_acl
// aws_s3_bucket_cors_configuration
// aws_s3_bucket_lifecycle_configuration
// aws_s3_bucket_logging
// aws_s3_bucket_object_lock_configuration
// aws_s3_bucket_policy
// aws_s3_bucket_replication_configuration
// aws_s3_bucket_request_payment_configuration
// aws_s3_bucket_server_side_encryption_configuration
// aws_s3_bucket_versioning
// aws_s3_bucket_website_configuration
config.MoveToStatus(r.TerraformResource, "acceleration_status", "acl", "grant", "cors_rule", "lifecycle_rule",
"logging", "object_lock_configuration", "policy", "replication_configuration", "request_payer",
"server_side_encryption_configuration", "versioning", "website", "arn")
r.MetaResource.ExternalName = registry.RandRFC1123Subdomain
})
p.AddResourceConfigurator("aws_s3_bucket_acl", func(r *config.Resource) {
r.LateInitializer = config.LateInitializer{
IgnoredFields: []string{"acl", "access_control_policy"},
}
})
p.AddResourceConfigurator("aws_s3_bucket_metrics", func(r *config.Resource) {
r.UseAsync = true
})
p.AddResourceConfigurator("aws_s3_bucket_website_configuration", func(r *config.Resource) {
r.LateInitializer = config.LateInitializer{
IgnoredFields: []string{"routing_rules", "routing_rule"},
}
})
p.AddResourceConfigurator("aws_s3_object", func(r *config.Resource) {
r.LateInitializer = config.LateInitializer{
IgnoredFields: []string{"etag", "kms_key_id"},
}
})
p.AddResourceConfigurator("aws_s3_object_copy", func(r *config.Resource) {
r.LateInitializer = config.LateInitializer{
IgnoredFields: []string{"acl", "grant"},
}
})
p.AddResourceConfigurator("aws_s3_bucket_notification", func(r *config.Resource) {
// NOTE(muvaf): It causes circular dependency. See https://github.com/crossplane/crossplane-runtime/issues/313
delete(r.References, "lambda_function.lambda_function_arn")
})
p.AddResourceConfigurator("aws_s3_bucket_analytics_configuration", func(r *config.Resource) {
r.References["storage_class_analysis.data_export.destination.s3_bucket_destination.bucket_arn"] = config.Reference{
Type: "github.com/upbound/provider-aws/apis/s3/v1beta1.Bucket",
Extractor: `github.com/upbound/upjet/pkg/resource.ExtractParamPath("arn",true)`,
}
})
p.AddResourceConfigurator("aws_s3_bucket_replication_configuration", func(r *config.Resource) {
r.References["rule.destination.bucket"] = config.Reference{
Type: "github.com/upbound/provider-aws/apis/s3/v1beta1.Bucket",
Extractor: `github.com/upbound/upjet/pkg/resource.ExtractParamPath("arn",true)`,
}
})
p.AddResourceConfigurator("aws_s3_bucket_inventory", func(r *config.Resource) {
r.References["destination.bucket.bucket_arn"] = config.Reference{
Type: "github.com/upbound/provider-aws/apis/s3/v1beta1.Bucket",
Extractor: `github.com/upbound/upjet/pkg/resource.ExtractParamPath("arn",true)`,
}
})
}