-
Notifications
You must be signed in to change notification settings - Fork 765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New resource github_repository_autolink_reference
#924
Conversation
} | ||
|
||
resource "github_repository_autolink_reference" "autolink" { | ||
depends_on = ["github_repository.off"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be
depends_on = ["github_repository.off"] | |
depends_on = ["github_repository.oof"] |
everywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, true. Good catch, has been updated with the latest commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was about to start to implement this, then found your PR, so I thought I'd help with some code review... Hopefully the maintainers will bless it soon.
Importer: &schema.ResourceImporter{ | ||
State: func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { | ||
parts := strings.Split(d.Id(), "/") | ||
if len(parts) != 2 { | ||
return nil, fmt.Errorf("Invalid ID specified. Supplied ID must be written as <repository>/<autolink_reference_id>") | ||
} | ||
d.Set("repository", parts[0]) | ||
d.SetId(parts[1]) | ||
return []*schema.ResourceData{d}, nil | ||
}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we allow to import by <repository>/<key-prefix>
instead / as well? That's gonna make it much easier to import... Now the API must be called to get the id while everyone will have the key-prefix probably
* Add resource github_repository_autolink_reference * Add resource to provider main file * Use correct resource name, thanks to @mrwacky42
This PR adds a new resource
github_repository_autolink_reference
. Supports creation and deletion, in-place updates are not possible for autolink references afaik.This is my first time working on a Terraform provider, so sorry if I missed something :)
Fixes #285
Example usage: