We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c3b8a3d commit 9abb9b8Copy full SHA for 9abb9b8
icinga2/resource_icinga2_host.go
@@ -11,10 +11,13 @@ import (
11
func resourceIcinga2Host() *schema.Resource {
12
13
return &schema.Resource{
14
- Create: resourceIcinga2HostCreate,
15
- Exists: resourceIcinga2HostExists,
16
- Read: resourceIcinga2HostRead,
17
- Delete: resourceIcinga2HostDelete,
+ Create: resourceIcinga2HostCreate,
+ Exists: resourceIcinga2HostExists,
+ Read: resourceIcinga2HostRead,
+ Delete: resourceIcinga2HostDelete,
18
+ Importer: &schema.ResourceImporter{
19
+ State: resourceIcinga2HostImport,
20
+ },
21
Schema: map[string]*schema.Schema{
22
"hostname": {
23
Type: schema.TypeString,
@@ -172,3 +175,10 @@ func resourceIcinga2HostDelete(d *schema.ResourceData, meta interface{}) error {
172
175
return nil
173
176
174
177
}
178
+
179
+func resourceIcinga2HostImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
180
+ d.Set("hostname", d.Id())
181
+ err := resourceIcinga2HostRead(d, meta)
182
183
+ return []*schema.ResourceData{d}, err
184
+}
0 commit comments