Skip to content
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

Update Google AppEngine to v1 #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
"golang.org/x/oauth2/jwt"
"google.golang.org/api/appengine/v1beta4"
"google.golang.org/api/appengine/v1"
"google.golang.org/api/storage/v1"
)

Expand All @@ -25,7 +25,7 @@ type Config struct {
Region string

clientStorage *storage.Service
clientAppengine *appengine.Service
clientAppengine *appengine.APIService
}

func (c *Config) loadAndValidate() error {
Expand Down
10 changes: 5 additions & 5 deletions resource_appengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"
"strconv"
"github.com/hashicorp/terraform/helper/schema"
"google.golang.org/api/appengine/v1beta4"
"google.golang.org/api/appengine/v1"
"google.golang.org/api/storage/v1"
)

Expand Down Expand Up @@ -323,7 +323,7 @@ func resourceAppengineCreate(d *schema.ResourceData, meta interface{}) error {
}

// create the application
moduleVersionService := appengine.NewAppsModulesVersionsService(config.clientAppengine)
moduleVersionService := appengine.NewAppsServicesVersionsService(config.clientAppengine)
createCall := moduleVersionService.Create(config.Project, d.Get("moduleName").(string), version)
operation, err := createCall.Do()
if err != nil {
Expand Down Expand Up @@ -369,7 +369,7 @@ func operationWait(operation *appengine.Operation, config *Config) (error) {
func resourceAppengineRead(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)

moduleVersionService := appengine.NewAppsModulesVersionsService(config.clientAppengine)
moduleVersionService := appengine.NewAppsServicesVersionsService(config.clientAppengine)
getCall := moduleVersionService.Get(config.Project, d.Get("moduleName").(string), d.Get("version").(string))
version, err := getCall.Do()
if err != nil {
Expand All @@ -384,12 +384,12 @@ func resourceAppengineRead(d *schema.ResourceData, meta interface{}) error {
func resourceAppengineDelete(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)

moduleVersionService := appengine.NewAppsModulesVersionsService(config.clientAppengine)
moduleVersionService := appengine.NewAppsServicesVersionsService(config.clientAppengine)
deleteCall := moduleVersionService.Delete(config.Project, d.Get("moduleName").(string), d.Get("version").(string))
operation, err := deleteCall.Do()
if err != nil {
if strings.Contains(err.Error(), "Cannot delete the final version of a service (module)") {
moduleService := appengine.NewAppsModulesService(config.clientAppengine)
moduleService := appengine.NewAppsServicesService(config.clientAppengine)
moduleDelete := moduleService.Delete(config.Project, d.Get("moduleName").(string))
operation, err = moduleDelete.Do()
if err != nil {
Expand Down