Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/resources/airflow_variable.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ The following arguments are supported:

* `key` - (Required) The variable key.
* `value` - (Required) The variable value.
* `description` - (Optional) The variable description.

## Attributes Reference

Expand Down
12 changes: 12 additions & 0 deletions internal/provider/resource_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,22 +174,32 @@ func resourceConnectionUpdate(ctx context.Context, d *schema.ResourceData, m int

if v, ok := d.GetOk("host"); ok {
conn.SetHost(v.(string))
} else {
conn.SetHostNil()
}

if v, ok := d.GetOk("description"); ok {
conn.SetDescription(v.(string))
} else {
conn.SetDescriptionNil()
}

if v, ok := d.GetOk("login"); ok {
conn.SetLogin(v.(string))
} else {
conn.SetLoginNil()
}

if v, ok := d.GetOk("schema"); ok {
conn.SetSchema(v.(string))
} else {
conn.SetSchemaNil()
}

if v, ok := d.GetOk("port"); ok {
conn.SetPort(int32(v.(int)))
} else {
conn.SetPortNil()
}

if v, ok := d.GetOk("password"); ok && v.(string) != "" {
Expand All @@ -198,6 +208,8 @@ func resourceConnectionUpdate(ctx context.Context, d *schema.ResourceData, m int

if v, ok := d.GetOk("extra"); ok {
conn.SetExtra(v.(string))
} else {
conn.SetExtraNil()
}

_, _, err := client.ConnectionApi.PatchConnection(pcfg.AuthContext, connId).Connection(conn).Execute()
Expand Down
13 changes: 13 additions & 0 deletions internal/provider/resource_connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,19 @@ func TestAccAirflowConnection_full(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "description", rNameUpdated),
),
},
{
Config: testAccAirflowConnectionConfigBasic(rName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(resourceName, "connection_id", rName),
resource.TestCheckResourceAttr(resourceName, "conn_type", "http"),
resource.TestCheckResourceAttr(resourceName, "extra", ""),
resource.TestCheckResourceAttr(resourceName, "description", ""),
resource.TestCheckResourceAttr(resourceName, "port", "0"),
resource.TestCheckResourceAttr(resourceName, "schema", ""),
resource.TestCheckResourceAttr(resourceName, "login", ""),
resource.TestCheckResourceAttr(resourceName, "host", ""),
),
},
},
})
}
Expand Down