in providers/github/repositories.go [152:191]
func (g *RepositoriesGenerator) PostConvertHook() error {
for _, repo := range g.Resources {
if repo.InstanceInfo.Type != "github_repository" {
continue
}
for i, member := range g.Resources {
if member.InstanceInfo.Type != "github_repository_webhook" {
continue
}
if member.InstanceState.Attributes["repository"] == repo.InstanceState.Attributes["name"] {
g.Resources[i].Item["repository"] = "${github_repository." + repo.ResourceName + ".name}"
}
}
for i, branch := range g.Resources {
if branch.InstanceInfo.Type != "github_branch_protection" {
continue
}
if branch.InstanceState.Attributes["repository"] == repo.InstanceState.Attributes["name"] {
g.Resources[i].Item["repository"] = "${github_repository." + repo.ResourceName + ".name}"
}
}
for i, collaborator := range g.Resources {
if collaborator.InstanceInfo.Type != "github_repository_collaborator" {
continue
}
if collaborator.InstanceState.Attributes["repository"] == repo.InstanceState.Attributes["name"] {
g.Resources[i].Item["repository"] = "${github_repository." + repo.ResourceName + ".name}"
}
}
for i, key := range g.Resources {
if key.InstanceInfo.Type != "github_repository_deploy_key" {
continue
}
if key.InstanceState.Attributes["repository"] == repo.InstanceState.Attributes["name"] {
g.Resources[i].Item["repository"] = "${github_repository." + repo.ResourceName + ".name}"
}
}
}
return nil
}