hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.82k stars 9.17k forks source link

[Bug]: AppFlow w/Hubspot Connector Profile #34422

Open codymoorhouse opened 11 months ago

codymoorhouse commented 11 months ago

Terraform Core Version

1.5.7

AWS Provider Version

5.6.2

Affected Resource(s)

Expected Behavior

Using terraform, I should be able to establish/create a HubSpot connector profile in AWS.

Actual Behavior

The connector profile could not be created saying there is a communication error from the connector.

Relevant Error/Panic Output Snippet

Error: creating AppFlow Connector Profile: ConnectorServerException: Error while communicating to connector: Got error from connector. No valid response and error details found in the connector response.

Terraform Configuration Files

resource "aws_appflow_connector_profile" "hubspot_connector" {
  name            = "XXXXXXXXXXXXXX"
  connector_type  = "CustomConnector"
  connection_mode = "Public"
  connector_label = "HubSpot"

  connector_profile_config {
    connector_profile_credentials {
      custom_connector {
        authentication_type = "OAUTH2"
        oauth2 {
          client_id     = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" 
          client_secret = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
          oauth_request {
            redirect_uri = "https://us-east-2.console.aws.amazon.com/appflow/oauth"
          }
        }
      }
    }

    connector_profile_properties {
      custom_connector {
        oauth2_properties {
          oauth2_grant_type = "AUTHORIZATION_CODE"
          token_url         = "https://api.hubapi.com/oauth/v1/token"
        }
        profile_properties = {
          "instanceUrl" = "https://app.hubspot.com/home?portalId=XXXXXXXX"
        }
      }
    }
  }
}

Steps to Reproduce

terraform apply

Debug Output

When manually creating this resource in the console, when you inspect network traffic, there are two notable payloads to share.

  1. Below is the payload when the initial form pops up when creating the connection before submitting

    {
    "connectorConfiguration": {
        "authenticationConfig": {
            "customAuthConfigs": null,
            "isApiKeyAuthSupported": false,
            "isBasicAuthSupported": false,
            "isCustomAuthSupported": false,
            "isIAMAuthSupported": false,
            "isOAuth2Supported": true,
            "oAuth2Defaults": {
                "authCodeUrls": [
                    "https://app.hubspot.com/oauth/authorize"
                ],
                "awsOwnedManagedAppClientId": null,
                "oauth2CustomProperties": null,
                "oauth2GrantTypesSupported": [
                    "AUTHORIZATION_CODE"
                ],
                "oauthScopes": [
                    "oauth crm.objects.companies.write crm.objects.companies.read crm.objects.deals.write crm.objects.deals.read crm.objects.owners.read crm.objects.contacts.read crm.objects.contacts.write crm.lists.write crm.lists.read tickets automation e-commerce forms sales-email-read"
                ],
                "tokenUrls": [
                    "https://api.hubapi.com/oauth/v1/token"
                ]
            }
        },
        "canUseAsDestination": true,
        "canUseAsSource": true,
        "connectorArn": null,
        "connectorDescription": null,
        "connectorLabel": "HubSpot",
        "connectorMetadata": null,
        "connectorModes": [
            "SOURCE",
            "DESTINATION"
        ],
        "connectorName": "HubSpot",
        "connectorOwner": "AWS",
        "connectorProvisioningConfig": null,
        "connectorProvisioningType": "LAMBDA",
        "connectorRuntimeSettings": null,
        "connectorType": "CUSTOMCONNECTOR",
        "connectorVersion": "1.0",
        "isPrivateLinkEnabled": false,
        "isPrivateLinkEndpointUrlRequired": false,
        "isSupportedApiVersionsRequired": true,
        "logoURL": null,
        "registeredAt": 1.671057581457E9,
        "registeredBy": "AWS",
        "supportedApiVersions": [
            "v1",
            "v2",
            "v3"
        ],
        "supportedConsoleFeatures": null,
        "supportedDataPullModes": null,
        "supportedDataTransferApis": null,
        "supportedDataTransferTypes": null,
        "supportedDestinationConnectors": [
            "Honeycode",
            "Marketo",
            "Redshift",
            "S3",
            "Salesforce",
            "SAPOData",
            "Snowflake",
            "Upsolver",
            "Zendesk",
            "CustomConnector",
            "CustomerProfiles"
        ],
        "supportedDestinationWriteConfiguration": {},
        "supportedOperators": [
            "PROJECTION",
            "EQUAL_TO",
            "BETWEEN",
            "GREATER_THAN",
            "GREATER_THAN_OR_EQUAL_TO",
            "LESS_THAN",
            "LESS_THAN_OR_EQUAL_TO",
            "CONTAINS",
            "NOT_EQUAL_TO",
            "ADDITION",
            "SUBTRACTION",
            "MULTIPLICATION",
            "DIVISION",
            "MASK_ALL",
            "MASK_FIRST_N",
            "MASK_LAST_N",
            "VALIDATE_NON_NULL",
            "VALIDATE_NON_ZERO",
            "VALIDATE_NON_NEGATIVE",
            "VALIDATE_NUMERIC",
            "NO_OP"
        ],
        "supportedSchedulingFrequencies": [
            "BYMINUTE",
            "HOURLY",
            "DAILY",
            "WEEKLY",
            "MONTHLY",
            "ONCE"
        ],
        "supportedSourceDataFormatTypes": null,
        "supportedTriggerTypes": [
            "Scheduled",
            "OnDemand"
        ],
        "supportedWriteOperations": [
            "INSERT",
            "UPDATE"
        ]
    }
    }
  2. Below is the payload presented when the form is submitted

    {
    "connectorProfileDetails": [
        {
            "connectionMode": "Public",
            "connectorLabel": "HubSpot",
            "connectorProfileArn": "arn:aws:appflow:us-east-2:XXXXXXXXXXXX:connectorprofile/XXXXXXXXXXXXXX",
            "connectorProfileName": "XXXXXXXXXXXXXX",
            "connectorProfileProperties": {
                "Amplitude": null,
                "CustomConnector": {
                    "oAuth2Properties": {
                        "oAuth2GrantType": "AUTHORIZATION_CODE",
                        "tokenUrl": "https://api.hubapi.com/oauth/v1/token",
                        "tokenUrlCustomProperties": null
                    },
                    "profileProperties": {},
                    "usePrivateLinkForMetadataAndAuthorization": false
                },
                "Datadog": null,
                "Dynatrace": null,
                "GoogleAnalytics": null,
                "Honeycode": null,
                "InforNexus": null,
                "Marketo": null,
                "Pardot": null,
                "Redshift": null,
                "SAPOData": null,
                "Salesforce": null,
                "ServiceNow": null,
                "Singular": null,
                "Slack": null,
                "Snowflake": null,
                "Trendmicro": null,
                "Veeva": null,
                "Zendesk": null
            },
            "connectorType": "CustomConnector",
            "createdAt": 1.700069526524E9,
            "credentialsArn": "arn:aws:secretsmanager:us-east-2:XXXXXXXXXXXX:secret:appflow!XXXXXXXXXXXX-HubSpot-XXXXXXXXXXXXXX-XXXXXXXXXXXXX-XXXXXX",
            "lastUpdatedAt": 1.700069526524E9,
            "privateConnectionProvisioningState": null
        }
    ],
    "nextToken": null
    }

Panic Output

No response

Important Factoids

This connector can be created manually in AWS and has been tested as a valid connection (e.g. I updated data in HubSpot with a flow using the connection - manually)

References

Would you like to implement a fix?

None

github-actions[bot] commented 11 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

LibertasAndy commented 9 months ago

add hubspot connector profile at terraform, got below error Error: expected connector_type to be one of ["Salesforce" "Singular" "Slack" "Redshift" "S3" "Marketo" "Googleanalytics" "Zendesk" "Servicenow" "Datadog" "Trendmicro" "Snowflake" "Dynatrace" "Infornexus" "Amplitude" "Veeva" "EventBridge" "LookoutMetrics" "Upsolver" "Honeycode" "CustomerProfiles" "SAPOData" "CustomConnector" "Pardot"], got Hubspot