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

r/aws_apprunner_service: Support for runtime_environment_secrets #28871

Merged

Conversation

niallthomson
Copy link
Contributor

Description

AWS App Runner now supports retrieving secrets and configuration data stored in AWS Secrets Manager and AWS Systems Manager Parameter Store in an App Runner service as runtime environment variables.

This PR introduces a runtime_environment_secrets parameter to aws_apprunner_service which takes a map of strings.

Example:

resource "aws_ssm_parameter" "test" {
  name  = "test"
  type  = "String"
  value = "test"
}

resource "aws_apprunner_service" "test" {
  service_name = "test"
  source_configuration {
    auto_deployments_enabled = false
    image_repository {
      image_configuration {
        port = "80"
        runtime_environment_secrets = {
          SSM_PARAMETER = aws_ssm_parameter.test.arn
        }
      }
      image_identifier      = "public.ecr.aws/nginx/nginx:latest"
      image_repository_type = "ECR_PUBLIC"
    }
  }
  instance_configuration {
    cpu               = "1 vCPU"
    instance_role_arn = aws_iam_role.test.arn
    memory            = "3 GB"
  }
}

Relations

Closes #28849

References

Announcement
Launch blog

Output from Acceptance Testing

$ make testacc TESTS=TestAccAppRunnerService_ PKG=apprunner
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/apprunner/... -v -count 1 -parallel 20 -run='TestAccAppRunnerService_'  -timeout 180m
=== RUN   TestAccAppRunnerService_ImageRepository_basic
=== PAUSE TestAccAppRunnerService_ImageRepository_basic
=== RUN   TestAccAppRunnerService_ImageRepository_autoScaling
=== PAUSE TestAccAppRunnerService_ImageRepository_autoScaling
=== RUN   TestAccAppRunnerService_ImageRepository_encryption
=== PAUSE TestAccAppRunnerService_ImageRepository_encryption
=== RUN   TestAccAppRunnerService_ImageRepository_healthCheck
=== PAUSE TestAccAppRunnerService_ImageRepository_healthCheck
=== RUN   TestAccAppRunnerService_ImageRepository_instance_NoInstanceRole
=== PAUSE TestAccAppRunnerService_ImageRepository_instance_NoInstanceRole
=== RUN   TestAccAppRunnerService_ImageRepository_instance_Update
=== PAUSE TestAccAppRunnerService_ImageRepository_instance_Update
=== RUN   TestAccAppRunnerService_ImageRepository_networkConfiguration
=== PAUSE TestAccAppRunnerService_ImageRepository_networkConfiguration
=== RUN   TestAccAppRunnerService_ImageRepository_observabilityConfiguration
=== PAUSE TestAccAppRunnerService_ImageRepository_observabilityConfiguration
=== RUN   TestAccAppRunnerService_ImageRepository_runtimeEnvironmentVars
=== PAUSE TestAccAppRunnerService_ImageRepository_runtimeEnvironmentVars
=== RUN   TestAccAppRunnerService_ImageRepository_runtimeEnvironmentSecrets
=== PAUSE TestAccAppRunnerService_ImageRepository_runtimeEnvironmentSecrets
=== RUN   TestAccAppRunnerService_disappears
=== PAUSE TestAccAppRunnerService_disappears
=== RUN   TestAccAppRunnerService_tags
=== PAUSE TestAccAppRunnerService_tags
=== CONT  TestAccAppRunnerService_ImageRepository_basic
=== CONT  TestAccAppRunnerService_ImageRepository_networkConfiguration
=== CONT  TestAccAppRunnerService_tags
=== CONT  TestAccAppRunnerService_ImageRepository_encryption
=== CONT  TestAccAppRunnerService_disappears
=== CONT  TestAccAppRunnerService_ImageRepository_instance_Update
=== CONT  TestAccAppRunnerService_ImageRepository_healthCheck
=== CONT  TestAccAppRunnerService_ImageRepository_runtimeEnvironmentSecrets
=== CONT  TestAccAppRunnerService_ImageRepository_runtimeEnvironmentVars
=== CONT  TestAccAppRunnerService_ImageRepository_instance_NoInstanceRole
=== CONT  TestAccAppRunnerService_ImageRepository_observabilityConfiguration
=== CONT  TestAccAppRunnerService_ImageRepository_autoScaling
--- PASS: TestAccAppRunnerService_ImageRepository_runtimeEnvironmentVars (269.03s)
--- PASS: TestAccAppRunnerService_ImageRepository_instance_NoInstanceRole (269.10s)
--- PASS: TestAccAppRunnerService_disappears (280.36s)
--- PASS: TestAccAppRunnerService_ImageRepository_basic (296.15s)
--- PASS: TestAccAppRunnerService_ImageRepository_runtimeEnvironmentSecrets (303.67s)
--- PASS: TestAccAppRunnerService_tags (323.23s)
--- PASS: TestAccAppRunnerService_ImageRepository_networkConfiguration (441.90s)
--- PASS: TestAccAppRunnerService_ImageRepository_autoScaling (467.54s)
--- PASS: TestAccAppRunnerService_ImageRepository_instance_Update (511.81s)
--- PASS: TestAccAppRunnerService_ImageRepository_encryption (547.43s)
--- PASS: TestAccAppRunnerService_ImageRepository_healthCheck (566.74s)
--- PASS: TestAccAppRunnerService_ImageRepository_observabilityConfiguration (583.90s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/apprunner	583.996s

@github-actions
Copy link

Community Note

Voting for Prioritization

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

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added size/M Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. documentation Introduces or discusses updates to documentation. service/apprunner Issues and PRs that pertain to the apprunner service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Jan 13, 2023
@justinretzolk justinretzolk 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 Jan 13, 2023
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

LGTM 🚀.

% make testacc TESTARGS='-run=TestAccAppRunnerService_' PKG=apprunner ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/apprunner/... -v -count 1 -parallel 3  -run=TestAccAppRunnerService_ -timeout 180m
=== RUN   TestAccAppRunnerService_ImageRepository_basic
=== PAUSE TestAccAppRunnerService_ImageRepository_basic
=== RUN   TestAccAppRunnerService_ImageRepository_autoScaling
=== PAUSE TestAccAppRunnerService_ImageRepository_autoScaling
=== RUN   TestAccAppRunnerService_ImageRepository_encryption
=== PAUSE TestAccAppRunnerService_ImageRepository_encryption
=== RUN   TestAccAppRunnerService_ImageRepository_healthCheck
=== PAUSE TestAccAppRunnerService_ImageRepository_healthCheck
=== RUN   TestAccAppRunnerService_ImageRepository_instance_NoInstanceRole
=== PAUSE TestAccAppRunnerService_ImageRepository_instance_NoInstanceRole
=== RUN   TestAccAppRunnerService_ImageRepository_instance_Update
=== PAUSE TestAccAppRunnerService_ImageRepository_instance_Update
=== RUN   TestAccAppRunnerService_ImageRepository_networkConfiguration
=== PAUSE TestAccAppRunnerService_ImageRepository_networkConfiguration
=== RUN   TestAccAppRunnerService_ImageRepository_observabilityConfiguration
=== PAUSE TestAccAppRunnerService_ImageRepository_observabilityConfiguration
=== RUN   TestAccAppRunnerService_ImageRepository_runtimeEnvironmentVars
=== PAUSE TestAccAppRunnerService_ImageRepository_runtimeEnvironmentVars
=== RUN   TestAccAppRunnerService_ImageRepository_runtimeEnvironmentSecrets
=== PAUSE TestAccAppRunnerService_ImageRepository_runtimeEnvironmentSecrets
=== RUN   TestAccAppRunnerService_disappears
=== PAUSE TestAccAppRunnerService_disappears
=== RUN   TestAccAppRunnerService_tags
=== PAUSE TestAccAppRunnerService_tags
=== CONT  TestAccAppRunnerService_ImageRepository_basic
=== CONT  TestAccAppRunnerService_ImageRepository_networkConfiguration
=== CONT  TestAccAppRunnerService_ImageRepository_runtimeEnvironmentSecrets
--- PASS: TestAccAppRunnerService_ImageRepository_runtimeEnvironmentSecrets (310.17s)
=== CONT  TestAccAppRunnerService_ImageRepository_runtimeEnvironmentVars
--- PASS: TestAccAppRunnerService_ImageRepository_basic (329.10s)
=== CONT  TestAccAppRunnerService_tags
--- PASS: TestAccAppRunnerService_ImageRepository_networkConfiguration (410.89s)
=== CONT  TestAccAppRunnerService_ImageRepository_healthCheck
--- PASS: TestAccAppRunnerService_ImageRepository_runtimeEnvironmentVars (287.09s)
=== CONT  TestAccAppRunnerService_ImageRepository_instance_Update
--- PASS: TestAccAppRunnerService_tags (287.83s)
=== CONT  TestAccAppRunnerService_ImageRepository_instance_NoInstanceRole
--- PASS: TestAccAppRunnerService_ImageRepository_instance_NoInstanceRole (296.70s)
=== CONT  TestAccAppRunnerService_ImageRepository_encryption
--- PASS: TestAccAppRunnerService_ImageRepository_healthCheck (551.76s)
=== CONT  TestAccAppRunnerService_disappears
--- PASS: TestAccAppRunnerService_ImageRepository_instance_Update (479.08s)
=== CONT  TestAccAppRunnerService_ImageRepository_autoScaling
--- PASS: TestAccAppRunnerService_disappears (251.63s)
=== CONT  TestAccAppRunnerService_ImageRepository_observabilityConfiguration
--- PASS: TestAccAppRunnerService_ImageRepository_encryption (530.59s)
--- PASS: TestAccAppRunnerService_ImageRepository_autoScaling (443.45s)
--- PASS: TestAccAppRunnerService_ImageRepository_observabilityConfiguration (589.55s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/apprunner	1809.002s

@ewbankkit
Copy link
Contributor

@niallthomson Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit 950252e into hashicorp:main Jan 13, 2023
@github-actions github-actions bot added this to the v4.51.0 milestone Jan 13, 2023
@github-actions
Copy link

This functionality has been released in v4.51.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. Thank you!

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 19, 2023
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/apprunner Issues and PRs that pertain to the apprunner service. size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement]: App Runner now supports runtime variables from Secrets Manager and SSM
3 participants