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

Support all valid operating systems in aws_gamelift_build #17764

Merged
merged 3 commits into from
Feb 25, 2021

Conversation

judgeaxl
Copy link
Contributor

@judgeaxl judgeaxl commented Feb 23, 2021

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Closes #17763
Relates #14601

@judgeaxl judgeaxl requested a review from a team as a code owner February 23, 2021 14:04
@ghost ghost added size/XS Managed by automation to categorize the size of a PR. service/gamelift Issues and PRs that pertain to the gamelift service. labels Feb 23, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Feb 23, 2021
- Switched to use SDK provided values slice, as suggested in hashicorp#14601
- Direct effect is that it adds support for AMAZON_LINUX_2 as a valid
  operating system for builds
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome @judgeaxl 👋

It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTING guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.

Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.

Thanks again, and welcome to the community! 😃

@judgeaxl judgeaxl changed the title Support all valid platforms in aws_gamelift_build Support all valid operating systems in aws_gamelift_build Feb 23, 2021
@judgeaxl
Copy link
Contributor Author

I couldn't come up with any meaningful tests to add to this, since there are no other parameters that are affected when you pick a different OS. I couldn't find any examples of tests of this type of validation in other providers either.

@ghost ghost added the documentation Introduces or discusses updates to documentation. label Feb 25, 2021
@anGie44 anGie44 added enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels Feb 25, 2021
Copy link
Contributor

@anGie44 anGie44 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this PR @judgeaxl , looks great 🚀

With regard to adding a test, i think for this type of enhancement we can generally get away with not testing each particular value, especially if there are quite a few. The tests for this resource are a bit different in the configuration that takes place outside of the explicit test steps but in any case we could technically still write a test like the following to substitute in values and ensure each update forces new resource and applies the change e.g.

func TestAccAWSGameliftBuild_OperatingSystem(t *testing.T) {
	var build1, build2, build3 gamelift.Build

	rString := acctest.RandString(8)
	resourceName := "aws_gamelift_build.test"

	buildName := fmt.Sprintf("%s_%s", testAccGameliftBuildPrefix, rString)

	region := testAccGetRegion()
	g, err := testAccAWSGameliftSampleGame(region)

	if isResourceNotFoundError(err) {
		t.Skip(err)
	}

	if err != nil {
		t.Fatal(err)
	}

	loc := g.Location
	bucketName := *loc.Bucket
	roleArn := *loc.RoleArn
	key := *loc.Key

	resource.ParallelTest(t, resource.TestCase{
		PreCheck: func() {
			testAccPreCheck(t)
			testAccPartitionHasServicePreCheck(gamelift.EndpointsID, t)
			testAccPreCheckAWSGamelift(t)
		},
		Providers:    testAccProviders,
		CheckDestroy: testAccCheckAWSGameliftBuildDestroy,
		Steps: []resource.TestStep{
			{
				Config: testAccAWSGameliftBuildConfig_operatingSystem(buildName, bucketName, key, roleArn, gamelift.OperatingSystemWindows2012),
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAWSGameliftBuildExists(resourceName, &build1),
					resource.TestCheckResourceAttr(resourceName, "operating_system", gamelift.OperatingSystemWindows2012),
				),
			},
			{
				Config: testAccAWSGameliftBuildConfig_operatingSystem(buildName, bucketName, key, roleArn, gamelift.OperatingSystemAmazonLinux),
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAWSGameliftBuildExists(resourceName, &build2),
					testAccCheckAWSGameliftBuildRecreated(&build2, &build3),
					resource.TestCheckResourceAttr(resourceName, "operating_system", gamelift.OperatingSystemAmazonLinux),
				),
			},
			{
				Config: testAccAWSGameliftBuildConfig_operatingSystem(buildName, bucketName, key, roleArn, gamelift.OperatingSystemAmazonLinux2),
				Check: resource.ComposeTestCheckFunc(
					testAccCheckAWSGameliftBuildExists(resourceName, &build3),
					testAccCheckAWSGameliftBuildRecreated(&build2, &build3),
					resource.TestCheckResourceAttr(resourceName, "operating_system", gamelift.OperatingSystemAmazonLinux2),
				),
			},
		},
	})
}

@anGie44 anGie44 added this to the v3.30.0 milestone Feb 25, 2021
@anGie44 anGie44 merged commit 3804858 into hashicorp:main Feb 25, 2021
@ghost
Copy link

ghost commented Feb 26, 2021

This has been released in version 3.30.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Mar 27, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Mar 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. service/gamelift Issues and PRs that pertain to the gamelift service. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for AMAZON_LINUX_2 in the aws_gamelift_build resource
2 participants