-
Notifications
You must be signed in to change notification settings - Fork 72
/
config.go
31 lines (28 loc) · 1.22 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
package cloudiot
import (
"github.com/crossplane/upjet/pkg/config"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
// Configure configures individual resources by adding custom
// ResourceConfigurators.
func Configure(p *config.Provider) {
p.AddResourceConfigurator("google_cloudiot_device", func(r *config.Resource) {
// Note(turkenh): We have to modify schema of
// "last_error_status.details", since it is a map where elements
// configured as nil, but needs to be String:
r.TerraformResource.
Schema["last_error_status"].Elem.(*schema.Resource).
Schema["details"].Elem = schema.TypeString
})
p.AddResourceConfigurator("google_cloudiot_registry", func(r *config.Resource) {
// Note(turkenh): We have to modify schema of
// "credentials.public_key_certificate", since it is a map where elements
// configured as nil, but needs to be String:
r.TerraformResource.
Schema["credentials"].Elem.(*schema.Resource).
Schema["public_key_certificate"].Elem = schema.TypeString
r.TerraformResource.Schema["http_config"].Elem = schema.TypeString
r.TerraformResource.Schema["mqtt_config"].Elem = schema.TypeString
r.TerraformResource.Schema["state_notification_config"].Elem = schema.TypeString
})
}