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
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 build. This will create a provider binary in ${GOPATH}/bin/, e.g. ${GOPATH}/bin/terraform-provider-awsterraform init (optional if it hasn't be done already so it automatically creates the .terraform directory structure).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 terraform initNow 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.
@bflad I think lock.json needs to be updated ;)
I don't need to adjust lock.json personally, I believe the terraform init should adjust it.
@bflad Nice to know :)
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!
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!
Most helpful comment
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 build. This will create a provider binary in${GOPATH}/bin/, e.g.${GOPATH}/bin/terraform-provider-awsterraform init(optional if it hasn't be done already so it automatically creates the.terraformdirectory structure).terraform/plugins/OS_ARCH/directory, replacing the existing one. e.g. on OS X with an existing 1.29.0 provider binarycp ${GOPATH}/bin/terraform-provider-aws .terraform/plugins/darwin_amd64/terraform-provider-aws_v1.29.0_x4terraform initNow you should be able to run other
terraformcommands 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-dirflag as well.