-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add project level auto destroy #1550
Merged
Merged
Changes from 36 commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
c47bc97
Add existing changes for just modifying the attributes
simonxmh 6bfea88
Remove testing residues
simonxmh bf80b24
Add conditional switch logic for nonbreaking changing
simonxmh cef9d18
Remove automated boolean setting
simonxmh 01a4069
Add all test changes
simonxmh 468036a
Add changelog changes and datasource
simonxmh 37bacc3
Merge branch 'main' into simonxmh/add_project_level_auto_destroy
simonxmh 822df2e
Add project data source changes
simonxmh 2152c80
Add workspace data source tests
simonxmh 1b115d0
Merge branch 'main' into simonxmh/add_project_level_auto_destroy
simonxmh 63b9299
Add go mod replace for now
simonxmh cfd4c95
Revert test for auto destroy
simonxmh bbbc2cd
Change go mod, make automated toggle
simonxmh c05b61a
Add missing interface method
simonxmh 2d2c113
Reduce nesting and add automated logic
simonxmh c57f046
Use the config level setting
simonxmh c2beedc
Change behavior of inherited field
simonxmh 54858bc
Fix the data source test
simonxmh f6701d0
Merge branch 'main' into simonxmh/add_project_level_auto_destroy
simonxmh 3c5ba7c
Remove duplicate tag binding stub
simonxmh 541a519
Disable beta tests
simonxmh 7e8107f
Merge branch 'main' into simonxmh/add_project_level_auto_destroy
simonxmh bc421e4
Fix creation flow
simonxmh 0a185f2
Add workspace updates
simonxmh bde235b
Update change log
simonxmh 696df89
Remove skip unless beta on project test
simonxmh 786db2c
update go-tfe dependency
simonxmh c138f5e
Merge branch 'main' into simonxmh/add_project_level_auto_destroy
simonxmh 8b794ca
downgrade go-tfe
simonxmh a5fb595
Fix state detection
simonxmh 67f6af2
Merge branch 'main' into simonxmh/add_project_level_auto_destroy
simonxmh d3c9240
Add provider doc update in projects doc
simonxmh 55c666b
Merge branch 'main' into simonxmh/add_project_level_auto_destroy
simonxmh 760f7f8
Merge branch 'main' into simonxmh/add_project_level_auto_destroy
simonxmh 0213836
Fix merged conflicts
simonxmh 8d46bb0
Add provider doc update in projects doc
simonxmh bd30592
Merge branch 'main' into simonxmh/add_project_level_auto_destroy
simonxmh 48315c8
Add ignore specificity based on attribute
simonxmh fa1b6b5
Change auto destroy activity duration into computed property
simonxmh 522bdd0
Fix data source test
simonxmh f571c80
Add read sensitivity to unsetting
simonxmh 6d46e79
Add doc changes
simonxmh d0bf2d1
Use SkipIfEnterprise on datasource test
simonxmh 6dd39b3
Add inherits attr to attribute referene
simonxmh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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 |
---|---|---|
|
@@ -129,6 +129,43 @@ func TestAccTFEProject_import(t *testing.T) { | |
}) | ||
} | ||
|
||
func TestAccTFEProject_withAutoDestroy(t *testing.T) { | ||
project := &tfe.Project{} | ||
rInt := rand.New(rand.NewSource(time.Now().UnixNano())).Int() | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
CheckDestroy: testAccCheckTFEProjectDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccTFEProject_basicWithAutoDestroy(rInt, "3d"), | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckTFEProjectExists( | ||
"tfe_project.foobar", project), | ||
testAccCheckTFEProjectAttributes(project), | ||
resource.TestCheckResourceAttr( | ||
"tfe_project.foobar", "auto_destroy_activity_duration", "3d"), | ||
), | ||
}, | ||
{ | ||
Config: testAccTFEProject_basicWithAutoDestroy(rInt, "10m"), | ||
ExpectError: regexp.MustCompile(`must be 1-4 digits followed by d or h`), | ||
}, | ||
{ | ||
Config: testAccTFEProject_basic(rInt), | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckTFEProjectExists( | ||
"tfe_project.foobar", project), | ||
testAccCheckTFEProjectAttributes(project), | ||
resource.TestCheckResourceAttr( | ||
"tfe_project.foobar", "auto_destroy_activity_duration", ""), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccTFEProject_update(rInt int) string { | ||
return fmt.Sprintf(` | ||
resource "tfe_organization" "foobar" { | ||
|
@@ -182,6 +219,20 @@ resource "tfe_project" "foobar" { | |
}`, rInt) | ||
} | ||
|
||
func testAccTFEProject_basicWithAutoDestroy(rInt int, duration string) string { | ||
return fmt.Sprintf(` | ||
resource "tfe_organization" "foobar" { | ||
name = "tst-terraform-%d" | ||
email = "[email protected]" | ||
} | ||
|
||
resource "tfe_project" "foobar" { | ||
organization = tfe_organization.foobar.name | ||
name = "projecttest" | ||
auto_destroy_activity_duration = "%s" | ||
}`, rInt, duration) | ||
} | ||
|
||
func testAccCheckTFEProjectDestroy(s *terraform.State) error { | ||
config := testAccProvider.Meta().(ConfiguredClient) | ||
|
||
|
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this feature requires a subscription upgrade we should skip this test for our nightly TFE CI using
skipUnlessCloud(t)
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll use
skipIfEnterprise
if that's the flag you mean? I don't believeskipUnlessCloud
is a thing. Unless you mean the opposite inskipIfCloud
?