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_appstream_image_builder throws error with empty domain_join_info #26677

Closed
jhancock93 opened this issue Sep 7, 2022 · 19 comments · Fixed by #28215
Closed

aws_appstream_image_builder throws error with empty domain_join_info #26677

jhancock93 opened this issue Sep 7, 2022 · 19 comments · Fixed by #28215
Assignees
Labels
bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/appstream Issues and PRs that pertain to the appstream service.
Milestone

Comments

@jhancock93
Copy link
Contributor

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.2.1
on darwin_amd64

  • provider registry.terraform.io/hashicorp/aws v4.29.0
  • provider registry.terraform.io/hashicorp/external v2.2.2
  • provider registry.terraform.io/hashicorp/local v2.2.3
  • provider registry.terraform.io/hashicorp/null v3.1.1
  • provider registry.terraform.io/hashicorp/random v3.4.2
  • provider registry.terraform.io/hashicorp/time v0.8.0

Affected Resource(s)

  • aws_appstream_image_builder

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

resource "aws_appstream_image_builder" "image_builder" {
  # Image Builder only needs to be created in nonprod and the created image can be shared with prod account
  count                          = var.create_appstream_image_builder ? 1 : 0
  name                           = "My-Image-Builder"
  description                    = "AppStream Image Builder"
  display_name                   = "AppStream Image Builder"
  enable_default_internet_access = false
  image_name                     = "My Image Builder"
  instance_type                  = "stream.standard.medium"

  vpc_config {
    security_group_ids = [module.appstream_sg.security_group_id]
    subnet_ids         = [local.primary_private_subnet_ids[0]]
  }
}

Debug Output

│ Error: error setting domain_join_info for AppStream ImageBuilder (My-Image-Builder): domain_join_info: '': source data must be an array or slice, got map

│ with module.persistent.aws_appstream_image_builder.image_builder[0],
│ on ../../modules/persistent/appstream.tf line 6, in resource "aws_appstream_image_builder" "image_builder":
│ 6: resource "aws_appstream_image_builder" "image_builder" {

Panic Output

Expected Behavior

AppStream Image Builder should be created without errors

Actual Behavior

AppStream image builder resource fails during terraform plan phase with:
error domain_join_info: '': source data must be an array or slice, got map

Steps to Reproduce

  1. terraform plan

Important Factoids

This error did not occur with hashicorp aws provider version v4.20.0

References

  • #0000
@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/appstream Issues and PRs that pertain to the appstream service. labels Sep 7, 2022
@justinretzolk
Copy link
Member

Similar to #24798, which was fixed by #26454.

@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Sep 13, 2022
@jhancock93
Copy link
Contributor Author

Similar to #24798, which was fixed by #26454.

This still doesn't seem to be resolved with latest provider version (v4.32.0)

@iamperson347
Copy link

We are having the same issue when testing 4.36.1. However, our domain_join_info is NOT empty (confirmed by the last applied state file).

@justinretzolk
Copy link
Member

Hey @jhancock93 👋 Thank you for following up. I see my mistake now in that the linked issue/PR were for the aws_appstream_fleet resource, despite the issue referencing aws_appstream_image_builder. Since you mentioned you didn't run into this with version 4.20.0, I'll mark this as a regression as well.

@justinretzolk justinretzolk added the regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. label Nov 3, 2022
@braun1928
Copy link

@justinretzolk I created a branch with small changes that fix this, if you want to check out the diff.

I was attempting to create a test for it as well, but my AWS access is very limited and I can't create the necessary resources to complete it.

@PatriQ1414
Copy link

I am still facing this error in v4.39.0
Any workaround?

@PatriQ1414
Copy link

I am still facing this error in v4.39.0 Any workaround?

Downgraded to 4.28 and still getting the same error

@nngabriel
Copy link

I'm experiencing the same issue with v4.41.0.

@pureiboi
Copy link
Contributor

pureiboi commented Dec 5, 2022

I'm experiencing the same issue with 4.45.0

@matiassilverorh
Copy link

Any workaround? Because even downgrading to previous versions doesn't work.

@tjames-stig
Copy link
Contributor

tjames-stig commented Dec 5, 2022

I've identified 4d802fe as the commit which might have introduced the regression, which would mean that downgrading to before v4.28.0 might be a workaround for this bug.

@pureiboi
Copy link
Contributor

pureiboi commented Dec 6, 2022

I have identified this section of code is causing the issue,

the method in image_builder.go

func resourceImageBuilderRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {

	if err = d.Set("domain_join_info", flattenDomainInfo(imageBuilder.DomainJoinInfo)); err != nil {
		return diag.FromErr(fmt.Errorf("error setting `%s` for AppStream ImageBuilder (%s): %w", "domain_join_info", d.Id(), err))
	}

	if err = d.Set("vpc_config", flattenVPCConfig(imageBuilder.VpcConfig)); err != nil {
		return diag.FromErr(fmt.Errorf("error setting `%s` for AppStream ImageBuilder (%s): %w", "vpc_config", d.Id(), err))
	}

both domain_join_info and vpc_config is throwing error:

after the section of code setting domain_join_info is removed, below will surface for vpc_config.

│ Error: error setting vpc_config for AppStream ImageBuilder (linux-image-builder-test-tf): vpc_config: '': source data must be an array or slice, got map

I may be able to help, however with limited knowledge on golang and code structure, need more time on this.

@tjames-stig
Copy link
Contributor

I see exactly how this regression occurred. When #26454 was submitted, an acceptance test for appstream_fleet was performed, however, code in internal/services/appstream/fleet.go is also referenced in internal/services/appstream/image_builder.go, and that code was broken by the mentioned PR, and it was not detected because the acceptance tests for appstream_image_builder were not run.

@pureiboi
Copy link
Contributor

pureiboi commented Dec 12, 2022

anyone looking into the PR, whether is it ok to go forward?

@liamraeAL
Copy link

Any update on this? Still blocking our development.

@nngabriel
Copy link

Is there a way to push this? or collaborate to make it happen?

@tjames-stig
Copy link
Contributor

tjames-stig commented Jan 10, 2023

I've got a PR up (#28195) and linked to this, with all the appropriate acceptance testing performed. I would be happy to help out and do whatever is needed to make my PR viable for merging.

@ewbankkit ewbankkit self-assigned this Jan 17, 2023
ewbankkit added a commit that referenced this issue Jan 17, 2023
…-26677

aws_appstream_image_builder: domain_join_info and vpc_config throw error #26677
@github-actions github-actions bot added this to the v4.51.0 milestone Jan 17, 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 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 Feb 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/appstream Issues and PRs that pertain to the appstream service.
Projects
None yet