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 --auto-approve args to apply #4

Open
wants to merge 1 commit into
base: master
from
File filter...
Filter file types
Jump to file or symbol
Failed to load files and symbols.
+1 −0
Diff settings

Always

Just for now

Add --auto-approve args to apply

Fix for `terraform apply` defaulting to interactive mode.

Started by user ptkimball
[EnvInject] - Loading node environment variables.
Building on master in workspace /var/lib/jenkins/workspace/Terraform PoC
[terraform-plugin] $ /var/lib/jenkins/tools/org.jenkinsci.plugins.terraform.TerraformInstallation/Terraform_0.11.3/terraform get
[terraform-plugin] $ /var/lib/jenkins/tools/org.jenkinsci.plugins.terraform.TerraformInstallation/Terraform_0.11.3/terraform apply -input=false "-state=/var/lib/jenkins/workspace/Terraform PoC/terraform-plugin/terraform-plugin.tfstate"

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  [32m+[0m create
[0m
Terraform will perform the following actions:

[32m  [32m+[0m [32maws_instance.example
[0m      id:                           <computed>
      ami:                          "ami-12345678"
      associate_public_ip_address:  <computed>
      availability_zone:            <computed>
      ebs_block_device.#:           <computed>
      ephemeral_block_device.#:     <computed>
      instance_state:               <computed>
      instance_type:                "t2.nano"
      ipv6_address_count:           <computed>
      ipv6_addresses.#:             <computed>
      key_name:                     <computed>
      network_interface.#:          <computed>
      network_interface_id:         <computed>
      placement_group:              <computed>
      primary_network_interface_id: <computed>
      private_dns:                  <computed>
      private_ip:                   <computed>
      public_dns:                   <computed>
      public_ip:                    <computed>
      root_block_device.#:          <computed>
      security_groups.#:            <computed>
      source_dest_check:            "true"
      subnet_id:                    "subnet-87654321"
      tenancy:                      <computed>
      volume_tags.%:                <computed>
      vpc_security_group_ids.#:     <computed>
[0m
[0m
[0m[1mPlan:[0m 1 to add, 0 to change, 0 to destroy.[0m

[0m[1mDo you want to perform these actions?[0m
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  [1mEnter a value:[0m [0m
[31m
[1m[31mError: [0m[0m[1mApply cancelled.[0m

[0m[0m[0m
FATAL: java.lang.Exception: Terraform Apply failed: 1
	at org.jenkinsci.plugins.terraform.TerraformBuildWrapper.executeApply(TerraformBuildWrapper.java:249)
	at org.jenkinsci.plugins.terraform.TerraformBuildWrapper.setUp(TerraformBuildWrapper.java:269)
	at hudson.model.Build$BuildExecution.doRun(Build.java:157)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
	at hudson.model.Run.execute(Run.java:1724)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:429)

Finished: FAILURE
  • Loading branch information...
ptkimball committed Mar 8, 2018
commit 47d6d3da54dd2cc437c1efb5df89cdccdb0f3eb0
@@ -234,6 +234,7 @@ public void executeApply(AbstractBuild build, final Launcher launcher, final Bui

args.add("apply");
args.add("-input=false");
args.add("--auto-approve");
args.add("-state="+stateFile.getRemote());

if (!isNullOrEmpty(getVariables())) {
ProTip! Use n and p to navigate between commits in a pull request.