-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Make App Engine applications updatable #1621
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d0a6b2b
Make App Engine applications updatable.
paddycarver 9ebeeda
Fix forcenew for location_id.
paddycarver 6d040db
Really fix location_id force new.
paddycarver 16ab5bb
Reorder fields.
paddycarver 4999637
Remove unnecessary CustomizeDiff function.
paddycarver 6910d82
SetPartial on app_engine.
paddycarver 4176a98
terraform fmt all configs in project_test.
paddycarver 8296c16
Remove extraneous Exists checks in App Engine tests.
paddycarver File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -199,7 +199,6 @@ func TestAccProject_appEngineBasic(t *testing.T) { | |
{ | ||
Config: testAccProject_appEngineBasic(pid, org), | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckGoogleProjectExists("google_project.acceptance", pid), | ||
resource.TestCheckResourceAttrSet("google_project.acceptance", "app_engine.0.name"), | ||
resource.TestCheckResourceAttrSet("google_project.acceptance", "app_engine.0.url_dispatch_rule.#"), | ||
resource.TestCheckResourceAttrSet("google_project.acceptance", "app_engine.0.code_bucket"), | ||
|
@@ -216,7 +215,7 @@ func TestAccProject_appEngineBasic(t *testing.T) { | |
}) | ||
} | ||
|
||
func TestAccProject_appEngineFeatureSettings(t *testing.T) { | ||
func TestAccProject_appEngineUpdate(t *testing.T) { | ||
t.Parallel() | ||
|
||
org := getTestOrgFromEnv(t) | ||
|
@@ -226,11 +225,58 @@ func TestAccProject_appEngineFeatureSettings(t *testing.T) { | |
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccProject_appEngineFeatureSettings(pid, org), | ||
Config: testAccProject_appEngineNoApp(pid, org), | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckGoogleProjectExists("google_project.acceptance", pid), | ||
), | ||
}, | ||
{ | ||
Config: testAccProject_appEngineBasic(pid, org), | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttrSet("google_project.acceptance", "app_engine.0.name"), | ||
resource.TestCheckResourceAttrSet("google_project.acceptance", "app_engine.0.url_dispatch_rule.#"), | ||
resource.TestCheckResourceAttrSet("google_project.acceptance", "app_engine.0.code_bucket"), | ||
resource.TestCheckResourceAttrSet("google_project.acceptance", "app_engine.0.default_hostname"), | ||
resource.TestCheckResourceAttrSet("google_project.acceptance", "app_engine.0.default_bucket"), | ||
), | ||
}, | ||
resource.TestStep{ | ||
ResourceName: "google_project.acceptance", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
{ | ||
Config: testAccProject_appEngineUpdate(pid, org), | ||
}, | ||
resource.TestStep{ | ||
ResourceName: "google_project.acceptance", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func TestAccProject_appEngineFeatureSettings(t *testing.T) { | ||
t.Parallel() | ||
|
||
org := getTestOrgFromEnv(t) | ||
pid := acctest.RandomWithPrefix("tf-test") | ||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccProject_appEngineFeatureSettings(pid, org), | ||
}, | ||
resource.TestStep{ | ||
ResourceName: "google_project.acceptance", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
{ | ||
Config: testAccProject_appEngineFeatureSettingsUpdate(pid, org), | ||
}, | ||
resource.TestStep{ | ||
ResourceName: "google_project.acceptance", | ||
ImportState: true, | ||
|
@@ -360,8 +406,8 @@ func testAccProject_labels(pid, name, org string, labels map[string]string) stri | |
r := fmt.Sprintf(` | ||
resource "google_project" "acceptance" { | ||
project_id = "%s" | ||
name = "%s" | ||
org_id = "%s" | ||
name = "%s" | ||
org_id = "%s" | ||
labels {`, pid, name, org) | ||
|
||
l := "" | ||
|
@@ -376,11 +422,11 @@ resource "google_project" "acceptance" { | |
func testAccProject_deleteDefaultNetwork(pid, name, org, billing string) string { | ||
return fmt.Sprintf(` | ||
resource "google_project" "acceptance" { | ||
project_id = "%s" | ||
name = "%s" | ||
org_id = "%s" | ||
billing_account = "%s" # requires billing to enable compute API | ||
auto_create_network = false | ||
project_id = "%s" | ||
name = "%s" | ||
org_id = "%s" | ||
billing_account = "%s" # requires billing to enable compute API | ||
auto_create_network = false | ||
}`, pid, name, org, billing) | ||
} | ||
|
||
|
@@ -402,37 +448,79 @@ resource "google_folder" "folder1" { | |
`, pid, projectName, folderName, org) | ||
} | ||
|
||
func testAccProject_appEngineNoApp(pid, org string) string { | ||
return fmt.Sprintf(` | ||
resource "google_project" "acceptance" { | ||
project_id = "%s" | ||
name = "%s" | ||
org_id = "%s" | ||
}`, pid, pid, org) | ||
} | ||
|
||
func testAccProject_appEngineBasic(pid, org string) string { | ||
return fmt.Sprintf(` | ||
resource "google_project" "acceptance" { | ||
project_id = "%s" | ||
name = "%s" | ||
org_id = "%s" | ||
name = "%s" | ||
org_id = "%s" | ||
|
||
app_engine { | ||
auth_domain = "hashicorptest.com" | ||
location_id = "us-central" | ||
auth_domain = "hashicorptest.com" | ||
location_id = "us-central" | ||
serving_status = "SERVING" | ||
} | ||
}`, pid, pid, org) | ||
} | ||
|
||
func testAccProject_appEngineUpdate(pid, org string) string { | ||
return fmt.Sprintf(` | ||
resource "google_project" "acceptance" { | ||
project_id = "%s" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: can you align the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
name = "%s" | ||
org_id = "%s" | ||
|
||
app_engine { | ||
auth_domain = "tf-test.club" | ||
location_id = "us-central" | ||
serving_status = "USER_DISABLED" | ||
} | ||
}`, pid, pid, org) | ||
} | ||
|
||
func testAccProject_appEngineFeatureSettings(pid, org string) string { | ||
return fmt.Sprintf(` | ||
resource "google_project" "acceptance" { | ||
project_id = "%s" | ||
name = "%s" | ||
org_id = "%s" | ||
name = "%s" | ||
org_id = "%s" | ||
|
||
app_engine { | ||
location_id = "us-central" | ||
|
||
feature_settings { | ||
"split_health_checks" = true | ||
} | ||
} | ||
}`, pid, pid, org) | ||
} | ||
|
||
func testAccProject_appEngineFeatureSettingsUpdate(pid, org string) string { | ||
return fmt.Sprintf(` | ||
resource "google_project" "acceptance" { | ||
project_id = "%s" | ||
name = "%s" | ||
org_id = "%s" | ||
|
||
app_engine { | ||
location_id = "us-central" | ||
|
||
feature_settings { | ||
"split_health_checks" = false | ||
} | ||
} | ||
}`, pid, pid, org) | ||
} | ||
|
||
func skipIfEnvNotSet(t *testing.T, envs ...string) { | ||
for _, k := range envs { | ||
if os.Getenv(k) == "" { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
this is pretty much identical to
testAccProject_create
(which lives inresource_google_project_iam_policy_test.go
) if you wanted to reuse that (a few other resources are doing so)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 have a weakly-held opinion that it's better to have the configs for semantically different things separated, even if the implementation ends up looking the same, to minimize unintended consequences of changes. But if you feel strongly about it, I'm happy to change this.
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.
Cool that's fine!