-
Notifications
You must be signed in to change notification settings - Fork 123
/
config.go
48 lines (41 loc) · 1.63 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
// SPDX-FileCopyrightText: 2024 The Crossplane Authors <https://crossplane.io>
//
// SPDX-License-Identifier: CC0-1.0
package sqs
import (
"github.com/crossplane/upjet/pkg/config"
"github.com/upbound/provider-aws/config/common"
)
// Configure adds configurations for the sqs group.
func Configure(p *config.Provider) {
p.AddResourceConfigurator("aws_sqs_queue_policy", func(r *config.Resource) {
r.References["queue_url"] = config.Reference{
Type: "github.com/upbound/provider-aws/apis/sqs/v1beta1.Queue",
Extractor: common.PathTerraformIDExtractor,
}
})
p.AddResourceConfigurator("aws_sqs_queue", func(r *config.Resource) {
r.Sensitive.AdditionalConnectionDetailsFn = func(attr map[string]any) (map[string][]byte, error) {
conn := map[string][]byte{}
if a, ok := attr["url"].(string); ok {
conn["url"] = []byte(a)
}
return conn, nil
}
// If the key policy is unset on the Queue resource, don't late initialize it, to avoid conflicts with the policy
// managed by a QueuePolicy resource.
r.LateInitializer.IgnoredFields = append(r.LateInitializer.IgnoredFields, "name_prefix", "policy")
})
p.AddResourceConfigurator("aws_sqs_queue_redrive_policy", func(r *config.Resource) {
r.References["queue_url"] = config.Reference{
Type: "github.com/upbound/provider-aws/apis/sqs/v1beta1.Queue",
Extractor: common.PathTerraformIDExtractor,
}
})
p.AddResourceConfigurator("aws_sqs_queue_redrive_allow_policy", func(r *config.Resource) {
r.References["queue_url"] = config.Reference{
Type: "github.com/upbound/provider-aws/apis/sqs/v1beta1.Queue",
Extractor: common.PathTerraformIDExtractor,
}
})
}