Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var MultiLevelResourceImporter = &schema.ResourceImporter{ State: func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { parts := strings.Split(d.Id(), "/") partCount := len(parts) isAccountToken := partCount == 4 isOrgToken := partCount == 5 isProjectToken := partCount == 6 if isAccountToken { d.SetId(parts[3]) d.Set("parent_id", parts[0]) d.Set("apikey_id", parts[1]) d.Set("apikey_type", parts[2]) d.Set("identifier", parts[3]) return []*schema.ResourceData{d}, nil } if isOrgToken { d.SetId(parts[4]) d.Set("org_id", parts[0]) d.Set("parent_id", parts[1]) d.Set("apikey_id", parts[2]) d.Set("apikey_type", parts[3]) d.Set("identifier", parts[4]) return []*schema.ResourceData{d}, nil } if isProjectToken { d.SetId(parts[5]) d.Set("project_id", parts[1]) d.Set("org_id", parts[0]) d.Set("parent_id", parts[2]) d.Set("apikey_id", parts[3]) d.Set("apikey_type", parts[4]) d.Set("identifier", parts[5]) return []*schema.ResourceData{d}, nil } return nil, fmt.Errorf("invalid identifier: %s", d.Id()) }, }
Functions ¶
func DataSourceToken ¶
func ResourceToken ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.