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 == 3 isOrgToken := partCount == 4 isProjectToken := partCount == 5 if isAccountToken { d.SetId(parts[1]) d.Set("parent_id", parts[0]) d.Set("identifier", parts[1]) d.Set("apikey_type", parts[2]) return []*schema.ResourceData{d}, nil } if isOrgToken { d.SetId(parts[2]) d.Set("org_id", parts[0]) d.Set("parent_id", parts[1]) d.Set("identifier", parts[2]) d.Set("apikey_type", parts[3]) return []*schema.ResourceData{d}, nil } if isProjectToken { d.SetId(parts[3]) d.Set("org_id", parts[0]) d.Set("project_id", parts[1]) d.Set("parent_id", parts[2]) d.Set("identifier", parts[3]) d.Set("apikey_type", parts[4]) return []*schema.ResourceData{d}, nil } return nil, fmt.Errorf("invalid identifier: %s", d.Id()) }, }
Functions ¶
func DataSourceApiKey ¶
func ResourceApiKey ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.