diff --git a/codefresh/resource_pipeline.go b/codefresh/resource_pipeline.go index 86f7af1..022e4e6 100644 --- a/codefresh/resource_pipeline.go +++ b/codefresh/resource_pipeline.go @@ -106,6 +106,10 @@ func resourcePipeline() *schema.Resource { Optional: true, Default: "github", }, + "description": { + Type: schema.TypeString, + Optional: true, + }, }, }, }, diff --git a/codefresh/resource_pipeline_test.go b/codefresh/resource_pipeline_test.go index a08ca82..defe85c 100644 --- a/codefresh/resource_pipeline_test.go +++ b/codefresh/resource_pipeline_test.go @@ -731,6 +731,57 @@ resource "codefresh_pipeline" "test" { `, rName, originalYamlString) } +func testAccCodefreshPipelineBasicConfigDescription(rName, repo, path, revision, context, description string) string { + return fmt.Sprintf(` +resource "codefresh_pipeline" "test" { + + lifecycle { + ignore_changes = [ + revision + ] + } + + name = "%s" + + spec { + spec_template { + repo = %q + path = %q + revision = %q + context = %q + } + + description = "%s" + } +} +`, rName, repo, path, revision, context, description) +} + +func TestAccCodefreshPipeline_Description(t *testing.T) { + name := pipelineNamePrefix + acctest.RandString(10) + resourceName := "codefresh_pipeline.test" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckCodefreshPipelineDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCodefreshPipelineBasicConfigDescription(name, "codefresh-contrib/react-sample-app", "./codefresh.yml", "master", "git", "This is my pipeline, there are many like it but this one is mine"), + Check: resource.ComposeTestCheckFunc( + testAccCheckCodefreshPipelineExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "spec.0.description", "This is my pipeline, there are many like it but this one is mine"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func TestAccCodefreshPipeline_Contexts(t *testing.T) { name := pipelineNamePrefix + acctest.RandString(10) resourceName := "codefresh_pipeline.test" diff --git a/examples/pipelines.md b/examples/pipelines.md index 9ba47b4..42de3bb 100644 --- a/examples/pipelines.md +++ b/examples/pipelines.md @@ -34,6 +34,7 @@ resource "codefresh_pipeline" "test" { spec { concurrency = 1 priority = 5 + description = "This is my pipeline, there are many like it, but this one is mine." spec_template { repo = "codefresh-contrib/react-sample-app"