forked from cvbarros/terraform-provider-teamcity
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fix-dependency-imports' into yext
- Loading branch information
Showing
6 changed files
with
58 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package teamcity | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/hashicorp/terraform/helper/schema" | ||
) | ||
|
||
|
||
func subresourceImporter(readFunc schema.ReadFunc) schema.StateFunc { | ||
return func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { | ||
var buildConfigID, resourceID string | ||
|
||
if n, err := fmt.Sscanf(d.Id(), "%s %s", &buildConfigID, &resourceID); err != nil { | ||
return nil, fmt.Errorf("invalid import ID '%s' - %v", d.Id(), err) | ||
} else if n != 2 { | ||
return nil, fmt.Errorf("invalid import ID '%s' - Unrecognized format", d.Id()) | ||
} | ||
|
||
d.SetId(resourceID) | ||
|
||
if err := d.Set("build_config_id", buildConfigID); err != nil { | ||
return nil, err | ||
} | ||
|
||
if err := readFunc(d, meta); err != nil { | ||
return nil, err | ||
} | ||
|
||
return []*schema.ResourceData{d}, nil | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters