atlantis
atlantis copied to clipboard
feat: adding extra plan and apply flags to api_controller
what
- Adding option to add flags to API (Test and Rebased from #3287 ) plus more improvements
why
used to specify terraform arguments via the API
tests
Control Test:
/usr/local/bin/python3.9 /Users/david.murphy/atlantis_api_test/atlantis_api_base_plan.py
Plan request sent successfully!
Payload was:
{'PR': 1,
'Paths': [{'Directory': '.', 'Workspace': 'default'}],
'Ref': 'example',
'Repository': 'dbmurphy/atlantis-example',
'Type': 'Github'}
TF Command was: atlantis plan -d .
TF Output
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# null_resource.example will be created
+ resource "null_resource" "example" {
+ id = (known after apply)
}
# null_resource.example2 will be created
+ resource "null_resource" "example2" {
+ id = (known after apply)
}
Plan: 2 to add, 0 to change, 0 to destroy.
Targeted example2 only Test:
/usr/local/bin/python3.9 /Users/david.murphy/atlantis_api_test/atlantis_api_targeted_plan.py
Plan request sent successfully!
Payload was:
{'PR': 1,
'Paths': [{'Directory': '.',
'ExtraFlags': ['-target=null_resource.example2'],
'Workspace': 'default'}],
'Ref': 'example',
'Repository': 'dbmurphy/atlantis-example',
'Type': 'Github'}
TF Command was: atlantis plan -d . -- -target=null_resource.example2
TF Output
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# null_resource.example2 will be created
+ resource "null_resource" "example2" {
+ id = (known after apply)
}
Plan: 1 to add, 0 to change, 0 to destroy.
╷
│ Warning: Resource targeting is in effect
│
│ You are creating a plan with the -target option, which means that the
│ result of this plan may not represent all of the changes requested by the
│ current configuration.
│
│ The -target option is not for routine use, and is provided only for
│ exceptional situations such as recovering from errors or mistakes, or when
│ Terraform specifically suggests to use it as part of an error message.
╵
Bad ExtraFlag Test:
/usr/local/bin/python3.9 /Users/david.murphy/atlantis_api_test/atlantis_api_bad_plan.py
Error occurred:
Status Code: (500)
{'Error': None,
'Failure': '',
'PlansDeleted': False,
'ProjectResults': [{'ApplySuccess': '',
'Command': 1,
'Error': {},
'Failure': '',
'ImportSuccess': None,
'PlanSuccess': None,
'PolicyCheckResults': None,
'ProjectName': '',
'RepoRelDir': '.',
'StateRmSuccess': None,
'SubCommand': '',
'VersionSuccess': '',
'Workspace': 'default'}]}
Payload was:
{'PR': 1,
'Paths': [{'Directory': '.',
'ExtraFlags': ['--invalid-flag'],
'Workspace': 'default'}],
'Ref': 'example',
'Repository': 'dbmurphy/atlantis-example',
'Type': 'Github'}
references
@nitrocode I have added tests and fixed the merge issues
@GenPage is there something I need to do here to trigger assignments and reviews? The only fail is on vupress messing with deploy test but I see you have a PR about that one.
@GenPage is there something I need to do here to trigger assignments and reviews? The only fail is on vupress messing with deploy test but I see you have a PR about that one.
just requesting the review for maintainers is enough, we will try to review this week and the vuepress error should be fixed after we merge the fix we have.
@jamengual @GenPage Where are we with this its sat for some time waiting on the approvers' group.
@dbmurphy Can you add a comment on why the test calls are commented out with Paths being the out-of-scope cause, that way someone else coming along can understand.
@dbmurphy Are you able to follow up on this?
@dbmurphy Are you able to follow up on this?
I'll get to this this weekend. Sorry, I've been hectic leading up to the end of the quarter for main job
This issue is stale because it has been open for 1 month with no activity. Remove stale label or comment or this will be closed in 1 month.
@dbmurphy any updates?
This issue is stale because it has been open for 1 month with no activity. Remove stale label or comment or this will be closed in 1 month.
Hello, any updates on this PR?
if there are no updates by next week, I'll take a look and merge. I don't want to block a PR on a code comment.
Hey @GenPage can we move on this? :)
This issue is stale because it has been open for 1 month with no activity. Remove stale label or comment or this will be closed in 1 month.
This issue is stale because it has been open for 1 month with no activity. Remove stale label or comment or this will be closed in 1 month.
@caiodelgadonew Apologies for this; I no longer can do code reviews and rely on our maintainer/core contributors to do so. Enough time has passed, and this should be re-opened with a new PR.