Skip to content

Commit

Permalink
provider: support docker as dev-url (#64)
Browse files Browse the repository at this point in the history
* provider: support docker as dev-url

Signed-off-by: Giau. Tran Minh <[email protected]>

* chore: fixed lint

Signed-off-by: Giau. Tran Minh <[email protected]>

---------

Signed-off-by: Giau. Tran Minh <[email protected]>
  • Loading branch information
giautm authored Apr 20, 2023
1 parent ae1e34e commit c983b10
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ terraform {
}
}
}
provider "atlas" {}
provider "atlas" {
# Use MySQL 8 docker image as the dev database.
dev_url = "docker://mysql/8"
}
```

## Quick Start
Expand Down
8 changes: 5 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ For documentation about Atlas, visit: https://atlasgo.io
## Example Usage

```terraform
provider "atlas" {}
provider "atlas" {
# Use MySQL 8 docker image as the dev database.
dev_url = "docker://mysql/8/market"
}
data "atlas_schema" "market" {
dev_url = "mysql://root:pass@localhost:3307/market"
src = file("${path.module}/schema.hcl")
src = file("${path.module}/schema.hcl")
}
resource "atlas_schema" "market" {
Expand Down
8 changes: 5 additions & 3 deletions examples/provider/provider.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
provider "atlas" {}
provider "atlas" {
# Use MySQL 8 docker image as the dev database.
dev_url = "docker://mysql/8/market"
}

data "atlas_schema" "market" {
dev_url = "mysql://root:pass@localhost:3307/market"
src = file("${path.module}/schema.hcl")
src = file("${path.module}/schema.hcl")
}

resource "atlas_schema" "market" {
Expand Down
5 changes: 4 additions & 1 deletion internal/atlas/atlas.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,10 @@ func (c *Client) Status(ctx context.Context, data *StatusParams) (*StatusReport,
// interface.
func (c *Client) runCommand(ctx context.Context, args []string, report interface{}) (string, error) {
cmd := exec.CommandContext(ctx, c.path, args...)
cmd.Env = append(cmd.Env, "ATLAS_NO_UPDATE_NOTIFIER=1")
cmd.Env = append(cmd.Env,
"ATLAS_NO_UPDATE_NOTIFIER=1",
fmt.Sprintf("PATH=%s", os.Getenv("PATH")),
)
output, err := cmd.Output()
if err != nil {
exitErr, ok := err.(*exec.ExitError)
Expand Down

0 comments on commit c983b10

Please sign in to comment.