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

Terraform fusionauth provider crashing when executing terraform apply #1482

Closed
jyotibhanot opened this issue Nov 8, 2021 · 2 comments
Closed

Comments

@jyotibhanot
Copy link

Terraform fusionauth provider crashing when executing terraform apply

Description

Terraform fusionauth provider v0.1.47 crashes when trying to create a new resource ( template )

Steps to produce

Create the template using below resource

resource "fusionauth_email" "passwordless_template" {
  name                  = "Passwordless Login -  [${var.env_name}]"
  default_from_name     = "Test"
  default_html_template = templatefile("${path.module}/email-templates/email-passwordless.en.html.tmpl", { passwordless_url = var.passwordless_url })
  default_subject       = "Verify your email [${var.env_name}]"
  default_text_template = templatefile("${path.module}/email-templates/email-passwordless.en.txt.tmpl", { passwordless_url = var.passwordless_url })
  from_email            = ""
  localized_from_names = {
    "ar" = "Test"
  }
  localized_subjects = {
    "ar" = "Verify your email [${var.env_name}]"
  }
  localized_html_templates = {
    "ar" = templatefile("${path.module}/email-templates/email-passwordless.ar.html.tmpl", { passwordless_url = var.passwordless_url })
  }
}



Execute terraform apply with below variables:

env_name                   = "test"
tenant_host                = "test.oraclecloud.com"
tenant_username            = "test"
issuer                     = "https://fusionauth-mysql.nonprod.net"
theme_name                 = "FusionAuth"
on_boarding_group_name     = "ON_BOARDING_CUSTOMER_TEST"
customer_group_name        = "CUSTOMER"
verification_url           = "https://test-nonprod.net/onboarding/test/$${verificationId}"
passwordless_url           = "https://test-nonprod.net/onboarding/test//$${code}"
forgot_password_subject    = "[Test] Reset your password"
email_set_password_subject = "[Test FusionAuth] Setup your password"
forgot_password_url        = "https://test-nonprod.net/onboarding/password/change/$${changePasswordId}?tenantId=$${user.tenantId}"
set_password_alternate_url = "https://test-nonprod.net/onboarding/password/change/$${changePasswordId}?tenantId=$${user.tenantId}"
set_password_url           = "https://test-nonprod.net/onboarding/test/$${changePasswordId}?tenantId=$${user.tenantId}"

email-passwordless.en.html.tmpl

[#setting url_escaping_charset="UTF-8"]
[#assign url = "${passwordless_url}" /]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" dir="ltr">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link
      href="https://use.typekit.net/fos7unw.css"
      rel="stylesheet"
    />
    <style type="text/css">
      .ExternalClass,
      .ExternalClass div,
      .ExternalClass font,
      .ExternalClass p,
      .ExternalClass span,
      .ExternalClass td,
      img {
        line-height: 100%;
      }
      #outlook a {
        padding: 0;
      }
      .ExternalClass,
      .ReadMsgBody {
        width: 100%;
      }
      a,
      blockquote,
      body,
      li,
      p,
      table,
      td {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
      }
      table,
      td {
        mso-table-lspace: 0;
        mso-table-rspace: 0;
      }
      img {
        -ms-interpolation-mode: bicubic;
        border: 0;
        height: auto;
        outline: 0;
        text-decoration: none;
      }
      .main {
        margin: 24px;
      }
      .banner {
        background-color: #023334;
        width: 100%;
        height: 120px;
        background-image: url(https://test/n/fr9ckauowgwh/b/assets/o/newJaibeeLogo.png),
          url(https://testn/fr9ckauowgwh/b/assets/o/banner_left.png),
          url(https://test/n/fr9ckauowgwh/b/assets/o/banner_right.png);
        background-size: 110px, 75px 119px, 75px 119px;
        background-repeat: no-repeat, no-repeat, no-repeat;
        background-position: center center, top left, top right;
      }
      table {
        border-collapse: collapse !important;
      }
      #bodyCell,
      #bodyTable,
      body {
        height: 100% !important;
        margin: 0;
        padding: 16px;
        font-family: "neuzeit-grotesk", sans-serif;
      }
      #bodyCell {
        padding: 20px;
      }
      #signIn {
        padding: 0 30px;
        font-size: 16px;
        font-weight: 700;
        margin: 15px 0 16px 0;
        line-height: 48px;
        height: 48px;
        border-radius: 2px;
        background-color: #00ffff;
        color: #000000;
        text-decoration: none;
        display: inline-block;
      }
      @media only screen and (max-width: 480px) {
        #bodyTable,
        body {
          width: 100% !important;
        }
        a,
        blockquote,
        body,
        li,
        p,
        table,
        td {
          -webkit-text-size-adjust: none !important;
        }
        body {
          min-width: 100% !important;
        }
      }
    </style>
  </head>
  <body
    leftmargin="0"
    marginwidth="0"
    topmargin="0"
    marginheight="0"
    offset="0"
    style="background-color:#f1f1f1;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;margin: 0;padding: 16px;font-family: neuzeit-grotesk, sans-serif;height: 100% !important;"
  >
    <table
      style="background-color:white;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;mso-table-lspace: 0pt;mso-table-rspace: 0pt;margin: 0;padding: 0;font-family: neuzeit-grotesk, sans-serif;border-collapse: collapse !important;height: 100% !important;"
      align="center"
      border="0"
      cellpadding="0"
      cellspacing="0"
      height="100%"
      width="100%"
      id="bodyTable"
    >
      <tr>
        <td
          align="left"
          valign="top"
          id="bodyCell"
          style="-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;mso-table-lspace: 0pt;mso-table-rspace: 0pt;margin: 0;padding: 0;font-family: neuzeit-grotesk, sans-serif;height: 100% !important;"
        >
          <div class="banner"></div>
          <div class="main">

            <p
              style="font-size: 16px;line-height: 24px;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;"
            >
              Welcome[#if (user.data.nickname)?? && user.data.nickname?is_string], $${user.data.nickname}[/#if]!
            </p>

            <p
              style="font-size: 16px;line-height: 24px;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;"
            >
              To activate your JB account on your app, we need you to confirm
              your identity by tapping the button below.
            </p>

            <div style="text-align:left">
              <a id="signIn" href="$${url}"> Login to JB app</a>
            </div>

            <p style="font-size: 16px; line-height: 24px">
              Thanks,
            </p>

            <p style="font-size: 18px; line-height: 22px; font-weight: 700">
              <strong>JB team</strong>
            </p>

            <hr
              style="border: 1px solid #f1f1f1; border-bottom: 0; margin: 20px 0;"
            />
            <p
              style="text-align: left;color: #999999;-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;"
            >
              Not you? If you didn’t send this request, please contact us at
              <a style="color:#009999" href="mailto:help@test"
                >help@test.co</a
              >.
            </p>
          </div>
        </td>
      </tr>
    </table>
  </body>
  </html>

email-passwordless.en.html.tmpl

[#setting url_escaping_charset="UTF-8"]
You have requested to log into FusionAuth using this email address. If you do not recognize this request please ignore this email.

[#-- The optional 'state' map provided on the Start Passwordless API call is exposed in the template as 'state' --]
[#assign url = "${passwordless_url}" /]
[#list state!{} as key, value][#if key != "tenantId" && value??][#assign url = url + "&" + key?url + "=" + value?url/][/#if][/#list]

$${url}

- FusionAuth Admin

I am getting below error:


goroutine 48 [running]:
github.com/gpsinsight/terraform-provider-fusionauth/fusionauth.buildEmail(0x1051ac6)
        github.com/gpsinsight/terraform-provider-fusionauth/fusionauth/resource_fusionauth_email.go:96 +0x38b
github.com/gpsinsight/terraform-provider-fusionauth/fusionauth.createEmail({0x19263d8, 0xc0001ccb00}, 0xc00055d778, {0x1784e00, 0xc00010eb70})
        github.com/gpsinsight/terraform-provider-fusionauth/fusionauth/resource_fusionauth_email.go:115 +0xd0
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc0003ad420, {0x19263d8, 0xc0001ccb00}, 0x2, {0x1784e00, 0xc00010eb70})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.8.0/helper/schema/resource.go:330 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0003ad420, {0x19263d8, 0xc0001ccb00}, 0xc000150750, 0xc0002e9d80, {0x1784e00, 0xc00010eb70})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.8.0/helper/schema/resource.go:456 +0x871
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc00030c078, {0x19263d8, 0xc0001ccb00}, 0xc000611180)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.8.0/helper/schema/grpc_provider.go:977 +0xd8a
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc000384e80, {0x1926480, 0xc0003fe2a0}, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.4.0/tfprotov5/tf5server/server.go:332 +0x6c
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x17d68e0, 0xc000384e80}, {0x1926480, 0xc0003fe2a0}, 0xc00068d260, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.4.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:380 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00032a700, {0x1932af8, 0xc0001d2480}, 0xc000372500, 0xc0003fecc0, 0x1dee080, 0x0)
        google.golang.org/grpc@v1.32.0/server.go:1194 +0xc8f
google.golang.org/grpc.(*Server).handleStream(0xc00032a700, {0x1932af8, 0xc0001d2480}, 0xc000372500, 0x0)
        google.golang.org/grpc@v1.32.0/server.go:1517 +0xa2a
google.golang.org/grpc.(*Server).serveStreams.func1.2()
        google.golang.org/grpc@v1.32.0/server.go:859 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/grpc@v1.32.0/server.go:857 +0x294

Error: The terraform-provider-fusionauth_v0.1.47 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

Please advice how this can be resolved.

@MCBrandenburg
Copy link

@jyotibhanot believe I fixed this in 'v0.1.50'

@robotdan
Copy link
Member

robotdan commented May 2, 2023

Closing as fixed. Please re-open if this still occurs.

@robotdan robotdan closed this as completed May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants