-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Created game server rollout data source * Update data_google_game_services_game_server_deployment_rollout_test.go.erb Replace the custom check * Update provider.go.erb fix the indentation * Update game_services_game_server_deployment_rollout.html.markdown Misc updates * Update data_google_game_services_game_server_deployment_rollout_test.go.erb Update the test * Update data_google_game_services_game_server_deployment_rollout_test.go.erb Fix a typo Co-authored-by: Edward Sun <sunedward@google.com> Signed-off-by: Modular Magician <magic-modules@google.com> Co-authored-by: Edward Sun <sunedward@google.com>
- Loading branch information
1 parent
5d53c39
commit ea82976
Showing
6 changed files
with
254 additions
and
69 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,3 @@ | ||
```release-note:new-datasource | ||
google_game_services_game_server_deployment_rollout (beta only) | ||
``` |
31 changes: 31 additions & 0 deletions
31
google-beta/data_google_game_services_game_server_deployment_rollout.go
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,31 @@ | ||
package google | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema" | ||
) | ||
|
||
func dataSourceGameServicesGameServerDeploymentRollout() *schema.Resource { | ||
|
||
dsSchema := datasourceSchemaFromResourceSchema(resourceGameServicesGameServerDeploymentRollout().Schema) | ||
addRequiredFieldsToSchema(dsSchema, "deployment_id") | ||
|
||
return &schema.Resource{ | ||
Read: dataSourceGameServicesGameServerDeploymentRolloutRead, | ||
Schema: dsSchema, | ||
} | ||
} | ||
|
||
func dataSourceGameServicesGameServerDeploymentRolloutRead(d *schema.ResourceData, meta interface{}) error { | ||
config := meta.(*Config) | ||
|
||
id, err := replaceVars(d, config, "projects/{{project}}/locations/global/gameServerDeployments/{{deployment_id}}/rollout") | ||
if err != nil { | ||
return fmt.Errorf("Error constructing id: %s", err) | ||
} | ||
d.SetId(id) | ||
|
||
return resourceGameServicesGameServerDeploymentRolloutRead(d, meta) | ||
|
||
} |
68 changes: 68 additions & 0 deletions
68
google-beta/data_google_game_services_game_server_deployment_rollout_test.go
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,68 @@ | ||
package google | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/helper/resource" | ||
) | ||
|
||
func TestAccDataSourceGameServicesGameServerDeploymentRollout_basic(t *testing.T) { | ||
t.Parallel() | ||
|
||
context := map[string]interface{}{ | ||
"random_suffix": randString(t, 10), | ||
} | ||
|
||
vcrTest(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProvidersOiCS, | ||
CheckDestroy: testAccCheckGameServicesGameServerDeploymentRolloutDestroyProducer(t), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccDataSourceGameServicesGameServerDeploymentRollout_basic(context), | ||
Check: resource.ComposeTestCheckFunc( | ||
checkDataSourceStateMatchesResourceState("data.google_game_services_game_server_deployment_rollout.qa", "google_game_services_game_server_deployment_rollout.foo"), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccDataSourceGameServicesGameServerDeploymentRollout_basic(context map[string]interface{}) string { | ||
return Nprintf(` | ||
resource "google_game_services_game_server_deployment" "default" { | ||
provider = google-beta | ||
deployment_id = "tf-test-deployment-%{random_suffix}" | ||
description = "a deployment description" | ||
} | ||
resource "google_game_services_game_server_config" "default" { | ||
provider = google-beta | ||
config_id = "tf-test-config-%{random_suffix}" | ||
deployment_id = google_game_services_game_server_deployment.default.deployment_id | ||
description = "a config description" | ||
fleet_configs { | ||
name = "some-non-guid" | ||
fleet_spec = jsonencode({ "replicas" : 1, "scheduling" : "Packed", "template" : { "metadata" : { "name" : "tf-test-game-server-template" }, "spec" : { "template" : { "spec" : { "containers" : [{ "name" : "simple-udp-server", "image" : "gcr.io/agones-images/udp-server:0.14" }] } } } } }) | ||
// Alternate usage: | ||
// fleet_spec = file(fleet_configs.json) | ||
} | ||
} | ||
resource "google_game_services_game_server_deployment_rollout" "foo" { | ||
provider = google-beta | ||
deployment_id = google_game_services_game_server_deployment.default.deployment_id | ||
default_game_server_config = google_game_services_game_server_config.default.name | ||
} | ||
data "google_game_services_game_server_deployment_rollout" "qa" { | ||
provider = google-beta | ||
deployment_id = google_game_services_game_server_deployment_rollout.foo.deployment_id | ||
} | ||
`, context) | ||
} |
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
72 changes: 72 additions & 0 deletions
72
website/docs/d/game_services_game_server_deployment_rollout.html.markdown
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,72 @@ | ||
--- | ||
subcategory: "Game Servers" | ||
layout: "google" | ||
page_title: "Google: google_game_services_game_server_deployment_rollout" | ||
sidebar_current: "docs-google-datasource-game-services-game-server-deployment-rollout" | ||
description: |- | ||
Get the rollout state. | ||
--- | ||
|
||
# google\_game\_services\_game\_server\_deployment\_rollout | ||
|
||
Use this data source to get the rollout state. | ||
|
||
https://cloud.google.com/game-servers/docs/reference/rest/v1beta/GameServerDeploymentRollout | ||
|
||
## Example Usage | ||
|
||
|
||
```hcl | ||
data "google_game_services_game_server_deployment_rollout" "qa" { | ||
provider = google-beta | ||
deployment_id = "tf-test-deployment-s8sn12jt2c" | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
|
||
* `deployment_id` - (Required) | ||
The deployment to get the rollout state from. Only 1 rollout must be associated with each deployment. | ||
|
||
|
||
## Attributes Reference | ||
|
||
In addition to the arguments listed above, the following attributes are exported: | ||
|
||
* `default_game_server_config` - | ||
This field points to the game server config that is | ||
applied by default to all realms and clusters. For example, | ||
`projects/my-project/locations/global/gameServerDeployments/my-game/configs/my-config`. | ||
|
||
|
||
* `game_server_config_overrides` - | ||
The game_server_config_overrides contains the per game server config | ||
overrides. The overrides are processed in the order they are listed. As | ||
soon as a match is found for a cluster, the rest of the list is not | ||
processed. Structure is documented below. | ||
|
||
* `project` - The ID of the project in which the resource belongs. | ||
If it is not provided, the provider project is used. | ||
|
||
|
||
The `game_server_config_overrides` block contains: | ||
|
||
* `realms_selector` - | ||
Selection by realms. Structure is documented below. | ||
|
||
* `config_version` - | ||
Version of the configuration. | ||
|
||
The `realms_selector` block contains: | ||
|
||
* `realms` - | ||
List of realms to match against. | ||
|
||
* `id` - an identifier for the resource with format `projects/{{project}}/locations/global/gameServerDeployments/{{deployment_id}}/rollout` | ||
|
||
* `name` - | ||
The resource id of the game server deployment | ||
eg: `projects/my-project/locations/global/gameServerDeployments/my-deployment/rollout`. |
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