Skip to content

Commit

Permalink
Add examples for the resources that support Terraform import.
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilsbhat committed Sep 22, 2023
1 parent d46398a commit 9124d6d
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/resources/artifact_store.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ resource "gocd_artifact_store" "docker" {
}
```

## Importing the existing GoCD artifact store to Terraform State
```terraform
resource "gocd_artifact_store" "docker" {
store_id = "docker"
}
```

```shell
# Once the above code is added, the resource can be imported by running the below command.
terraform import gocd_artifact_store.docker docker
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
11 changes: 11 additions & 0 deletions docs/resources/auth_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ resource "gocd_auth_config" "password_file_config" {
}
```

## Importing the existing GoCD authorization configuration to Terraform State
```terraform
resource "gocd_auth_config" "password_file_config" {
profile_id = "admin_new"
}
```

```shell
# Once the above code is added, the resource can be imported by running the below command.
terraform import gocd_auth_config.password_file_config admin_new
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
11 changes: 11 additions & 0 deletions docs/resources/cluster_profile.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ resource "gocd_cluster_profile" "kube_cluster_profile" {
}
```

## Importing the existing elastic agent profile to Terraform State
```terraform
resource "gocd_cluster_profile" "sample_cluster_profile" {
profile_id = "sample_ec2"
}
```

```shell
# Once the above code is added, the resource can be imported by running the below command.
terraform import gocd_cluster_profile.sample_cluster_profile sample_ec2
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
11 changes: 11 additions & 0 deletions docs/resources/elastic_agent_profile.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ resource "gocd_elastic_agent_profile" "sample_kubernetes" {
}
```

## Importing the existing cluster profile to Terraform State
```terraform
resource "gocd_elastic_agent_profile" "some_cluster_profile" {
profile_id = "kube_cluster_profile"
}
```

```shell
# Once the above code is added, the resource can be imported by running the below command.
terraform import gocd_elastic_agent_profile.some_cluster_profile kube_cluster_profile
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
11 changes: 11 additions & 0 deletions docs/resources/environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ resource "gocd_environment" "sample_environment" {
}
```

## Importing the existing GoCD environments to Terraform State
```terraform
resource "gocd_environment" "sample_environment" {
name = "sample_environment"
}
```

```shell
# Once the above code is added, the resource can be imported by running the below command.
terraform import gocd_environment.sample_environment sample_environment
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
11 changes: 11 additions & 0 deletions templates/resources/artifact_store.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ resource "gocd_artifact_store" "docker" {
}
```

## Importing the existing GoCD artifact store to Terraform State
```terraform
resource "gocd_artifact_store" "docker" {
store_id = "docker"
}
```

```shell
# Once the above code is added, the resource can be imported by running the below command.
terraform import gocd_artifact_store.docker docker
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
11 changes: 11 additions & 0 deletions templates/resources/auth_config.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ resource "gocd_auth_config" "password_file_config" {
}
```

## Importing the existing GoCD authorization configuration to Terraform State
```terraform
resource "gocd_auth_config" "password_file_config" {
profile_id = "admin_new"
}
```

```shell
# Once the above code is added, the resource can be imported by running the below command.
terraform import gocd_auth_config.password_file_config admin_new
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
11 changes: 11 additions & 0 deletions templates/resources/cluster_profile.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ resource "gocd_cluster_profile" "kube_cluster_profile" {
}
```

## Importing the existing elastic agent profile to Terraform State
```terraform
resource "gocd_cluster_profile" "sample_cluster_profile" {
profile_id = "sample_ec2"
}
```

```shell
# Once the above code is added, the resource can be imported by running the below command.
terraform import gocd_cluster_profile.sample_cluster_profile sample_ec2
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
11 changes: 11 additions & 0 deletions templates/resources/elastic_agent_profile.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ resource "gocd_elastic_agent_profile" "sample_kubernetes" {
}
```

## Importing the existing cluster profile to Terraform State
```terraform
resource "gocd_elastic_agent_profile" "some_cluster_profile" {
profile_id = "kube_cluster_profile"
}
```

```shell
# Once the above code is added, the resource can be imported by running the below command.
terraform import gocd_elastic_agent_profile.some_cluster_profile kube_cluster_profile
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
11 changes: 11 additions & 0 deletions templates/resources/environment.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ resource "gocd_environment" "sample_environment" {
}
```

## Importing the existing GoCD environments to Terraform State
```terraform
resource "gocd_environment" "sample_environment" {
name = "sample_environment"
}
```

```shell
# Once the above code is added, the resource can be imported by running the below command.
terraform import gocd_environment.sample_environment sample_environment
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down

0 comments on commit 9124d6d

Please sign in to comment.