-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle code blocks in import section
- Loading branch information
1 parent
662459e
commit cca2891
Showing
5 changed files
with
204 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Import is supported using the following syntax by providing the `id`: | ||
|
||
```shell | ||
#!/bin/bash | ||
terraform import docker_container.foo id | ||
``` | ||
|
||
### Example | ||
|
||
Assuming you created a `container` as follows | ||
|
||
```shell | ||
#!/bin/bash | ||
docker run --name foo -p8080:80 -d nginx | ||
# prints the container ID | ||
9a550c0f0163d39d77222d3efd58701b625d47676c25c686c95b5b92d1cba6fd | ||
``` | ||
|
||
you provide the definition for the resource as follows | ||
|
||
```terraform | ||
resource "docker_container" "foo" { | ||
name = "foo" | ||
image = "nginx" | ||
ports { | ||
internal = "80" | ||
external = "8080" | ||
} | ||
} | ||
``` | ||
|
||
then the import command is as follows | ||
|
||
```shell | ||
#!/bin/bash | ||
terraform import docker_container.foo 9a550c0f0163d39d77222d3efd58701b625d47676c25c686c95b5b92d1cba6fd | ||
``` |
39 changes: 39 additions & 0 deletions
39
pkg/tfgen/test_data/parse-imports/docker_container-expected.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
## Import | ||
|
||
```sh | ||
#!/bin/bash | ||
$ pulumi import docker:index/container:Container foo id | ||
``` | ||
|
||
### Example | ||
|
||
Assuming you created a `container` as follows | ||
|
||
```sh | ||
#!/bin/bash | ||
docker run --name foo -p8080:80 -d nginx | ||
# prints the container ID | ||
9a550c0f0163d39d77222d3efd58701b625d47676c25c686c95b5b92d1cba6fd | ||
``` | ||
|
||
you provide the definition for the resource as follows | ||
|
||
```terraform | ||
resource "docker_container" "foo" { | ||
name = "foo" | ||
image = "nginx" | ||
ports { | ||
internal = "80" | ||
external = "8080" | ||
} | ||
} | ||
``` | ||
|
||
then the import command is as follows | ||
|
||
```sh | ||
#!/bin/bash | ||
$ pulumi import docker:index/container:Container foo 9a550c0f0163d39d77222d3efd58701b625d47676c25c686c95b5b92d1cba6fd | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Import is supported using the following syntax by providing the `id`: | ||
|
||
```shell | ||
#!/bin/bash | ||
terraform import docker_container.foo id | ||
``` | ||
|
||
### Example | ||
|
||
Assuming you created a `container` as follows | ||
|
||
```shell | ||
#!/bin/bash | ||
docker run --name foo -p8080:80 -d nginx | ||
# prints the container ID | ||
9a550c0f0163d39d77222d3efd58701b625d47676c25c686c95b5b92d1cba6fd | ||
``` | ||
|
||
you provide the definition for the resource as follows | ||
|
||
```terraform | ||
resource "docker_container" "foo" { | ||
name = "foo" | ||
image = "nginx" | ||
ports { | ||
internal = "80" | ||
external = "8080" | ||
} | ||
} | ||
``` | ||
|
||
then the import command is as follows | ||
|
||
```shell | ||
#!/bin/bash | ||
terraform import docker_container.foo 9a550c0f0163d39d77222d3efd58701b625d47676c25c686c95b5b92d1cba6fd | ||
``` |