Skip to content
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

How to develop/ test existing provider locally? #5396

Closed
psura opened this issue Jul 31, 2018 · 6 comments
Closed

How to develop/ test existing provider locally? #5396

psura opened this issue Jul 31, 2018 · 6 comments
Labels
documentation Introduces or discusses updates to documentation. provider Pertains to the provider itself, rather than any interaction with AWS. stale Old or inactive issues managed by automation, if no further action taken these will get closed.

Comments

@psura
Copy link

psura commented Jul 31, 2018

Hi: I am looking at the readme here https://github.com/terraform-providers/terraform-provider-aws
I would like to make some changes to terraform-aws-provider and test it out locally.
I have setup the GO Path and cloned the aws provider under the GO_PATH and make build also succeeded without errors.
How do I refer/point my terraform to use my local provider?
In other words inside below config, how do I tell terraform to point to locally build provider?
provider "aws" {
region = "${var.aws_region}"
profile = "${var.aws_profile}"
}

Thanks!
Pavan

@bflad bflad added documentation Introduces or discusses updates to documentation. provider Pertains to the provider itself, rather than any interaction with AWS. labels Aug 1, 2018
@bflad
Copy link
Member

bflad commented Aug 1, 2018

Hi @psura 👋

Sorry this process may not be documented well anywhere other than the Plugin Installation documentation.

Here's the process I personally use for manually testing a custom provider binary (with my own Terraform configuration / outside the provider acceptance testing framework):

  • Make code changes inside provider
  • In the provider directory:
    • Run make build. This will create a provider binary in ${GOPATH}/bin/, e.g. ${GOPATH}/bin/terraform-provider-aws
  • In your custom Terraform configuration directory
    • Run terraform init (optional if it hasn't be done already so it automatically creates the .terraform directory structure)
    • Copy the newly build provider binary inside the .terraform/plugins/OS_ARCH/ directory, replacing the existing one. e.g. on OS X with an existing 1.29.0 provider binary cp ${GOPATH}/bin/terraform-provider-aws .terraform/plugins/darwin_amd64/terraform-provider-aws_v1.29.0_x4
    • Run terraform init

Now you should be able to run other terraform commands like plan and apply with the custom provider binary. Personally I do it this way since I work with a lot of different codebases of the provider, but its probably important to mention that you can probably adjust this process using the Terraform plugin cache via the -plugin-dir flag as well.

@Puneeth-n
Copy link
Contributor

@bflad I think lock.json needs to be updated ;)

@bflad
Copy link
Member

bflad commented Aug 1, 2018

I don't need to adjust lock.json personally, I believe the terraform init should adjust it.

@Puneeth-n
Copy link
Contributor

@bflad Nice to know :)

@github-actions
Copy link

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Jul 22, 2020
@ghost
Copy link

ghost commented Sep 21, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Sep 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. provider Pertains to the provider itself, rather than any interaction with AWS. stale Old or inactive issues managed by automation, if no further action taken these will get closed.
Projects
None yet
Development

No branches or pull requests

3 participants