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

aws_apprunner_service is unable to detect an existing apprunner service deployed by another terraform #19776

Closed
eduard93 opened this issue Jun 11, 2021 · 2 comments
Labels
service/apprunner Issues and PRs that pertain to the apprunner service.

Comments

@eduard93
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue 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 issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Terraform v1.0.0
on windows_amd64
+ provider registry.terraform.io/hashicorp/aws v3.44.0

Affected Resource(s)

  • aws_apprunner_service

Terraform Configuration Files

provider "aws" {
  region = "us-east-2"
  profile = "ABC"
}

resource "aws_apprunner_service" "nginx" {
  service_name = "nginx"
  

  source_configuration {
    auto_deployments_enabled = false
    image_repository {
      image_configuration {
        port = "80"
      }
      image_identifier      = "public.ecr.aws/nginx/nginx:latest"
      image_repository_type = "ECR_PUBLIC"
    }
  }

  tags = {
    Name = "nginx-apprunner-service"
  }
}

Debug Output

Expected Behavior

Terraform automatically detects that apprunner service with the same already exists and does not attempt to create it again.
Apply on server 2 is equal to apply again on server 1.

Actual Behavior

Terraform on server 2 does not see AppRunner Service deployed by Server 1 and tries to deploy it again. It fails with:

│ Error: error creating App Runner Service (nginx): InvalidRequestException: Service with the provided name already exists: nginx.
│
│   with aws_apprunner_service.nginx,
│   on main.tf line 6, in resource "aws_apprunner_service" "nginx":
│    6: resource "aws_apprunner_service" "nginx" {
│

Steps to Reproduce

  1. terraform apply
  2. Copy main.tf to another server (or folder) and go into that new server/folder
  3. Run terraform apply there

Important Factoids

I want to deploy the same apprunner service from two different hosts, however a second host does not see an apprunner service deployed by a first host, tries to deploy it again and fails.

References

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/apprunner Issues and PRs that pertain to the apprunner service. labels Jun 11, 2021
@ewbankkit
Copy link
Contributor

ewbankkit commented Jun 14, 2021

Hi @eduard93 👋 Thank you for submitting this and this is an excellent use case of somewhere that Terraform and the Terraform AWS Provider could be much more helpful since in many cases they have enough information to return an error upfront during planning instead of unexpected behavior during apply.

I believe this falls under the provider-wide enhancement proposal of #14394, so by adding this link here it will add a reference to that issue so we can include it as a use case when thinking about the implementation details. Since this is likely something we will want more broadly across many resources, I'm going to close this particular issue to consolidate discussions, efforts, and prioritization on the topic while the reference would serve as the cue to make this specific resource one of the initial implementations. I would suggest those 👍 upvoting and subscribing here to do so on #14394 so we can appropriately gauge interest. Please feel free to provide feedback there.

@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Jun 14, 2021
@github-actions
Copy link

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 have found a problem that seems similar to this, 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 Jul 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/apprunner Issues and PRs that pertain to the apprunner service.
Projects
None yet
Development

No branches or pull requests

2 participants