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

[Bug]: provider: (#39255) - Not allowing empty role_arn under assume_role block #39306

Closed
devdootkim opened this issue Sep 13, 2024 · 8 comments · Fixed by #39328
Closed

[Bug]: provider: (#39255) - Not allowing empty role_arn under assume_role block #39306

devdootkim opened this issue Sep 13, 2024 · 8 comments · Fixed by #39328
Assignees
Labels
authentication Pertains to authentication; to the provider itself of otherwise. bug Addresses a defect in current functionality. provider Pertains to the provider itself, rather than any interaction with AWS. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement.
Milestone

Comments

@devdootkim
Copy link

devdootkim commented Sep 13, 2024

Terraform Core Version

1.0.10 , 1.9.2

AWS Provider Version

v5.67.0

Affected Resource(s)

Terraform provider makes error with empty value of role_arn which is under assume_role block after merging the PR provider: (#39255)

Expected Behavior

Two types of terraform apply environment.

  1. Command based apply
  2. By using Atlantis system

For type 2.
assume_role block is uesd for Atlantis system.
The system gives role_arn value.
There is no issue.

For type 1.
Command based apply is using locally assumed aws role.
No need to assume role again via terraform provider so we made role_arn = "" (empty value).

By v5.66.0, There is no issue with this process.

Actual Behavior

Type 1, command based apply,
terraform provider does not allow empty value of role_arn.

│ Error: Missing required argument
│ 
│   with provider["registry.terraform.io/hashicorp/aws"],
│   on provider.tf line 4, in provider "aws":
│    4: provider "aws" {
│ 
│ The argument "role_arn" is required, but no definition was found.

Relevant Error/Panic Output Snippet

Initializing modules...

Initializing the backend...

Initializing provider plugins...
- terraform.io/builtin/terraform is built in to Terraform
- Reusing previous version of hashicorp/aws from the dependency lock file
- Using previously-installed hashicorp/aws v5.67.0
│ Error: Missing required argument
│ 
│   with provider["registry.terraform.io/hashicorp/aws"],
│   on provider.tf line 4, in provider "aws":
│    4: provider "aws" {
│ 
│ The argument "role_arn" is required, but no definition was found.

Terraform Configuration Files

provider "aws" {
  assume_role {
    role_arn     = var.assume_role_arn
  }
}
variable "assume_role_arn" {
  description = ""
  default     = ""
}

Steps to Reproduce

terraform init

Initializing modules...

Initializing the backend...

Initializing provider plugins...
- terraform.io/builtin/terraform is built in to Terraform
- Reusing previous version of hashicorp/aws from the dependency lock file
- Using previously-installed hashicorp/aws v5.67.0

terraform plan
(with below provider config)

provider "aws" {
  assume_role {
    role_arn     = var.assume_role_arn
  }
}
variable "assume_role_arn" {
  description = ""
  default     = ""
}

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@devdootkim devdootkim added the bug Addresses a defect in current functionality. label Sep 13, 2024
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this 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.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Sep 13, 2024
@devdootkim
Copy link
Author

Workaround works with terraform 1.9.2
cloudfoundry/bosh-bootloader@bd8bd52

│ Warning: Missing required argument
│ 
│   with provider["registry.terraform.io/hashicorp/aws"],
│   on provider.tf line 1, in provider "aws":
│    1: provider "aws" {
│ 
│ The argument "role_arn" is required, but no definition was found.
│ 
│ This will be an error in a future release.

Not work with 1.0.10

│ Error: Missing required argument
│ 
│   with provider["registry.terraform.io/hashicorp/aws"],
│   on provider.tf line 4, in provider "aws":
│    4: provider "aws" {
│ 
│ The argument "role_arn" is required, but no definition was found.

@devdootkim
Copy link
Author

devdootkim commented Sep 13, 2024

WorkAround success with older terraform

Terraform version 1.0.10
Provider version v5.67.0

provider "aws" {

  dynamic "assume_role" {
    for_each = var.assume_role_arn != "" ? [1] : []
    content {
      role_arn     = var.assume_role_arn
    }
  }
}
variable "assume_role_arn" {
  default     = ""
}

@YorickH
Copy link

YorickH commented Sep 13, 2024

Duplicate of #39296 ?

@devdootkim
Copy link
Author

devdootkim commented Sep 13, 2024

Duplicate of #39296 ?

Yes the same issue.
I added another workaround for this issue.

@ewbankkit ewbankkit added regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. provider Pertains to the provider itself, rather than any interaction with AWS. authentication Pertains to authentication; to the provider itself of otherwise. and removed needs-triage Waiting for first response or review from a maintainer. labels Sep 13, 2024
@terraform-aws-provider terraform-aws-provider bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Sep 13, 2024
@gdavison gdavison self-assigned this Sep 13, 2024
@gdavison
Copy link
Contributor

This will be resolved by #39328. We're planning to release a bug fix update this Monday, 16 September.

In addition to the workarounds listed above, you can also set the value of var.aws_assume_role to null instead of "". For example:

variable "var.aws_assume_role" {
  type    = string
  default = null
}

Copy link

Warning

This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@github-actions github-actions bot added this to the v5.68.0 milestone Sep 16, 2024
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Sep 20, 2024
Copy link

This functionality has been released in v5.68.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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
authentication Pertains to authentication; to the provider itself of otherwise. bug Addresses a defect in current functionality. provider Pertains to the provider itself, rather than any interaction with AWS. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants