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]: Appflow OAuth2 token length error #32660

Closed
annsajee opened this issue Jul 24, 2023 · 3 comments · Fixed by #33192
Closed

[Bug]: Appflow OAuth2 token length error #32660

annsajee opened this issue Jul 24, 2023 · 3 comments · Fixed by #33192
Labels
bug Addresses a defect in current functionality. service/appflow Issues and PRs that pertain to the appflow service.
Milestone

Comments

@annsajee
Copy link

annsajee commented Jul 24, 2023

Terraform Core Version

1.2.4

AWS Provider Version

~> 4.31.0

Affected Resource(s)

Resource: aws_appflow_connector_profile

Using AWS Appflow with custom connector to connect to JIRA from Appflow. When passing the credentials the length of credentials is more than the terraform expected length.
I am getting an error for access_token, refresh_token, auth_code. However, the AWS provided length is 4096 as mentioned in documentations -

  1. https://docs.aws.amazon.com/appflow/1.0/APIReference/API_OAuth2Credentials.html.
  2. https://docs.aws.amazon.com/appflow/1.0/APIReference/API_ConnectorOAuthRequest.html

Please look into this issue and help provide a solution.

Expected Behavior

The expected behavior is to have the length in the range 1 to 4096 as mentioned in AWS documentation-

  1. https://docs.aws.amazon.com/appflow/1.0/APIReference/API_OAuth2Credentials.html.
  2. https://docs.aws.amazon.com/appflow/1.0/APIReference/API_ConnectorOAuthRequest.html

Actual Behavior

  1. expected length of connector_profile_config.0.connector_profile_credentials.0.custom_connector.0.oauth2.0.access_token to be in the range (1 - 2048)
  2. expected length of connector_profile_config.0.connector_profile_credentials.0.custom_connector.0.oauth2.0.refresh_token to be in the range (1 - 1024)
  3. expected length of connector_profile_config.0.connector_profile_credentials.0.custom_connector.0.oauth2.0.oauth_request.0.auth_code to be in the range (1 - 2048)

Relevant Error/Panic Output Snippet

Error: expected length of connector_profile_config.0.connector_profile_credentials.0.custom_connector.0.oauth2.0.access_token to be in the range (1 - 2048), got ***
│ 
│   with aws_appflow_connector_profile.jira_appflow_profile,
│   on appflow-jira.tf line 12, in resource "aws_appflow_connector_profile" "jira_appflow_profile":
│   12:            access_token = var.jira_access_token
│ 
╵
╷
│ Error: expected length of connector_profile_config.0.connector_profile_credentials.0.custom_connector.0.oauth2.0.refresh_token to be in the range (1 - 1024), got ***
│ 
│   with aws_appflow_connector_profile.jira_appflow_profile,
│   on appflow-jira.tf line 15, in resource "aws_appflow_connector_profile" "jira_appflow_profile":
│   15:            refresh_token = var.jira_refresh_token
│ 
╵
╷
│ Error: expected length of connector_profile_config.0.connector_profile_credentials.0.custom_connector.0.oauth2.0.oauth_request.0.auth_code to be in the range (1 - 2048), got ***
│ 
│   with aws_appflow_connector_profile.jira_appflow_profile,
│   on appflow-jira.tf line 17, in resource "aws_appflow_connector_profile" "jira_appflow_profile":
│   17:             auth_code = var.jira_auth_code
│

Terraform Configuration Files

resource "aws_appflow_connector_profile" "jira_appflow_profile" {
  name            = "jira-profile"
  connector_type  = "CustomConnector"
  connection_mode = "Public"

  connector_profile_config {

    connector_profile_credentials {
      custom_connector {
        authentication_type = "OAUTH2"
        oauth2 {
           access_token = var.jira_access_token
           client_id = var.jira_client_id
           client_secret = var.jira_client_secret
           refresh_token = var.jira_refresh_token
           oauth_request {
            auth_code = var.jira_auth_code
            redirect_uri = "https://${var.aws_region}.console.aws.amazon.com/appflow/oauth"
           }
        }
      }
    }

    connector_profile_properties {
      custom_connector {
        oauth2_properties{
          oauth2_grant_type = "AUTHORIZATION_CODE"
          token_url = "https://auth.atlassian.com/oauth/token"
        }
      }
    }
  }
}

Steps to Reproduce

create variables for credentials mentioned as var in code
add the resource aws_appflow_connector_profile code mentioned above
Use the right terraform and aws versions

Debug Output

No response

Panic Output

No response

Important Factoids

Didnt find any similar bug reported.

Documentation to support to increase the length to 4096 is:
The expected behavior is to have the length in the range 1 to 4096 as mentioned in AWS documentation-

  1. https://docs.aws.amazon.com/appflow/1.0/APIReference/API_OAuth2Credentials.html.
  2. https://docs.aws.amazon.com/appflow/1.0/APIReference/API_ConnectorOAuthRequest.html

References

AWS documentation-

  1. https://docs.aws.amazon.com/appflow/1.0/APIReference/API_OAuth2Credentials.html.
  2. https://docs.aws.amazon.com/appflow/1.0/APIReference/API_ConnectorOAuthRequest.html

Would you like to implement a fix?

None

@annsajee annsajee added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels Jul 24, 2023
@github-actions github-actions bot added the service/appflow Issues and PRs that pertain to the appflow service. label Jul 24, 2023
@github-actions
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.

@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Jul 24, 2023
@github-actions github-actions bot added this to the v5.15.0 milestone Aug 25, 2023
@github-actions
Copy link

github-actions bot commented Sep 1, 2023

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

github-actions bot commented Oct 1, 2023

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 Oct 1, 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. service/appflow Issues and PRs that pertain to the appflow service.
Projects
None yet
2 participants