diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index bc95e07..d7dde81 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -7,20 +7,18 @@ jobs: name: Run linter runs-on: ubuntu-latest steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v3 - - - name: Set up Go + - name: Set up Go uses: actions/setup-go@v3 with: - go-version-file: 'go.mod' + go-version-file: "go.mod" cache: true - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: - go-version-file: 'go.mod' + go-version-file: "go.mod" cache: true - version: v1.49.0 - only-new-issues: true \ No newline at end of file + version: v1.53 + only-new-issues: true diff --git a/go.mod b/go.mod index 151007a..7b99978 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/drfaust92/terraform-provider-airflow -go 1.19 +go 1.20 require ( github.com/apache/airflow-client-go/airflow v0.0.0-20230210234754-8ce0b39cfbb2 diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 67dfff0..280e5c8 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -2,6 +2,7 @@ package provider import ( "context" + "crypto/tls" "fmt" "log" "net/http" @@ -54,6 +55,11 @@ func AirflowProvider() *schema.Provider { RequiredWith: []string{"username"}, ConflictsWith: []string{"oauth2_token"}, }, + "disable_ssl_verification": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, }, ResourcesMap: map[string]*schema.Resource{ "airflow_connection": resourceConnection(), @@ -75,7 +81,16 @@ func AirflowProvider() *schema.Provider { } func providerConfigure(ctx context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) { - transport := logging.NewLoggingHTTPTransport(http.DefaultTransport) + var transport http.RoundTripper + + if disableSSl := d.Get("disable_ssl_verification").(bool); disableSSl { + transport = &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + } + } else { + transport = logging.NewLoggingHTTPTransport(http.DefaultTransport) + } + client := &http.Client{ Transport: transport, }